Make pathedge zoning use sets, probably doesn't help

This commit is contained in:
2022-08-24 14:01:39 +01:00
parent 13b07b53ce
commit 6973663055
16 changed files with 68 additions and 53 deletions
+4 -4
View File
@@ -12,6 +12,8 @@ module Dodge.Path (
fusePairs,
) where
import Data.Set (Set)
import qualified Data.Set as Set
import Control.Lens
import Data.Foldable
import Data.Graph.Inductive hiding ((&))
@@ -19,8 +21,6 @@ import Data.List
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Set (Set)
import qualified Data.Set as Set
import Dodge.Base.Collide
import Dodge.Data.World
import Dodge.Zoning.Base
@@ -131,13 +131,13 @@ addEdges nodemap gr = foldl' f (mempty, gr)
theedge = (g a, g b, PathEdge a b (dist a b) mempty)
g a = nodemap M.! a
obstructPathsCrossing :: EdgeObstacle -> Point2 -> Point2 -> World -> (World, [(Int, Int, PathEdge)])
obstructPathsCrossing :: EdgeObstacle -> Point2 -> Point2 -> World -> (World, Set (Int, Int, PathEdge))
obstructPathsCrossing obstacletype sp' ep w =
( w & cWorld . pathGraph %~ updateedges
, es
)
where
es = filter edgecrosses $ pesNearSeg sp' ep w
es = Set.filter edgecrosses $ pesNearSeg sp' ep w
edgecrosses (_, _, pe) = isJust $ intersectSegSeg sp' ep (_peStart pe) (_peEnd pe)
updateedges gr = foldl' updateedge gr es
updateedge gr (x, y, pe) =