Skip to content

Commit

Permalink
fix(room2d): Expose filter tolerance on generate_alignment_axes
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Feb 13, 2025
1 parent 90d7da8 commit c3e99c4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions dragonfly/room2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -4554,7 +4554,7 @@ def room_orientation_plane(room_2ds, angle_tolerance=1.0):

@staticmethod
def generate_alignment_axes(room_2ds, distance, direction=Vector2D(0, 1),
angle_tolerance=1.0):
angle_tolerance=1.0, filter_tolerance=0):
"""Get suggested LineSegment2Ds for the Room2D.align method.
This method will return the most common axes across the input Room2D
Expand All @@ -4578,6 +4578,11 @@ def generate_alignment_axes(room_2ds, distance, direction=Vector2D(0, 1),
angle_tolerance: The max angle difference in degrees that the Room2D
segment direction can differ from the input direction before the
segments are not factored into this calculation of common axes.
filter_tolerance: A number that can be used to filter out axes in the
result, which are already perfectly aligned with the input polygon
segments. Setting this to zero wil guarantee that no axes are
filtered out no matter how close they are to the existing polygon
segments. (Default: 0).
Returns:
A tuple with two elements.
Expand All @@ -4601,7 +4606,7 @@ def generate_alignment_axes(room_2ds, distance, direction=Vector2D(0, 1),
polygons.append(hole)
# return the common axes and values
return Polygon2D.common_axes(
polygons, direction, min_distance, merge_distance, ang_tol)
polygons, direction, min_distance, merge_distance, ang_tol, filter_tolerance)

@staticmethod
def floor_segment_by_index(geometry, segment_index):
Expand Down

0 comments on commit c3e99c4

Please sign in to comment.