aboutsummaryrefslogtreecommitdiff
path: root/src/Vec2.elm
diff options
context:
space:
mode:
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)