include/vector.h
branchpyrit
changeset 83 e3a2a5b26abb
parent 78 9569e9f35374
child 84 6f7fe14782c2
--- a/include/vector.h	Thu Apr 24 13:55:11 2008 +0200
+++ b/include/vector.h	Thu Apr 24 18:12:32 2008 +0200
@@ -71,10 +71,10 @@
 	};
 
 	// get normalized copy
-	Vector3 unit() const
+	friend Vector3 normalize(Vector3 &v)
 	{
-		Vector3 u(*this);
-		return u.normalize();
+		const Float f = 1.0f / v.mag();
+		return v * f;
 	};
 
 	// square magnitude, magnitude