Simplify analyser machines somewhat

This commit is contained in:
2025-09-16 21:41:26 +01:00
parent 203919933c
commit 81d6727d8e
21 changed files with 418 additions and 464 deletions
+2 -3
View File
@@ -19,7 +19,6 @@ import Data.Aeson
import Data.Aeson.TH
import Geometry.Data
import Geometry.Intersect
import Geometry.LHS
import Geometry.Polygon
import Geometry.Vector
@@ -59,8 +58,8 @@ convexPolysOverlap cp1 cp2 =
-- | Test whether two polygons intersect or if one is contained in the other.
polyPointsOverlap :: [Point2] -> [Point2] -> Bool
polyPointsOverlap (p : ps) (q : qs) =
pointInPolygon p (q : qs)
|| pointInPolygon q (p : ps)
pointInPoly p (q : qs)
|| pointInPoly q (p : ps)
|| polyPointsIntersect (p : ps) (q : qs)
polyPointsOverlap _ _ = False
+3 -3
View File
@@ -63,9 +63,9 @@ pointInOrOnPolygon _ _ = undefined
{- | Test whether a point is strictly inside a polygon.
Supposes the points in the polygon are listed in anticlockwise order.
-}
pointInPolygon :: Point2 -> [Point2] -> Bool
pointInPolygon !p (x : xs) = all (\l -> uncurry isLHS l p) $ zip (x : xs) (xs ++ [x])
pointInPolygon _ [] = False
pointInPoly :: Point2 -> [Point2] -> Bool
pointInPoly !p (x : xs) = all (\l -> uncurry isLHS l p) $ zip (x : xs) (xs ++ [x])
pointInPoly _ [] = False
circInPolygon :: Point2 -> Float -> [Point2] -> Bool
circInPolygon !p !r (x : xs) = all f $ zip (x : xs) (xs ++ [x])