Improve segment intersection test, tweak room bounding

This commit is contained in:
2026-03-12 15:23:37 +00:00
parent 65383e2303
commit 24af6a731b
6 changed files with 41 additions and 30 deletions
+5 -9
View File
@@ -139,22 +139,18 @@ intersectSegSegFullTest x y z w =
{- | It is not always necessary to find a point of intersection, sometimes a
test may suffice.
This should intersect on endpoints.
-}
intersectSegSegTest ::
Point2 ->
Point2 ->
Point2 ->
Point2 ->
Bool
intersectSegSegTest :: Point2 -> Point2 -> Point2 -> Point2 -> Bool
{-# INLINE intersectSegSegTest #-}
intersectSegSegTest x y z w =
f x y z w && f z w x y && x /= y && z /= w
where
f a b c d =
f a b c d = compareLHS a b c /= compareLHS a b d
-- (not (isRHS a b c) && not (isLHS a b d))
-- || (not (isLHS a b c) && not (isRHS a b d))
(isRHS a b c && isLHS a b d)
|| (isLHS a b c && isRHS a b d)
-- (isRHS a b c && isLHS a b d)
-- || (isLHS a b c && isRHS a b d)
intersectSegSegPreTest ::
Point2 ->