From 190d346275f362ff07d5c687349b328d3ee28c10 Mon Sep 17 00:00:00 2001 From: jgk Date: Tue, 17 Aug 2021 13:40:25 +0200 Subject: [PATCH] Undo wall cutting changes (slower but safer) --- src/Dodge/LevelGen/StaticWalls.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Dodge/LevelGen/StaticWalls.hs b/src/Dodge/LevelGen/StaticWalls.hs index f7da925b2..ba96d3fe1 100644 --- a/src/Dodge/LevelGen/StaticWalls.hs +++ b/src/Dodge/LevelGen/StaticWalls.hs @@ -155,10 +155,10 @@ cutWallsWithPoints (p:ps) ws = foldl' f ([],ws) (zip (p:ps) (ps++[p])) cutWallsWithPoints _ _ = error "Trying to cut empty polygon" -- | List the points of intersection between a segment and collection of walls. cutWallsPoints :: Point2 -> Point2 -> [WallP] -> [Point2] -cutWallsPoints p1 p2 = mapMaybe (uncurry $ intersectSegSegPreTest p1 p2) +cutWallsPoints p1 p2 = mapMaybe (uncurry $ myIntersectSegSeg p1 p2) -- | Given a segment and a wall, split the wall into two if it crosses the segment. cutWall :: Point2 -> Point2 -> WallP -> [WallP] -cutWall p1 p2 (x,y) = case intersectSegSegPreTest p1 p2 x y of +cutWall p1 p2 (x,y) = case myIntersectSegSeg p1 p2 x y of Nothing -> [(x,y)] Just cp -> [(x,cp),(cp,y)] -- | Add poly walls? @@ -187,7 +187,7 @@ addPolyWall wls (p1,p2) = maybeWs = safeMinimumOnMaybe (fmap (dist p3) . f) wls p3 = 0.5 *.* (p1 +.+ p2) p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1) - f = uncurry $ intersectSegSegPreTest p3 p4 + f = uncurry $ myIntersectSegSeg p3 p4 --g = uncurry $ intersectSegSegTest p3 p4 -- | Given a list of points and a point, returns a point in the list if any is close -- to the point.