From cfa9cf94568fbe1564e5b4e386a8170910bc552e Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 26 Jun 2011 23:41:53 +0200 Subject: Refactored to/fromVector functions --- src/Vector.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/Vector.hs') diff --git a/src/Vector.hs b/src/Vector.hs index 174afd3..749693e 100644 --- a/src/Vector.hs +++ b/src/Vector.hs @@ -81,11 +81,11 @@ toAngle (Rotation c s) = atan2 s c fromAngle :: Coord -> Rotation fromAngle a = Rotation (cos a) (sin a) -toVector :: Rotation -> Vector -toVector (Rotation c s) = Vector c s +toVector :: Coord -> Rotation -> Vector +toVector l (Rotation c s) = l *^ Vector c s -fromVector :: Vector -> Rotation -fromVector v = Rotation x y +fromVector :: Vector -> (Rotation, Coord) +fromVector v = (Rotation x y, magnitude v) where Vector x y = normalized v -- cgit v1.2.3