Skip to content

Commit

Permalink
Merge cb47813 into 7c5606b
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Sep 3, 2021
2 parents 7c5606b + cb47813 commit acb7a34
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ladybug_geometry/geometry3d/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -1886,19 +1886,16 @@ def _split_with_rectangle(self, edge_1, edge_2, tolerance):
def _point_on_face(self, tolerance):
"""Get a point that is always reliably on this face."""
try:
move_vec = self._inward_pointing_vec(self)
except ZeroDivisionError: # face has duplicated start vertices; remove them
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
face = self.remove_colinear_vertices(tolerance)
move_vec = self._inward_pointing_vec(face)
except (AssertionError, ZeroDivisionError): # zero area Face3D; use center
return self.center

move_vec = move_vec * (tolerance + 0.00001)
point_on_face = self.boundary[0] + move_vec
vert2d = self.plane.xyz_to_xy(point_on_face)
if not self.polygon2d.is_point_inside(vert2d, Vector2D(1, 0.00001)):
point_on_face = self.boundary[0] - move_vec
point_on_face = face.boundary[0] + move_vec
vert2d = face.plane.xyz_to_xy(point_on_face)
if not face.polygon2d.is_point_inside(vert2d, Vector2D(1, 0.00001)):
point_on_face = face.boundary[0] - move_vec
return point_on_face

@staticmethod
Expand Down

0 comments on commit acb7a34

Please sign in to comment.