VEC: use the Square type for inRange

This commit is contained in:
2014-11-13 23:04:26 +01:00
parent c765c63125
commit b1280ac958
3 changed files with 7 additions and 6 deletions

View File

@@ -11,11 +11,11 @@ import MyPrelude
-- |Checks whether the Point is in a given dimension.
inRange :: Coord -- ^ X dimension
-> Coord -- ^ Y dimension
-> PT -- ^ Coordinates
-> Bool -- ^ result
inRange (xlD, xuD) (ylD, yuD) p = x <= xuD && x >= xlD && y <= yuD && y >= ylD
inRange :: Square -- ^ the square, defined by x/y dimensions
-> PT -- ^ Coordinate
-> Bool -- ^ result
inRange ((xlD, xuD), (ylD, yuD)) p =
x <= xuD && x >= xlD && y <= yuD && y >= ylD
where
(x, y) = unp2 p