module Geometry where import Graphics.HGL.Units smult :: Double-> Point-> Point smult f (x, y) | f == 1 = (x, y) | otherwise = (round (f* fromIntegral x), round (f* fromIntegral y)) add :: Point-> Point-> Point add (x1, y1) (x2, y2) = (x1+ x2, y1+ y2) len :: Point-> Double len (x, y)= sqrt (fromIntegral (x^2+ y^2)) polar :: Double-> Angle-> Point polar r phi = rot phi (round r, 0) rot :: Angle-> Point-> Point rot w (x, y) | w == 0 = (x, y) | otherwise = (round (x'* cos w+ y'* sin w), round (-x' * sin w + y'* cos w)) where x' = fromIntegral x; y'= fromIntegral y