diff --git a/src/geometry/scale_construction.rs b/src/geometry/scale_construction.rs index a3d9b151..1f2acf03 100644 --- a/src/geometry/scale_construction.rs +++ b/src/geometry/scale_construction.rs @@ -10,7 +10,7 @@ use rand::{ Rng, }; -use simba::scalar::{ClosedAdd, SupersetOf}; +use simba::scalar::{ClosedMul, SupersetOf}; use crate::base::{SVector, Scalar}; use crate::geometry::Scale; @@ -55,7 +55,7 @@ impl Scale { } } -impl One for Scale { +impl One for Scale { #[inline] fn one() -> Self { Self::identity() diff --git a/src/geometry/scale_ops.rs b/src/geometry/scale_ops.rs index 3bb04c83..80927557 100644 --- a/src/geometry/scale_ops.rs +++ b/src/geometry/scale_ops.rs @@ -1,6 +1,6 @@ -use std::ops::{Div, DivAssign, Mul, MulAssign}; +use std::ops::{Mul, MulAssign}; -use simba::scalar::{ClosedAdd, ClosedSub}; +use simba::scalar::{ClosedMul}; use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use crate::base::dimension::U1; @@ -9,36 +9,36 @@ use crate::base::{Const, Scalar}; use crate::geometry::{Point, Scale}; // Scale × Scale -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: &'a Scale, right: &'b Scale, Output = Scale; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Scale::from(self.vector.component_mul(&right.vector)) }; 'a, 'b); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: &'a Scale, right: Scale, Output = Scale; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Scale::from(self.vector.component_mul(&right.vector)) }; 'a); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: Scale, right: &'b Scale, Output = Scale; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Scale::from(self.vector.component_mul(&right.vector)) }; 'b); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: Scale, right: Scale, Output = Scale; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; ); + #[allow(clippy::suspicious_arithmetic_impl)] { Scale::from(self.vector.component_mul(&right.vector)) }; ); // Scale ÷ Scale // TODO: instead of calling inverse explicitly, could we just add a `mul_tr` or `mul_inv` method? -add_sub_impl!(Div, div, ClosedSub; +/*add_sub_impl!(Div, div, ClosedSub; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: &'a Scale, right: &'b Scale, Output = Scale; @@ -63,51 +63,51 @@ add_sub_impl!(Div, div, ClosedSub; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: Scale, right: Scale, Output = Scale; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; ); + #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; );*/ // Scale × Point // TODO: we don't handle properly non-zero origins here. Do we want this to be the intended // behavior? -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: &'a Scale, right: &'b Point, Output = Point; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Point::from(self.vector.component_mul(&right.coords)) }; 'a, 'b); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: &'a Scale, right: Point, Output = Point; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Point::from(self.vector.component_mul(&right.coords)) }; 'a); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: Scale, right: &'b Point, Output = Point; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; + #[allow(clippy::suspicious_arithmetic_impl)] { Point::from(self.vector.component_mul(&right.coords)) }; 'b); -add_sub_impl!(Mul, mul, ClosedAdd; +add_sub_impl!(Mul, mul, ClosedMul; (Const, U1), (Const, U1) -> (Const, U1) const D; for; where; self: Scale, right: Point, Output = Point; - #[allow(clippy::suspicious_arithmetic_impl)] { todo!(); }; ); + #[allow(clippy::suspicious_arithmetic_impl)] { Point::from(self.vector.component_mul(&right.coords)) }; ); // Scale *= Scale -add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd; +add_sub_assign_impl!(MulAssign, mul_assign, ClosedMul; const D; self: Scale, right: &'b Scale; - #[allow(clippy::suspicious_op_assign_impl)] { todo!(); }; + #[allow(clippy::suspicious_op_assign_impl)] { self.vector.component_mul_assign(&right.vector); }; 'b); -add_sub_assign_impl!(MulAssign, mul_assign, ClosedAdd; +add_sub_assign_impl!(MulAssign, mul_assign, ClosedMul; const D; self: Scale, right: Scale; - #[allow(clippy::suspicious_op_assign_impl)] { todo!(); }; ); + #[allow(clippy::suspicious_op_assign_impl)] { self.vector.component_mul_assign(&right.vector); }; ); -add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; +/*add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; const D; self: Scale, right: &'b Scale; #[allow(clippy::suspicious_op_assign_impl)] { todo!(); }; @@ -116,4 +116,4 @@ add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; add_sub_assign_impl!(DivAssign, div_assign, ClosedSub; const D; self: Scale, right: Scale; - #[allow(clippy::suspicious_op_assign_impl)] { todo!(); }; ); + #[allow(clippy::suspicious_op_assign_impl)] { todo!(); }; );*/