Redo zone size/update
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
module Dodge.Zone.Size where
|
||||
|
||||
pnZoneSize :: Float
|
||||
pnZoneSize = 100
|
||||
|
||||
wlZoneSize :: Float
|
||||
wlZoneSize = 50
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
module Dodge.Zone.Update where
|
||||
module Dodge.Zone.Update
|
||||
( updateZoning
|
||||
) where
|
||||
import Dodge.Data.Zoning
|
||||
import StreamingHelp
|
||||
import qualified Streaming.Prelude as S
|
||||
@@ -7,20 +9,11 @@ import Geometry
|
||||
import LensHelp
|
||||
|
||||
updateZoning :: Monoid (t a) => (a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
||||
{-# INLINE updateZoning #-}
|
||||
updateZoning f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize zn) obj))
|
||||
where
|
||||
doinsert znobs vxy = insertInZoneWith vxy (\_ -> f obj) (f obj mempty) znobs
|
||||
|
||||
--alterInZone :: (a -> Maybe (t a) -> Maybe (t a)) -> a -> Zoning
|
||||
|
||||
updateInZoning' :: Applicative t => (t a -> t a -> t a) -> a -> Zoning t a -> Zoning t a
|
||||
updateInZoning' f obj zn = runIdentity (S.fold_ doinsert zn id (_znFunc zn (_znSize zn) obj))
|
||||
where
|
||||
doinsert znobs vxy = insertInZoneWith vxy f (pure obj) znobs
|
||||
|
||||
imInsert :: (a -> Int) -> a -> IM.IntMap a -> IM.IntMap a
|
||||
imInsert getID x = IM.insert (getID x) x
|
||||
|
||||
insertInZoneWith
|
||||
:: Int2
|
||||
-> (t a -> t a -> t a) -- ^ Combining function
|
||||
|
||||
Reference in New Issue
Block a user