Change the name of methods on the Transform trait to avoid clashes
Transform::invert becomes Transform::inverse_transform, and Transform::invert_self becomes Transform::to_inverse. Tests passing for me now
This commit is contained in:
parent
0a78173e2b
commit
074cb2c36f
3 changed files with 9 additions and 9 deletions
|
@ -778,7 +778,7 @@ impl<S: BaseFloat> Transform<Point2<S>> for Matrix3<S> {
|
|||
self * other
|
||||
}
|
||||
|
||||
fn invert(&self) -> Option<Matrix3<S>> {
|
||||
fn inverse_transform(&self) -> Option<Matrix3<S>> {
|
||||
SquareMatrix::invert(self)
|
||||
}
|
||||
}
|
||||
|
@ -805,7 +805,7 @@ impl<S: BaseFloat> Transform<Point3<S>> for Matrix3<S> {
|
|||
self * other
|
||||
}
|
||||
|
||||
fn invert(&self) -> Option<Matrix3<S>> {
|
||||
fn inverse_transform(&self) -> Option<Matrix3<S>> {
|
||||
SquareMatrix::invert(self)
|
||||
}
|
||||
}
|
||||
|
@ -831,7 +831,7 @@ impl<S: BaseFloat> Transform<Point3<S>> for Matrix4<S> {
|
|||
self * other
|
||||
}
|
||||
|
||||
fn invert(&self) -> Option<Matrix4<S>> {
|
||||
fn inverse_transform(&self) -> Option<Matrix4<S>> {
|
||||
SquareMatrix::invert(self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ pub trait Transform<P: EuclideanSpace>: Sized {
|
|||
fn concat(&self, other: &Self) -> Self;
|
||||
|
||||
/// Create a transform that "un-does" this one.
|
||||
fn invert(&self) -> Option<Self>;
|
||||
fn inverse_transform(&self) -> Option<Self>;
|
||||
|
||||
/// Combine this transform with another, in-place.
|
||||
#[inline]
|
||||
|
@ -64,8 +64,8 @@ pub trait Transform<P: EuclideanSpace>: Sized {
|
|||
/// Invert this transform in-place, failing if the transformation is not
|
||||
/// invertible.
|
||||
#[inline]
|
||||
fn invert_self(&mut self) {
|
||||
*self = self.invert().unwrap()
|
||||
fn to_inverse(&mut self) {
|
||||
*self = self.inverse_transform().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ impl<P: EuclideanSpace, R: Rotation<P>> Transform<P> for Decomposed<P::Diff, R>
|
|||
}
|
||||
}
|
||||
|
||||
fn invert(&self) -> Option<Decomposed<P::Diff, R>> {
|
||||
fn inverse_transform(&self) -> Option<Decomposed<P::Diff, R>> {
|
||||
if self.scale.approx_eq(&P::Scalar::zero()) {
|
||||
None
|
||||
} else {
|
||||
|
@ -196,7 +196,7 @@ impl<S: BaseFloat> Transform<Point3<S>> for AffineMatrix3<S> {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn invert(&self) -> Option<AffineMatrix3<S>> {
|
||||
fn inverse_transform(&self) -> Option<AffineMatrix3<S>> {
|
||||
SquareMatrix::invert(& self.mat).map(|m| AffineMatrix3{ mat: m })
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ fn test_invert() {
|
|||
rot: Quaternion::new(0.5f64,0.5,0.5,0.5),
|
||||
disp: Vector3::new(6.0f64,-7.0,8.0)
|
||||
};
|
||||
let ti = t.invert().expect("Expected successful inversion");
|
||||
let ti = t.inverse_transform().expect("Expected successful inversion");
|
||||
let vt = t.transform_vector(v);
|
||||
assert!(v.approx_eq(&ti.transform_vector(vt)));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue