Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion blueprint/src/python/helpers/region_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def simplify_union_of_polys(polys, union_fn, track_dependencies=False):

# Remove all empty polytopes
for i in range(len(polys)):
if polys[i].is_empty(include_boundary=False):
if polys[i].is_empty(include_boundary=True):
index.remove(i)

# Keep track of the tuples (int, int) of indexes which do not form a pairwise
Expand Down
21 changes: 21 additions & 0 deletions blueprint/src/python/tests/test_thin_union_regression.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from polytope import Polytope
from region import Region


def test_simplification_preserves_isolated_point():
point = Polytope.rect((2, 2), (3, 3))
region = Region.union([Region.from_polytope(point)])
assert region.contains((2, 3))
region.simplify()
assert region.contains((2, 3))
assert not region.contains((2, 4))


def test_simplification_preserves_segment_outside_full_dimensional_component():
rectangle = Polytope.rect((0, 1), (0, 1))
segment = Polytope.rect((2, 2), (0, 1))
region = Region.union([Region.from_polytope(rectangle), Region.from_polytope(segment)])
points = [(0, 0), (0.5, 0.5), (2, 0), (2, 0.5), (2, 1), (1.5, 0.5)]
before = [region.contains(point) for point in points]
region.simplify()
assert [region.contains(point) for point in points] == before
Loading