Finalize and allow drawing

This commit is contained in:
2014-10-01 00:05:29 +02:00
parent 9ede6aecc0
commit 7cd62975af
5 changed files with 84 additions and 9 deletions

19
Util.hs Normal file
View File

@@ -0,0 +1,19 @@
module Util where
-- |Checks whether the Coordinates are in a given range.
inRange :: (Double, Double) -- ^ Coordinates to check
-> Double -- ^ min
-> Double -- ^ max
-> Bool -- ^ result
inRange (x, y) min' max'
| 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')