Skip to content

Commit

Permalink
fix(face): Prevent failure in the case of a sliver faces
Browse files Browse the repository at this point in the history
Technically, these faces are invalid but we should still serialize them so that we can report errors related to them.
  • Loading branch information
chriswmackey committed Jul 28, 2021
1 parent ff63f33 commit 0f2209b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ladybug_geometry/geometry3d/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -1883,8 +1883,11 @@ def _point_on_face(self, tolerance):
try:
move_vec = self._inward_pointing_vec(self)
except ZeroDivisionError: # face has duplicated start vertices; remove them
face = self.remove_colinear_vertices(tolerance)
move_vec = self._inward_pointing_vec(face)
try:
face = self.remove_colinear_vertices(tolerance)
move_vec = self._inward_pointing_vec(face)
except (AssertionError, ZeroDivisionError): # zero area Face3D; use the center
return self.center

move_vec = move_vec * (tolerance + 0.00001)
point_on_face = self.boundary[0] + move_vec
Expand Down

0 comments on commit 0f2209b

Please sign in to comment.