From b860a63cbcccad26446c2d09d3f73b4863f13db0 Mon Sep 17 00:00:00 2001 From: Brendan Zabarauskas Date: Wed, 14 Nov 2012 14:42:40 +1000 Subject: [PATCH] Simplify length2 method --- src/vector.rs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/vector.rs b/src/vector.rs index 85b4e31..2219a47 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -177,8 +177,7 @@ pub impl Vec2: NumericVector { pub impl Vec2: GeometricVector { #[inline(always)] pure fn length2() -> T { - self[0] * self[0] + - self[1] * self[1] + self.dot(&self) } #[inline(always)] @@ -368,9 +367,7 @@ pub impl Vec3: NumericVector { pub impl Vec3: GeometricVector { #[inline(always)] pure fn length2() -> T { - self[0] * self[0] + - self[1] * self[1] + - self[2] * self[2] + self.dot(&self) } #[inline(always)] @@ -565,10 +562,7 @@ pub impl Vec4: NumericVector { pub impl Vec4: GeometricVector { #[inline(always)] pure fn length2() -> T { - self[0] * self[0] + - self[1] * self[1] + - self[2] * self[2] + - self[3] * self[3] + self.dot(&self) } #[inline(always)]