diff --git a/src/angle.rs b/src/angle.rs index d8f8249..a1d2de8 100644 --- a/src/angle.rs +++ b/src/angle.rs @@ -180,11 +180,11 @@ Deg { } -impl Add, Rad> for Rad { #[inline] fn add(&self, other: &Rad) -> Rad { rad(self.s + other.s) } } -impl Add, Deg> for Deg { #[inline] fn add(&self, other: &Deg) -> Deg { deg(self.s + other.s) } } +impl Add, Rad> for Rad { #[inline] fn add(self, other: Rad) -> Rad { rad(self.s + other.s) } } +impl Add, Deg> for Deg { #[inline] fn add(self, other: Deg) -> Deg { deg(self.s + other.s) } } -impl Sub, Rad> for Rad { #[inline] fn sub(&self, other: &Rad) -> Rad { rad(self.s - other.s) } } -impl Sub, Deg> for Deg { #[inline] fn sub(&self, other: &Deg) -> Deg { deg(self.s - other.s) } } +impl Sub, Rad> for Rad { #[inline] fn sub(self, other: Rad) -> Rad { rad(self.s - other.s) } } +impl Sub, Deg> for Deg { #[inline] fn sub(self, other: Deg) -> Deg { deg(self.s - other.s) } } impl Neg> for Rad { #[inline] fn neg(&self) -> Rad { rad(-self.s) } } impl Neg> for Deg { #[inline] fn neg(&self) -> Deg { deg(-self.s) } } @@ -192,8 +192,8 @@ impl Neg> for Deg { #[inline] fn neg(&self) -> Deg { impl Zero for Rad { #[inline] fn zero() -> Rad { rad(zero()) } #[inline] fn is_zero(&self) -> bool { *self == zero() } } impl Zero for Deg { #[inline] fn zero() -> Deg { deg(zero()) } #[inline] fn is_zero(&self) -> bool { *self == zero() } } -impl Mul, Rad> for Rad { #[inline] fn mul(&self, other: &Rad) -> Rad { rad(self.s * other.s) } } -impl Mul, Deg> for Deg { #[inline] fn mul(&self, other: &Deg) -> Deg { deg(self.s * other.s) } } +impl Mul, Rad> for Rad { #[inline] fn mul(self, other: Rad) -> Rad { rad(self.s * other.s) } } +impl Mul, Deg> for Deg { #[inline] fn mul(self, other: Deg) -> Deg { deg(self.s * other.s) } } impl One for Rad { #[inline] fn one() -> Rad { rad(one()) } } impl One for Deg { #[inline] fn one() -> Deg { deg(one()) } } diff --git a/src/matrix.rs b/src/matrix.rs index fd73a54..77b5ecc 100644 --- a/src/matrix.rs +++ b/src/matrix.rs @@ -369,25 +369,25 @@ pub trait Matrix>: Array2 fn is_symmetric(&self) -> bool; } -impl Add, Matrix2> for Matrix2 { #[inline] fn add(&self, other: &Matrix2) -> Matrix2 { self.add_m(other) } } -impl Add, Matrix3> for Matrix3 { #[inline] fn add(&self, other: &Matrix3) -> Matrix3 { self.add_m(other) } } -impl Add, Matrix4> for Matrix4 { #[inline] fn add(&self, other: &Matrix4) -> Matrix4 { self.add_m(other) } } +impl Add, Matrix2> for Matrix2 { #[inline] fn add(self, other: Matrix2) -> Matrix2 { self.add_m(&other) } } +impl Add, Matrix3> for Matrix3 { #[inline] fn add(self, other: Matrix3) -> Matrix3 { self.add_m(&other) } } +impl Add, Matrix4> for Matrix4 { #[inline] fn add(self, other: Matrix4) -> Matrix4 { self.add_m(&other) } } -impl Sub, Matrix2> for Matrix2 { #[inline] fn sub(&self, other: &Matrix2) -> Matrix2 { self.sub_m(other) } } -impl Sub, Matrix3> for Matrix3 { #[inline] fn sub(&self, other: &Matrix3) -> Matrix3 { self.sub_m(other) } } -impl Sub, Matrix4> for Matrix4 { #[inline] fn sub(&self, other: &Matrix4) -> Matrix4 { self.sub_m(other) } } +impl Sub, Matrix2> for Matrix2 { #[inline] fn sub(self, other: Matrix2) -> Matrix2 { self.sub_m(&other) } } +impl Sub, Matrix3> for Matrix3 { #[inline] fn sub(self, other: Matrix3) -> Matrix3 { self.sub_m(&other) } } +impl Sub, Matrix4> for Matrix4 { #[inline] fn sub(self, other: Matrix4) -> Matrix4 { self.sub_m(&other) } } impl Neg> for Matrix2 { #[inline] fn neg(&self) -> Matrix2 { Matrix2::from_cols(self[0].neg(), self[1].neg()) } } impl Neg> for Matrix3 { #[inline] fn neg(&self) -> Matrix3 { Matrix3::from_cols(self[0].neg(), self[1].neg(), self[2].neg()) } } impl Neg> for Matrix4 { #[inline] fn neg(&self) -> Matrix4 { Matrix4::from_cols(self[0].neg(), self[1].neg(), self[2].neg(), self[3].neg()) } } -impl Zero for Matrix2 { #[inline] fn zero() -> Matrix2 { Matrix2::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } } -impl Zero for Matrix3 { #[inline] fn zero() -> Matrix3 { Matrix3::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } } -impl Zero for Matrix4 { #[inline] fn zero() -> Matrix4 { Matrix4::zero() } #[inline] fn is_zero(&self) -> bool { *self == zero() } } +impl Zero for Matrix2 { #[inline] fn zero() -> Matrix2 { Matrix2::zero() } #[inline] fn is_zero(&self) -> bool{ *self == zero() } } +impl Zero for Matrix3 { #[inline] fn zero() -> Matrix3 { Matrix3::zero() } #[inline] fn is_zero(&self) -> bool{ *self == zero() } } +impl Zero for Matrix4 { #[inline] fn zero() -> Matrix4 { Matrix4::zero() } #[inline] fn is_zero(&self) -> bool{ *self == zero() } } -impl Mul, Matrix2> for Matrix2 { #[inline] fn mul(&self, other: &Matrix2) -> Matrix2 { self.mul_m(other) } } -impl Mul, Matrix3> for Matrix3 { #[inline] fn mul(&self, other: &Matrix3) -> Matrix3 { self.mul_m(other) } } -impl Mul, Matrix4> for Matrix4 { #[inline] fn mul(&self, other: &Matrix4) -> Matrix4 { self.mul_m(other) } } +impl Mul, Matrix2> for Matrix2 { #[inline] fn mul(self, other: Matrix2) -> Matrix2 { self.mul_m(&other) } } +impl Mul, Matrix3> for Matrix3 { #[inline] fn mul(self, other: Matrix3) -> Matrix3 { self.mul_m(&other) } } +impl Mul, Matrix4> for Matrix4 { #[inline] fn mul(self, other: Matrix4) -> Matrix4 { self.mul_m(&other) } } impl One for Matrix2 { #[inline] fn one() -> Matrix2 { Matrix2::identity() } } impl One for Matrix3 { #[inline] fn one() -> Matrix3 { Matrix3::identity() } } diff --git a/src/vector.rs b/src/vector.rs index 5bdceee..3eaa0ff 100644 --- a/src/vector.rs +++ b/src/vector.rs @@ -298,18 +298,18 @@ macro_rules! vec( #[inline] fn div_self_v(&mut self, v: &$Self) { $(self.$field = self.$field / v.$field;)+ } #[inline] fn rem_self_v(&mut self, v: &$Self) { $(self.$field = self.$field % v.$field;)+ } - #[inline] fn comp_add(&self) -> S { fold!(&add, { $(self.$field),+ }) } - #[inline] fn comp_mul(&self) -> S { fold!(&mul, { $(self.$field),+ }) } + #[inline] fn comp_add(&self) -> S { fold!(add, { $(self.$field),+ }) } + #[inline] fn comp_mul(&self) -> S { fold!(mul, { $(self.$field),+ }) } #[inline] fn comp_min(&self) -> S { fold!(partial_min, { $(self.$field),+ }) } #[inline] fn comp_max(&self) -> S { fold!(partial_max, { $(self.$field),+ }) } } impl Add<$Self, $Self> for $Self { - #[inline] fn add(&self, v: &$Self) -> $Self { self.add_v(v) } + #[inline] fn add(self, v: $Self) -> $Self { self.add_v(&v) } } impl Sub<$Self, $Self> for $Self { - #[inline] fn sub(&self, v: &$Self) -> $Self { self.sub_v(v) } + #[inline] fn sub(self, v: $Self) -> $Self { self.sub_v(&v) } } impl Neg<$Self> for $Self { @@ -317,15 +317,15 @@ macro_rules! vec( } impl Mul<$Self, $Self> for $Self { - #[inline] fn mul(&self, v: &$Self) -> $Self { self.mul_v(v) } + #[inline] fn mul(self, v: $Self) -> $Self { self.mul_v(&v) } } impl Div<$Self, $Self> for $Self { - #[inline] fn div(&self, v: &$Self) -> $Self { self.div_v(v) } + #[inline] fn div(self, v: $Self) -> $Self { self.div_v(&v) } } impl Rem<$Self, $Self> for $Self { - #[inline] fn rem(&self, v: &$Self) -> $Self { self.rem_v(v) } + #[inline] fn rem(self, v: $Self) -> $Self { self.rem_v(&v) } } impl ApproxEq for $Self {