File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed
Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -1949,7 +1949,8 @@ def check_geometry_disjoint(lop: List[Polygon]) -> bool:
19491949 Returns True if all polygons in 'lop' are disjoint. Returns
19501950 False, otherwise.
19511951 """
1952- geom_acc = Polygon ()
1953- for poly in lop :
1954- geom_acc = geom_acc & poly
1955- return geom_acc .is_empty
1952+ bool_acc = []
1953+ for idx , poly1 in enumerate (lop ):
1954+ for poly2 in lop [idx + 1 :]:
1955+ bool_acc .append (poly1 .intersection (poly2 ))
1956+ return not all (bool_acc )
Original file line number Diff line number Diff line change @@ -442,8 +442,10 @@ def test_check_geometry_disjoint():
442442 small_sq = rectangular_section (d = 100 , b = 75 )
443443 small_hole = rectangular_section (d = 40 , b = 30 ).align_center (small_sq )
444444
445+ rect2 = rectangular_section (d = 50 , b = 50 ).shift_section (x_offset = 50 )
446+ assert check_geometry_disjoint ([rect .geom , rect2 .geom ]) == False
447+
445448 assert check_geometry_disjoint ([rect .geom , circ .geom ]) == True
446- assert check_geometry_overlaps ([small_sq .geom , small_hole .geom ]) == True
447449
448450 rect2 = rectangular_section (d = 50 , b = 50 ).shift_section (x_offset = 50 )
449451 assert check_geometry_disjoint ([rect .geom , rect2 .geom ]) == False
You can’t perform that action at this time.
0 commit comments