Simplify length2 method
This commit is contained in:
parent
342817610d
commit
b860a63cbc
1 changed files with 3 additions and 9 deletions
|
@ -177,8 +177,7 @@ pub impl<T:Copy Num> Vec2<T>: NumericVector<T> {
|
||||||
pub impl<T:Copy Num NumCast Exp> Vec2<T>: GeometricVector<T> {
|
pub impl<T:Copy Num NumCast Exp> Vec2<T>: GeometricVector<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn length2() -> T {
|
pure fn length2() -> T {
|
||||||
self[0] * self[0] +
|
self.dot(&self)
|
||||||
self[1] * self[1]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -368,9 +367,7 @@ pub impl<T:Copy Num> Vec3<T>: NumericVector<T> {
|
||||||
pub impl<T:Copy Num NumCast Exp> Vec3<T>: GeometricVector<T> {
|
pub impl<T:Copy Num NumCast Exp> Vec3<T>: GeometricVector<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn length2() -> T {
|
pure fn length2() -> T {
|
||||||
self[0] * self[0] +
|
self.dot(&self)
|
||||||
self[1] * self[1] +
|
|
||||||
self[2] * self[2]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -565,10 +562,7 @@ pub impl<T:Copy Num> Vec4<T>: NumericVector<T> {
|
||||||
pub impl<T:Copy Num NumCast Exp> Vec4<T>: GeometricVector<T> {
|
pub impl<T:Copy Num NumCast Exp> Vec4<T>: GeometricVector<T> {
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pure fn length2() -> T {
|
pure fn length2() -> T {
|
||||||
self[0] * self[0] +
|
self.dot(&self)
|
||||||
self[1] * self[1] +
|
|
||||||
self[2] * self[2] +
|
|
||||||
self[3] * self[3]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|
Loading…
Reference in a new issue