Work on perhaps replacing FGL with incidence vectors

This commit is contained in:
2025-10-20 13:07:52 +01:00
parent b2fd0543dd
commit c250448d57
6 changed files with 1821 additions and 1798 deletions
+13
View File
@@ -1,5 +1,6 @@
module Dodge.Zoning.Pathing where
import qualified Data.Vector.Unboxed as UV
import Data.Foldable
import Data.Set (Set)
import qualified Data.Set as Set
@@ -8,6 +9,7 @@ import Dodge.Zoning.Base
import Dodge.Zoning.Common
import Geometry
import qualified IntMapHelp as IM
import Control.Lens
pnsNearPoint :: Point2 -> World -> [(Int, Point2)]
pnsNearPoint = nearPoint pnZoneSize _pnZoning
@@ -47,6 +49,9 @@ pesNearCirc p r = pesNearRect (p +.+ V2 r r) (p -.- V2 r r)
peZoneSize :: Float
peZoneSize = 50
zoneOfIncPe :: UV.Vector Point2 -> (Int,Int) -> [Int2]
zoneOfIncPe m (i,j) = zoneOfSeg peZoneSize (m ^?! ix i) (m ^?! ix j)
zoneOfPe :: PathEdgeNodes -> [Int2]
zoneOfPe (PathEdgeNodes _ _ pe) = zoneOfSeg peZoneSize (_peStart pe) (_peEnd pe)
@@ -57,3 +62,11 @@ zonePe ::
zonePe pe im = foldl' f im (zoneOfPe pe)
where
f im' i2 = zoneMonoid i2 (Set.singleton pe) im'
zoneIncPe :: UV.Vector Point2 ->
(Int,Int) ->
IM.IntMap (IM.IntMap [(Int,Int)]) ->
IM.IntMap (IM.IntMap [(Int,Int)])
zoneIncPe v pe im = foldl' f im (zoneOfIncPe v pe)
where
f im' i2 = zoneMonoid i2 [pe] im'