11from compas .geometry import Circle
22from compas .geometry import Plane
33from compas .geometry import Point
4+ from compas .geometry import Polygon
45from 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
89def 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