19 lines
413 B
Haskell
19 lines
413 B
Haskell
module Dodge.Zoning.World
|
|
( zoneOfSight
|
|
) where
|
|
|
|
import Dodge.Data.Camera
|
|
import Geometry.Data
|
|
import Control.Lens
|
|
|
|
zoneOfSight :: Float -> Camera -> [Int2]
|
|
zoneOfSight s w =
|
|
[ V2 a b
|
|
| a <- [minimum xs .. maximum xs]
|
|
, b <- [minimum ys .. maximum ys]
|
|
]
|
|
where
|
|
(xs, ys) = unzip $ map sizeZoneOfPoint $ w ^. camBoundBox
|
|
sizeZoneOfPoint (V2 x y) = (f x, f y)
|
|
f = floor . (/ s)
|