Skip to content

Commit 8279aac

Browse files
committed
fix(face): Improve accounting for tolerance in room solidity routine
We should be making sure that the _point_on_face is more than the tolerance away from any edge if we want it to work consistently with the tolerance specified in the other routines that use it.
1 parent 41cd695 commit 8279aac

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

ladybug_geometry/geometry3d/face.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3337,7 +3337,7 @@ def _point_on_face(self, tolerance):
33373337
except (AssertionError, ZeroDivisionError): # zero area Face3D; use center
33383338
return self.center
33393339

3340-
move_vec = move_vec * (tolerance + 0.00001)
3340+
move_vec = move_vec * (math.sqrt(2 * (tolerance ** 2)) + 0.00001)
33413341
point_on_face = face.boundary[0] + move_vec
33423342
vert2d = face.plane.xyz_to_xy(point_on_face)
33433343
if not face.polygon2d.is_point_inside(vert2d):

ladybug_geometry/geometry3d/polyface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def from_faces(cls, faces, tolerance):
172172
# get the polyface object and assign correct faces to it
173173
face_obj = cls(vertices, face_indices)
174174
if face_obj._is_solid:
175-
face_obj._faces = cls.get_outward_faces(faces, 0.01)
175+
face_obj._faces = cls.get_outward_faces(faces, tolerance)
176176
else:
177177
face_obj._faces = tuple(faces)
178178
return face_obj
@@ -806,7 +806,7 @@ def get_outward_faces(faces, tolerance):
806806
807807
Args:
808808
faces: A list of Face3D objects that together form a solid.
809-
tolerance: Optional tolerance for the permissable size of gap between
809+
tolerance: Optional tolerance for the permissible size of gap between
810810
faces at which point the faces are considered to have a single edge.
811811
812812
Returns:

0 commit comments

Comments
 (0)