Closed shawes closed 7 years ago
The issue is caused when calculating the area of a triangle and the rare case that the semi-perimeter is the same as one of the edges. So the equation times the product by zero and attempts to take the square-root, leading to the math error. I have updated the solution to check for this error, and if so, add a small epsilon to the semi-perimeter.
C:\MeshWork\Gus>pypy C:\Meshwork\Mesh3d\main.py --dim XYZ --size 3 --verbose --out "BB026decim.obj".csv --meshes "BB02_6decim_1.obj" Starting to read the mesh files... Reading in mesh: BB02_6decim_1.obj 338120it [00:00, 313730.37it/s]Traceback (most recent call last): File "C:\Meshwork\Mesh3d\main.py", line 3, in
core.run()
File "C:\Meshwork\Mesh3d\mesh3d\core.py", line 124, in run
meshes = _read_in_meshes(args)
File "C:\Meshwork\Mesh3d\mesh3d\core.py", line 26, in _read_in_meshes
meshes = map(lambda x: read_obj(x, args.verbose, DimensionOrder(args.dim)), args.meshes)
File "C:\Meshwork\Mesh3d\mesh3d\core.py", line 26, in
meshes = map(lambda x: read_obj(x, args.verbose, DimensionOrder(args.dim)), args.meshes)
File "C:\Meshwork\Mesh3d\mesh3d\mesh_io.py", line 22, in read_obj
contains_texture_vertex))
File "C:\Meshwork\Mesh3d\mesh3d\mesh_io.py", line 72, in _create_face
vertices[face_recipe[2] - 1])
File "C:\Meshwork\Mesh3d\mesh3d\face.py", line 15, in init
self.area3d = self._area_3d()
File "C:\Meshwork\Mesh3d\mesh3d\face.py", line 22, in _area_3d
return self._get_area(edge1, edge2, edge3)
File "C:\Meshwork\Mesh3d\mesh3d\face.py", line 35, in _get_area
(semiperimeter - edge3))
ValueError: math domain error