Rm useless filterValidCoords, refactor inRange
This commit is contained in:
12
Util.hs
12
Util.hs
@@ -2,18 +2,12 @@ module Util where
|
||||
|
||||
|
||||
-- |Checks whether the Coordinates are in a given range.
|
||||
inRange :: (Double, Double) -- ^ Coordinates to check
|
||||
-> Double -- ^ min
|
||||
inRange :: Double -- ^ min
|
||||
-> Double -- ^ max
|
||||
-> (Double, Double) -- ^ Coordinates to check
|
||||
-> Bool -- ^ result
|
||||
inRange (x, y) min' max'
|
||||
inRange min' max' (x, y)
|
||||
| x <= max' && x >= min' && y <= max' && y >= min' = True
|
||||
| otherwise = False
|
||||
|
||||
|
||||
-- |Filter the valid coordinates.
|
||||
filterValidCoords :: Double -- ^ min
|
||||
-> Double -- ^ max
|
||||
-> [(Double, Double)] -- ^ unfiltered
|
||||
-> [(Double, Double)] -- ^ filtered
|
||||
filterValidCoords min' max' = filter (\(x, y) -> inRange (x, y) min' max')
|
||||
|
||||
Reference in New Issue
Block a user