Skip to content

Commit

Permalink
fix(intersection): Use an absolute tolerance for 2D line intersection
Browse files Browse the repository at this point in the history
This is needed for when the coordinates are very close to zero.
  • Loading branch information
chriswmackey committed Sep 24, 2024
1 parent 0d5e78b commit 161f94e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion ladybug_geometry/geometry3d/face.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ class Face3D(Base2DIn3D):
* perimeter
* area
* centroid
* altitude
* azimuth
* altitude
* tilt
* is_clockwise
* is_convex
* is_self_intersecting
Expand Down
4 changes: 2 additions & 2 deletions ladybug_geometry/intersection2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
from .geometry2d.pointvector import Point2D, Vector2D


def _isclose(a, b, rel_tol=1e-09, abs_tol=0.0):
def _isclose(a, b, rel_tol=1e-09, abs_tol=1e-09):
"""Implementation of the math.isclose method from Python 3.5 onward."""
return abs(a-b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)
return abs(a - b) <= max(rel_tol * max(abs(a), abs(b)), abs_tol)


def intersect_line2d(line_ray_a, line_ray_b):
Expand Down

0 comments on commit 161f94e

Please sign in to comment.