Refactor path zoning
This commit is contained in:
@@ -65,6 +65,11 @@ zoneMonoid (V2 x y) a = IM.insertWith f x $ IM.singleton y a
|
||||
deZoneIX :: Int -> IM.IntMap (IM.IntMap IS.IntSet) -> Int2 -> IM.IntMap (IM.IntMap IS.IntSet)
|
||||
deZoneIX i im (V2 x y) = im & ix x . ix y %~ IS.delete i
|
||||
|
||||
zoneOfPoint'' :: Float -> Point2 -> V2 Int
|
||||
zoneOfPoint'' :: Float -> Point2 -> Int2
|
||||
{-# INLINE zoneOfPoint'' #-}
|
||||
zoneOfPoint'' s = fmap (divTo s)
|
||||
|
||||
zonesAroundPoint :: Float -> Point2 -> [Int2]
|
||||
zonesAroundPoint s p = [V2 a b | a <- [x-1..x+1] , b <- [y-1..y+1] ]
|
||||
where
|
||||
V2 x y = zoneOfPoint' s p
|
||||
|
||||
Reference in New Issue
Block a user