Move towards unifying zoning

This commit is contained in:
2022-10-28 13:14:53 +01:00
parent 7e790b7153
commit d3233c7daa
6 changed files with 36 additions and 11 deletions
+19
View File
@@ -0,0 +1,19 @@
module Dodge.Zoning.Common where
import Dodge.Data.World
import Control.Lens
import Dodge.Zoning.Base
import Geometry
import qualified IntMapHelp as IM
nearPoint :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2 -> World -> m
{-# INLINE nearPoint #-}
nearPoint size f p w = zoneExtract (zoneOfPoint size p) (f $ w ^. cWorld . lWorld)
nearSeg :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
{-# INLINE nearSeg #-}
nearSeg size f sp ep w = zonesExtract (f $ w ^. cWorld . lWorld) (zoneOfSeg size sp ep)
nearRect :: Monoid m => Float -> (LWorld -> IM.IntMap (IM.IntMap m)) -> Point2 -> Point2 -> World -> m
{-# INLINE nearRect #-}
nearRect size f sp ep w = zonesExtract (f $ w ^. cWorld . lWorld) (zoneOfSeg size sp ep)