diff --git a/common/src/app/common/geom/shapes/intersect.cljc b/common/src/app/common/geom/shapes/intersect.cljc index 60a62ce9c4..76fe700c7b 100644 --- a/common/src/app/common/geom/shapes/intersect.cljc +++ b/common/src/app/common/geom/shapes/intersect.cljc @@ -55,16 +55,16 @@ (and (not= o1 o2) (not= o3 o4)) ;; p1, q1 and p2 colinear and p2 lies on p1q1 - (and (= o1 :coplanar) ^boolean (on-segment? p2 p1 q1)) + (and (= o1 ::coplanar) ^boolean (on-segment? p2 p1 q1)) ;; p1, q1 and q2 colinear and q2 lies on p1q1 - (and (= o2 :coplanar) ^boolean (on-segment? q2 p1 q1)) + (and (= o2 ::coplanar) ^boolean (on-segment? q2 p1 q1)) ;; p2, q2 and p1 colinear and p1 lies on p2q2 - (and (= o3 :coplanar) ^boolean (on-segment? p1 p2 q2)) + (and (= o3 ::coplanar) ^boolean (on-segment? p1 p2 q2)) ;; p2, q2 and p1 colinear and q1 lies on p2q2 - (and (= o4 :coplanar) ^boolean (on-segment? q1 p2 q2))))) + (and (= o4 ::coplanar) ^boolean (on-segment? q1 p2 q2))))) (defn points->lines "Given a set of points for a polygon will return diff --git a/common/test/common_tests/geom_shapes_intersect_test.cljc b/common/test/common_tests/geom_shapes_intersect_test.cljc index e6c73b0474..1ae12ef2b7 100644 --- a/common/test/common_tests/geom_shapes_intersect_test.cljc +++ b/common/test/common_tests/geom_shapes_intersect_test.cljc @@ -52,12 +52,10 @@ [(pt 0 5) (pt 10 5)])))) (t/testing "Two collinear overlapping segments" - ;; NOTE: The implementation compares orientation result (namespaced keyword ::coplanar) - ;; against unnamespaced :coplanar, so the collinear branch never triggers. - ;; Collinear overlapping segments are NOT detected as intersecting. - (t/is (false? (gint/intersect-segments? - [(pt 0 0) (pt 10 0)] - [(pt 5 0) (pt 15 0)])))) + ;; Collinear overlapping segments correctly detected as intersecting. + (t/is (true? (gint/intersect-segments? + [(pt 0 0) (pt 10 0)] + [(pt 5 0) (pt 15 0)])))) (t/testing "Two non-overlapping collinear segments" (t/is (false? (gint/intersect-segments?