Make zoning more universal

This commit is contained in:
2022-06-28 19:04:31 +01:00
parent 4965934502
commit b1a7e1bf35
16 changed files with 152 additions and 97 deletions
+3 -2
View File
@@ -28,7 +28,7 @@ makePathBetween a b w = do -- join $ sp <$> a' <*> b' <*> return (_pathGraph w)
sp na nb (_pathGraph w)
where
--nodesNear p = concat $ lookLookups (zoneNearPointIP p) (_pathPoints w)
nodesNear p = runIdentity . S.toList_ $ nearPoint wlZoneSize _pathPoints p w
nodesNear p = runIdentity . S.toList_ $ nearPoint _phZoning p w
walkableNodeNear p = fmap fst . find (flip (isWalkable p) w . snd) $ nodesNear p
--walkableNodeNear :: Point2 -> World -> Maybe Point2
@@ -93,7 +93,8 @@ removePathsCrossing :: Point2 -> Point2 -> World -> World
removePathsCrossing a b w = w
& pathGraph .~ newGraph
& pathGraphP .~ pg'
& pathPoints .~ foldl' insertpoint (Zoning mempty) (labNodes newGraph)
& phZoning %~ \zn -> foldl' (flip $ insertInZoning (:)) (zn & znObjects .~ mempty)
(labNodes newGraph)
where
pg' = Set.filter (isNothing . uncurry (intersectSegSeg a b)) $ _pathGraphP w
insertpoint zn (i,p) = insertInZoneWith (wlZoneOfPoint p) (++) [(i,p)] zn