diff --git a/Algebra/Vector.hs b/Algebra/Vector.hs index abcab5d..7bdc9c4 100644 --- a/Algebra/Vector.hs +++ b/Algebra/Vector.hs @@ -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 diff --git a/Algebra/VectorTypes.hs b/Algebra/VectorTypes.hs index d6934bc..0f64f4b 100644 --- a/Algebra/VectorTypes.hs +++ b/Algebra/VectorTypes.hs @@ -9,6 +9,7 @@ type Vec = R2 type PT = P2 type Coord = (Double, Double) type Segment = (PT, PT) +type Square = (Coord, Coord) data Alignment = CW diff --git a/Graphics/Diagram/Types.hs b/Graphics/Diagram/Types.hs index df02049..15aec10 100644 --- a/Graphics/Diagram/Types.hs +++ b/Graphics/Diagram/Types.hs @@ -138,4 +138,4 @@ maybeDiag b d filterValidPT :: DiagProp -> [PT] -> [PT] -filterValidPT p = filter (inRange (dX p) (dY p)) +filterValidPT p = filter (inRange (dX p, dY p))