aboutsummaryrefslogtreecommitdiff
path: root/src/Vec2.elm
diff options
context:
space:
mode:
authorJoris Guyonvarch2015-03-05 22:55:06 +0100
committerJoris Guyonvarch2015-03-05 22:55:11 +0100
commit716ce85464ee6d57a424a00d2535b3c2ce6ad9cb (patch)
tree01728db59af133a94855e536a25d6c5073bbfa38 /src/Vec2.elm
parent2fe50fd2ebb1815a330b20e599f756fa393de81b (diff)
Adding a wave move
Diffstat (limited to 'src/Vec2.elm')
-rw-r--r--src/Vec2.elm9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/Vec2.elm b/src/Vec2.elm
index 056c657..c980e1a 100644
--- a/src/Vec2.elm
+++ b/src/Vec2.elm
@@ -29,6 +29,15 @@ div v d =
, y = v.y / d
}
+norm : Vec2 -> Float
+norm v = sqrt(v.x ^ 2 + v.y ^ 2)
+
+clockwiseRotate90 : Vec2 -> Vec2
+clockwiseRotate90 v =
+ { x = -v.y
+ , y = v.x
+ }
+
isNull : Vec2 -> Bool
isNull v = (v.x == 0) && (v.y == 0)