Adds ApproxEq for Decomposed

This commit is contained in:
Romain Vaillant 2016-05-16 15:22:37 +02:00
parent bfbbbe8445
commit 118ec262fd

View file

@ -149,6 +149,18 @@ impl<S: BaseFloat, R: Rotation2<S>> Transform2<S> for Decomposed<Vector2<S>, R>
impl<S: BaseFloat, R: Rotation3<S>> Transform3<S> for Decomposed<Vector3<S>, R> {}
impl<S: VectorSpace, R, E: BaseFloat> ApproxEq for Decomposed<S, R>
where S: ApproxEq<Epsilon = E>, S::Scalar: ApproxEq<Epsilon = E>, R: ApproxEq<Epsilon = E>
{
type Epsilon = E;
fn approx_eq_eps(&self, other: &Self, epsilon: &Self::Epsilon) -> bool {
self.scale.approx_eq_eps(&other.scale, epsilon) &&
self.rot.approx_eq_eps(&other.rot, epsilon) &&
self.disp.approx_eq_eps(&other.disp, epsilon)
}
}
#[cfg(feature = "eders")]
#[doc(hidden)]
mod eders_ser {
@ -294,4 +306,4 @@ mod eders_de {
Ok(Decomposed { scale: scale, rot: rot, disp: disp })
}
}
}
}