VEC: use the Square type for inRange
This commit is contained in:
parent
c765c63125
commit
b1280ac958
@ -11,11 +11,11 @@ import MyPrelude
|
|||||||
|
|
||||||
|
|
||||||
-- |Checks whether the Point is in a given dimension.
|
-- |Checks whether the Point is in a given dimension.
|
||||||
inRange :: Coord -- ^ X dimension
|
inRange :: Square -- ^ the square, defined by x/y dimensions
|
||||||
-> Coord -- ^ Y dimension
|
-> PT -- ^ Coordinate
|
||||||
-> PT -- ^ Coordinates
|
|
||||||
-> Bool -- ^ result
|
-> Bool -- ^ result
|
||||||
inRange (xlD, xuD) (ylD, yuD) p = x <= xuD && x >= xlD && y <= yuD && y >= ylD
|
inRange ((xlD, xuD), (ylD, yuD)) p =
|
||||||
|
x <= xuD && x >= xlD && y <= yuD && y >= ylD
|
||||||
where
|
where
|
||||||
(x, y) = unp2 p
|
(x, y) = unp2 p
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ type Vec = R2
|
|||||||
type PT = P2
|
type PT = P2
|
||||||
type Coord = (Double, Double)
|
type Coord = (Double, Double)
|
||||||
type Segment = (PT, PT)
|
type Segment = (PT, PT)
|
||||||
|
type Square = (Coord, Coord)
|
||||||
|
|
||||||
|
|
||||||
data Alignment = CW
|
data Alignment = CW
|
||||||
|
@ -138,4 +138,4 @@ maybeDiag b d
|
|||||||
|
|
||||||
|
|
||||||
filterValidPT :: DiagProp -> [PT] -> [PT]
|
filterValidPT :: DiagProp -> [PT] -> [PT]
|
||||||
filterValidPT p = filter (inRange (dX p) (dY p))
|
filterValidPT p = filter (inRange (dX p, dY p))
|
||||||
|
Loading…
Reference in New Issue
Block a user