Skip to content

Commit fc4b9ca

Browse files
baehrjogonzalocasas
authored andcommitted
add test to is_polygon_in_polygon_xy fix report
1 parent 88fc9c9 commit fc4b9ca

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

tests/compas/geometry/predicates/test_predicates_2.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from compas.geometry import Circle
22
from compas.geometry import Plane
33
from compas.geometry import Point
4+
from compas.geometry import Polygon
45
from compas.geometry import Vector
5-
from compas.geometry import is_point_in_circle_xy
6+
from compas.geometry import is_point_in_circle_xy, is_polygon_in_polygon_xy
67

78

89
def test_is_point_in_circle_xy():
@@ -24,3 +25,16 @@ def test_is_point_in_circle_xy_class_input():
2425

2526
pt_outside = Point(15, 15, 0)
2627
assert is_point_in_circle_xy(pt_outside, circle) is False
28+
29+
30+
def test_is_polygon_in_polygon_xy():
31+
polygon_contour = Polygon([(0, 0, 0), (4, 2, 0), (10, 0, 0), (11, 10, 0), (8, 12, 0), (0, 10, 0)])
32+
polygon_inside = Polygon([(5, 5, 0), (10, 5, 0), (10, 10 ,0), (5, 10, 0)])
33+
assert is_polygon_in_polygon_xy(polygon_contour, polygon_inside) is True
34+
35+
polygon_outside = Polygon([(15, 5, 0), (20, 5, 0), (20, 10 ,0), (15, 10, 0)])
36+
assert is_polygon_in_polygon_xy(polygon_contour, polygon_outside) is False
37+
38+
polygon_intersecting = Polygon([(10, 5, 0), (15, 5, 0), (15, 10 ,0), (10, 10, 0)])
39+
assert is_polygon_in_polygon_xy(polygon_contour, polygon_intersecting) is False
40+

0 commit comments

Comments
 (0)