Stop gibbed/pitted creatures from opening doors

This commit is contained in:
2026-03-23 22:59:35 +00:00
parent daba012e83
commit 7917192b77
6 changed files with 20 additions and 21 deletions
+6 -19
View File
@@ -159,25 +159,12 @@ convexHull _ = error "Tried to create the convex hull of two or fewer points"
-- | otherwise = convexPartition (y:z:xs <> [x])
--convexPartition _ = error "unexpected shape for convexPartition"
-- monotone means that all lines orthogonal to the first vector
-- must only intersect the polygon at most once
partitionMonotonePoly :: Point2 -> [Point2] -> [[Point2]]
partitionMonotonePoly v ps = [qs]
where
qs = sortOn (dot v) ps
monotonePolyChains :: Point2 -> [Point2] -> ([Point2],[Point2])
monotonePolyChains v ps = undefined
earClip :: [Point2] -> [[Point2]]
earClip (x:y:z:[]) = [(x:y:z:[])]
earClip (x:y:z:xs)
| isLHS x y z && not (any (`pointInPoly` (x:y:z:[])) xs) = (x:y:z:[]) : earClip (x:z:xs)
| otherwise = earClip (y:z:xs ++ [x])
earClip _ = error "earClip: non-simple polygon input?"
fusePolys :: [Point2] -> [Point2] -> [Point2]
fusePolys xs ys = xs
triangulateEarClip :: [Point2] -> [[Point2]]
triangulateEarClip (x:y:z:[]) = [(x:y:z:[])]
triangulateEarClip (x:y:z:xs)
| isLHS x y z && not (any (`pointInPoly` (x:y:z:[])) xs) = (x:y:z:[]) : triangulateEarClip (x:z:xs)
| otherwise = triangulateEarClip (y:z:xs ++ [x])
triangulateEarClip _ = error "triangulateEarClip: non-simple polygon input?"
{- | Creates the convex hull of a set of points.
assumes no repetition of points: try nubbing!