From c87741300d06717abaf6ddf4403dacecb09333d3 Mon Sep 17 00:00:00 2001
From: faiface <faiface@ksp.sk>
Date: Sun, 15 Oct 2017 19:43:12 +0200
Subject: [PATCH] add pixel.Unit

---
 geometry.go | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/geometry.go b/geometry.go
index 1d538d3..00419ad 100644
--- a/geometry.go
+++ b/geometry.go
@@ -49,6 +49,11 @@ func V(x, y float64) Vec {
 	return Vec{x, y}
 }
 
+// Unit returns a vector of length 1 facing the given angle.
+func Unit(angle float64) Vec {
+	return Vec{1, 0}.Rotated(angle)
+}
+
 // String returns the string representation of the vector u.
 //
 //   u := pixel.V(4.5, -1.3)
-- 
GitLab