summaryrefslogtreecommitdiffstats
path: root/src/Vector.hs
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2011-06-26 23:41:53 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2011-06-26 23:41:53 +0200
commitcfa9cf94568fbe1564e5b4e386a8170910bc552e (patch)
tree4775bfc3d4436431af43fc9fd45792f5cbf1f0b6 /src/Vector.hs
parentae4a69415050b61f4488255dad0b1c3d045e6de5 (diff)
downloadhtanks-master.tar
htanks-master.zip
Refactored to/fromVector functionsHEADmaster
Diffstat (limited to 'src/Vector.hs')
-rw-r--r--src/Vector.hs8
1 files changed, 4 insertions, 4 deletions
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