Undo wall cutting changes (slower but safer)
This commit is contained in:
@@ -155,10 +155,10 @@ cutWallsWithPoints (p:ps) ws = foldl' f ([],ws) (zip (p:ps) (ps++[p]))
|
|||||||
cutWallsWithPoints _ _ = error "Trying to cut empty polygon"
|
cutWallsWithPoints _ _ = error "Trying to cut empty polygon"
|
||||||
-- | List the points of intersection between a segment and collection of walls.
|
-- | List the points of intersection between a segment and collection of walls.
|
||||||
cutWallsPoints :: Point2 -> Point2 -> [WallP] -> [Point2]
|
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.
|
-- | Given a segment and a wall, split the wall into two if it crosses the segment.
|
||||||
cutWall :: Point2 -> Point2 -> WallP -> [WallP]
|
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)]
|
Nothing -> [(x,y)]
|
||||||
Just cp -> [(x,cp),(cp,y)]
|
Just cp -> [(x,cp),(cp,y)]
|
||||||
-- | Add poly walls?
|
-- | Add poly walls?
|
||||||
@@ -187,7 +187,7 @@ addPolyWall wls (p1,p2) =
|
|||||||
maybeWs = safeMinimumOnMaybe (fmap (dist p3) . f) wls
|
maybeWs = safeMinimumOnMaybe (fmap (dist p3) . f) wls
|
||||||
p3 = 0.5 *.* (p1 +.+ p2)
|
p3 = 0.5 *.* (p1 +.+ p2)
|
||||||
p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1)
|
p4 = p3 +.+ 10000 *.* vNormal (p2 -.- p1)
|
||||||
f = uncurry $ intersectSegSegPreTest p3 p4
|
f = uncurry $ myIntersectSegSeg p3 p4
|
||||||
--g = uncurry $ intersectSegSegTest 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
|
-- | Given a list of points and a point, returns a point in the list if any is close
|
||||||
-- to the point.
|
-- to the point.
|
||||||
|
|||||||
Reference in New Issue
Block a user