diff --git a/src/geometry/scale.rs b/src/geometry/scale.rs index aa83c63c..5fe36602 100755 --- a/src/geometry/scale.rs +++ b/src/geometry/scale.rs @@ -11,12 +11,12 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; #[cfg(feature = "abomonation-serialize")] use abomonation::Abomonation; -use simba::scalar::{ClosedAdd, ClosedNeg, ClosedSub}; - use crate::base::allocator::Allocator; use crate::base::dimension::{DimNameAdd, DimNameSum, U1}; use crate::base::storage::Owned; use crate::base::{Const, DefaultAllocator, OMatrix, SVector, Scalar}; +use crate::ClosedDiv; +use crate::ClosedMul; use crate::geometry::Point; @@ -162,13 +162,6 @@ mod rkyv_impl { } impl Scale { - /// Creates a new Scale from the given vector. - #[inline] - #[deprecated(note = "Use `::from` instead.")] - pub fn from_vector(vector: SVector) -> Scale { - Scale { vector } - } - /// Inverts `self`. /// /// # Example @@ -187,9 +180,10 @@ impl Scale { #[must_use = "Did you mean to use inverse_mut()?"] pub fn inverse(&self) -> Scale where - T: ClosedNeg, + T: ClosedDiv + One, { - todo!(); + let useless: SVector = SVector::from_element(T::one()); + return useless.component_div(&self.vector).into(); } /// Converts this Scale into its equivalent homogeneous transformation matrix. @@ -242,13 +236,13 @@ impl Scale { #[inline] pub fn inverse_mut(&mut self) where - T: ClosedNeg, + T: ClosedDiv + One, { - todo!(); + self.vector = self.inverse().vector; } } -impl Scale { +impl Scale { /// Translate the given point. /// /// This is the same as the multiplication `self * pt`. @@ -262,11 +256,11 @@ impl Scale { #[inline] #[must_use] pub fn transform_point(&self, pt: &Point) -> Point { - todo!(); + return self * pt; } } -impl Scale { +impl Scale { /// Translate the given point by the inverse of this Scale. /// /// # Example @@ -278,7 +272,7 @@ impl Scale { #[inline] #[must_use] pub fn inverse_transform_point(&self, pt: &Point) -> Point { - todo!(); + return self.inverse() * pt; } }