Make zoning more universal
This commit is contained in:
+10
-1
@@ -11,10 +11,13 @@ module Geometry.Zone
|
||||
, yIntercepts
|
||||
, divTo
|
||||
, zoneOfPoint
|
||||
, zoneOfSeg
|
||||
, zoneInsideCirc
|
||||
) where
|
||||
import Geometry.Data
|
||||
import Geometry.Vector
|
||||
|
||||
import Streaming
|
||||
import StreamingHelp
|
||||
import qualified Streaming.Prelude as S
|
||||
import Data.Foldable
|
||||
import qualified Data.IntMap.Strict as IM
|
||||
@@ -157,6 +160,12 @@ makeInterval x y
|
||||
| x < y = [x-1..y+1]
|
||||
| otherwise = [y-1..x+1]
|
||||
|
||||
zoneInsideCirc :: Float -> Point2 -> Float -> StreamOf Int2
|
||||
zoneInsideCirc x p r = ddaSqStream x (p +.+ V2 r r) (p -.- V2 r r)
|
||||
|
||||
zoneOfSeg :: Float -> Point2 -> Point2 -> StreamOf Int2
|
||||
zoneOfSeg = ddaStream
|
||||
|
||||
ddaStream :: Float -> Point2 -> Point2 -> Stream (Of (V2 Int)) Identity ()
|
||||
ddaStream s sp ep = S.map (zoneOfPoint s)
|
||||
$ S.yield sp
|
||||
|
||||
Reference in New Issue
Block a user