Improve debugDraw

This commit is contained in:
2022-07-02 17:45:03 +01:00
parent dc3b78f8c4
commit 8a612be5fe
5 changed files with 41 additions and 47 deletions
+5 -16
View File
@@ -119,24 +119,13 @@ addEdges nodemap gr = runIdentity . S.fold_ f (mempty,gr) id
g a = nodemap M.! a
obstructPathsCrossing :: Point2 -> Point2 -> World -> ( World, [(Int,Int,PathEdge)])
obstructPathsCrossing sp ep w =
obstructPathsCrossing sp' ep w =
( w & pathGraph %~ updateedges
, runIdentity $ S.toList_ edges
, runIdentity $ S.toList_ es
)
where
edges = S.filter edgecrosses $ nearSeg _peZoning sp ep w
edgecrosses (_,_,pe) = isJust $ intersectSegSeg sp ep (_peStart pe) (_peEnd pe)
updateedges gr = runIdentity $ S.fold_ updateedge gr id edges
es = S.filter edgecrosses $ nearSeg _peZoning sp' ep w
edgecrosses (_,_,pe) = isJust $ intersectSegSeg sp' ep (_peStart pe) (_peEnd pe)
updateedges gr = runIdentity $ S.fold_ updateedge gr id es
updateedge gr (x,y,pe)
= insEdge (x,y,pe & peObstacles . at BlockObstacle ?~ ()) $ delEdge (x,y) gr
removePathsCrossing :: Point2 -> Point2 -> World -> World
removePathsCrossing a b w = w
-- & pathGraph .~ newGraph
-- & pathGraphP .~ pg'
-- & phZoning %~ \zn -> foldl' (flip $ updateZoning (:)) (zn & znObjects .~ mempty)
-- (labNodes newGraph)
-- where
-- pg' = Set.filter (isNothing . uncurry (intersectSegSeg a b)) $ _pathGraphP w
-- -- insertPoint pp@(_,p) = insertInZoneWith (wlZoneOfPoint p) (++) [pp]
-- newGraph = pairsToGraph pg'