Add concept of GameRoom, check viewing distance based on rooms
This commit is contained in:
+6
-1
@@ -128,15 +128,20 @@ addPointPolygon p ps
|
||||
| pointInOrOnPolygon p ps = ps
|
||||
| otherwise = orderPolygon $ p : ps
|
||||
-- | Creates the convex hull of a set of points.
|
||||
-- Need to verify whether or not this is ordered
|
||||
convexHull :: [Point2] -> [Point2]
|
||||
convexHull (x:y:z:xs) = grahamScan $ orderAroundFirst $ sortOn (\(V2 a b) -> (b,a)) (x:y:z:xs)
|
||||
convexHull _ = error "Tried to create the convex hull of two or fewer points"
|
||||
-- | Creates the convex hull of a set of points.
|
||||
-- Need to verify whether or not this is ordered
|
||||
convexHullSafe :: [Point2] -> [Point2]
|
||||
convexHullSafe (x:y:z:xs) = grahamScan $ orderAroundFirst $ sortOn (\(V2 a b) -> (b,a)) (x:y:z:xs)
|
||||
convexHullSafe _ = []
|
||||
|
||||
grahamScan :: [Point2] -> [Point2]
|
||||
grahamScan = foldr push []
|
||||
where
|
||||
push point stack = grahamEliminate (point:stack)
|
||||
|
||||
-- | Remove second element if top three elements are not counterclockwise.
|
||||
-- Repeat if necessary. See
|
||||
-- https://codereview.stackexchange.com/questions/206019/graham-scan-algorithm-in-haskell
|
||||
|
||||
Reference in New Issue
Block a user