diff --git a/src/mat.rs b/src/mat.rs index 2ae08d8..5db0a8f 100644 --- a/src/mat.rs +++ b/src/mat.rs @@ -238,7 +238,7 @@ pub trait Matrix4: Matrix { /** * A mutable matrix */ -pub trait MutableMatrix<'self,T,V>: Matrix { +pub trait MutableMatrix: Matrix { /** * # Return value * diff --git a/src/mat2.rs b/src/mat2.rs index 84bbef7..9b91ec1 100644 --- a/src/mat2.rs +++ b/src/mat2.rs @@ -246,8 +246,8 @@ impl + Add + Sub + Mul + Div + N #[inline(always)] fn mul_self_t(&mut self, value: T) { - &mut self.x.mul_self_t(&value); - &mut self.y.mul_self_t(&value); + &mut self.x.mul_self_t(value); + &mut self.y.mul_self_t(value); } #[inline(always)] diff --git a/src/mat3.rs b/src/mat3.rs index b8dad31..e38df8d 100644 --- a/src/mat3.rs +++ b/src/mat3.rs @@ -516,9 +516,9 @@ impl + Add + Sub + Mul + Div + N #[inline(always)] fn mul_self_t(&mut self, value: T) { - self.col_mut(0).mul_self_t(&value); - self.col_mut(1).mul_self_t(&value); - self.col_mut(2).mul_self_t(&value); + self.col_mut(0).mul_self_t(value); + self.col_mut(1).mul_self_t(value); + self.col_mut(2).mul_self_t(value); } #[inline(always)] diff --git a/src/mat4.rs b/src/mat4.rs index 7d549f5..f5fb2aa 100644 --- a/src/mat4.rs +++ b/src/mat4.rs @@ -244,8 +244,8 @@ impl + Add + Sub + Mul + Div + N I.swap_cols(i1, j); // Scale col j to have a unit diagonal - I.col_mut(j).div_self_t(&A[j][j]); - A.col_mut(j).div_self_t(&A[j][j]); + I.col_mut(j).div_self_t(A[j][j]); + A.col_mut(j).div_self_t(A[j][j]); // Eliminate off-diagonal elems in col j of A, // doing identical ops to I @@ -442,10 +442,10 @@ impl + Add + Sub + Mul + Div + N #[inline(always)] fn mul_self_t(&mut self, value: T) { - self.col_mut(0).mul_self_t(&value); - self.col_mut(1).mul_self_t(&value); - self.col_mut(2).mul_self_t(&value); - self.col_mut(3).mul_self_t(&value); + self.col_mut(0).mul_self_t(value); + self.col_mut(1).mul_self_t(value); + self.col_mut(2).mul_self_t(value); + self.col_mut(3).mul_self_t(value); } #[inline(always)] diff --git a/src/vec.rs b/src/vec.rs index cbaef65..c4828c1 100644 --- a/src/vec.rs +++ b/src/vec.rs @@ -175,7 +175,7 @@ pub trait NumericVector4: NumericVector { /** * A mutable vector with numeric components */ -pub trait MutableNumericVector<'self, T>: MutableVector<&'self T> + +pub trait MutableNumericVector<'self, T>: MutableVector + NumericVector { /** * Negate the vector @@ -216,7 +216,7 @@ pub trait MutableNumericVector<'self, T>: MutableVector<&'self T> + /** * A mutable 3-dimensional vector with numeric components */ -pub trait MutableNumericVector3<'self, T>: MutableNumericVector<&'self T> { +pub trait MutableNumericVector3<'self, T>: MutableNumericVector { /** * Set to the cross product of the vector and `other` */ @@ -309,7 +309,7 @@ pub trait EuclideanVector: NumericVector { * * * `T` - The type of the components. This should be a floating point type. */ -pub trait MutableEuclideanVector<'self, T>: MutableNumericVector<&'self T> + +pub trait MutableEuclideanVector<'self, T>: MutableNumericVector + EuclideanVector { /** * Normalize the vector diff --git a/src/vec2.rs b/src/vec2.rs index 06f0925..276225d 100644 --- a/src/vec2.rs +++ b/src/vec2.rs @@ -174,7 +174,7 @@ impl + Sub + Mul + Div + Neg> Numer } } -impl + Sub + Mul + Div + Neg> MutableNumericVector<&'self T> for Vec2 { +impl + Sub + Mul + Div + Neg> MutableNumericVector for Vec2 { #[inline(always)] fn neg_self(&mut self) { *self.index_mut(0) = -*self.index_mut(0); @@ -182,15 +182,15 @@ impl + Sub + Mul + Div + Neg> Mutab } #[inline(always)] - fn mul_self_t(&mut self, value: &T) { - *self.index_mut(0) *= (*value); - *self.index_mut(1) *= (*value); + fn mul_self_t(&mut self, value: T) { + *self.index_mut(0) *= value; + *self.index_mut(1) *= value; } #[inline(always)] - fn div_self_t(&mut self, value: &T) { - *self.index_mut(0) /= (*value); - *self.index_mut(1) /= (*value); + fn div_self_t(&mut self, value: T) { + *self.index_mut(0) /= value; + *self.index_mut(1) /= value; } #[inline(always)] @@ -267,21 +267,21 @@ impl + Sub + Mul + Div + Neg> Euclid } } -impl + Sub + Mul + Div + Neg> MutableEuclideanVector<&'self T> for Vec2 { +impl + Sub + Mul + Div + Neg> MutableEuclideanVector for Vec2 { #[inline(always)] fn normalize_self(&mut self) { let n = one::() / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } #[inline(always)] - fn normalize_self_to(&mut self, length: &T) { + fn normalize_self_to(&mut self, length: T) { let n = length / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } - fn lerp_self(&mut self, other: &Vec2, amount: &T) { - self.add_self_v(&other.sub_v(&*self).mul_t(*amount)); + fn lerp_self(&mut self, other: &Vec2, amount: T) { + self.add_self_v(&other.sub_v(&*self).mul_t(amount)); } } diff --git a/src/vec3.rs b/src/vec3.rs index a35b1c2..7a821f0 100644 --- a/src/vec3.rs +++ b/src/vec3.rs @@ -192,7 +192,7 @@ impl + Sub + Mul + Div + Neg> Numer } } -impl + Sub + Mul + Div + Neg> MutableNumericVector<&'self T> for Vec3 { +impl + Sub + Mul + Div + Neg> MutableNumericVector for Vec3 { #[inline(always)] fn neg_self(&mut self) { *self.index_mut(0) = -*self.index_mut(0); @@ -201,17 +201,17 @@ impl + Sub + Mul + Div + Neg> Mutab } #[inline(always)] - fn mul_self_t(&mut self, value: &T) { - *self.index_mut(0) *= (*value); - *self.index_mut(1) *= (*value); - *self.index_mut(2) *= (*value); + fn mul_self_t(&mut self, value: T) { + *self.index_mut(0) *= value; + *self.index_mut(1) *= value; + *self.index_mut(2) *= value; } #[inline(always)] - fn div_self_t(&mut self, value: &T) { - *self.index_mut(0) /= (*value); - *self.index_mut(1) /= (*value); - *self.index_mut(2) /= (*value); + fn div_self_t(&mut self, value: T) { + *self.index_mut(0) /= value; + *self.index_mut(1) /= value; + *self.index_mut(2) /= value; } #[inline(always)] @@ -243,7 +243,7 @@ impl + Sub + Mul + Div + Neg> Mutab } } -impl + Sub + Mul + Div + Neg> MutableNumericVector3<&'self T> for Vec3 { +impl + Sub + Mul + Div + Neg> MutableNumericVector3 for Vec3 { #[inline(always)] fn cross_self(&mut self, other: &Vec3) { *self = self.cross(other); @@ -299,21 +299,21 @@ impl + Sub + Mul + Div + Neg> Euclid } } -impl + Sub + Mul + Div + Neg> MutableEuclideanVector<&'self T> for Vec3 { +impl + Sub + Mul + Div + Neg> MutableEuclideanVector for Vec3 { #[inline(always)] fn normalize_self(&mut self) { let n = one::() / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } #[inline(always)] - fn normalize_self_to(&mut self, length: &T) { + fn normalize_self_to(&mut self, length: T) { let n = length / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } - fn lerp_self(&mut self, other: &Vec3, amount: &T) { - self.add_self_v(&other.sub_v(&*self).mul_t(*amount)); + fn lerp_self(&mut self, other: &Vec3, amount: T) { + self.add_self_v(&other.sub_v(&*self).mul_t(amount)); } } diff --git a/src/vec4.rs b/src/vec4.rs index 7f2496a..f51cd25 100644 --- a/src/vec4.rs +++ b/src/vec4.rs @@ -197,7 +197,7 @@ impl NumericVector4 for Vec4 { } } -impl + Sub + Mul + Div + Neg> MutableNumericVector<&'self T> for Vec4 { +impl<'self,T:Copy + Number + Add + Sub + Mul + Div + Neg> MutableNumericVector for Vec4 { #[inline(always)] fn neg_self(&mut self) { *self.index_mut(0) = -*self.index_mut(0); @@ -207,19 +207,19 @@ impl + Sub + Mul + Div + Neg> Mutab } #[inline(always)] - fn mul_self_t(&mut self, value: &T) { - *self.index_mut(0) *= (*value); - *self.index_mut(1) *= (*value); - *self.index_mut(2) *= (*value); - *self.index_mut(3) *= (*value); + fn mul_self_t(&mut self, value: T) { + *self.index_mut(0) *= value; + *self.index_mut(1) *= value; + *self.index_mut(2) *= value; + *self.index_mut(3) *= value; } #[inline(always)] - fn div_self_t(&mut self, value: &T) { - *self.index_mut(0) /= (*value); - *self.index_mut(1) /= (*value); - *self.index_mut(2) /= (*value); - *self.index_mut(3) /= (*value); + fn div_self_t(&mut self, value: T) { + *self.index_mut(0) /= value; + *self.index_mut(1) /= value; + *self.index_mut(2) /= value; + *self.index_mut(3) /= value; } #[inline(always)] @@ -297,21 +297,21 @@ impl + Sub + Mul + Div + Neg> Euclid } } -impl + Sub + Mul + Div + Neg> MutableEuclideanVector<&'self T> for Vec4 { +impl + Sub + Mul + Div + Neg> MutableEuclideanVector for Vec4 { #[inline(always)] fn normalize_self(&mut self) { let n = one::() / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } #[inline(always)] - fn normalize_self_to(&mut self, length: &T) { + fn normalize_self_to(&mut self, length: T) { let n = length / self.length(); - self.mul_self_t(&n); + self.mul_self_t(n); } - fn lerp_self(&mut self, other: &Vec4, amount: &T) { - self.add_self_v(&other.sub_v(&*self).mul_t(*amount)); + fn lerp_self(&mut self, other: &Vec4, amount: T) { + self.add_self_v(&other.sub_v(&*self).mul_t(amount)); } }