This commit is contained in:
2025-10-24 18:50:09 +01:00
parent 488428b1ef
commit ccb809a090
9 changed files with 36 additions and 78 deletions
+1 -12
View File
@@ -126,12 +126,7 @@ pairsToIncGraph pairs =
inodes = UV.generate (length ps) (ps !!)
ps = Set.toList $ Set.map fst pairs <> Set.map snd pairs
obstructPathsCrossing ::
S.Set EdgeObstacle ->
Point2 ->
Point2 ->
World ->
World
obstructPathsCrossing :: S.Set EdgeObstacle -> Point2 -> Point2 -> World -> World
obstructPathsCrossing obs s e w = w & cWorld . incGraph %~ updateincedges
where
updateincedge = flip $ updateEdge (S.union obs)
@@ -139,12 +134,6 @@ obstructPathsCrossing obs s e w = w & cWorld . incGraph %~ updateincedges
inces = filter inedgecrosses $ nearSeg peZoneSize _incEdgeZoning s e w
inedgecrosses (i, j) = isJust $ intersectSegSeg s e (f i) (f j)
f i = w ^?! cWorld . incNode . ix i
--es = Set.filter edgecrosses $ pesNearSeg sp ep w
-- edgecrosses (PathEdgeNodes _ _ pe) =
-- isJust $ intersectSegSeg s e (_peStart pe) (_peEnd pe)
-- updateedges gr = foldl' updateedge gr es
-- updateedge gr (PathEdgeNodes x y pe) =
-- insEdge (x, y, pe & peObstacles . at obstacletype ?~ ()) $ delEdge (x, y) gr
snapToGrid :: Set (Point2, Point2) -> Set (Point2, Point2)
snapToGrid = Set.map (over each (fmap (fromIntegral . f)))