use std::fmt::Display; use std::ops::Mul; use alga::general::{Id, Real}; use alga::linear::Isometry as AlgaIsometry; use na::{self, DefaultAllocator, Matrix2, Matrix3, MatrixN, Rotation, Translation, UnitComplex, UnitQuaternion}; use na::dimension::DimName; use na::storage::Owned; use na::allocator::Allocator; use Point; /// Trait implemented by isometry types usable by ncollide. pub trait Isometry: Send + Sync + 'static + Display + AlgaIsometry

{ /// Computes the product `abs(rot) * v` where `abs(self)` is the absolute value of the matrix /// representation of `self.rotation()`. fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector; } impl Isometry

for Id { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { *v } } impl Isometry

for Translation where N: Real, D: Send + Sync + 'static + DimName, Owned: Copy + Sync + Send + 'static, DefaultAllocator: Allocator + Allocator, Translation: AlgaIsometry

, { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { *v } } impl Isometry

for Rotation where N: Real, D: Send + Sync + 'static + DimName, Owned: Copy + Sync + Send + 'static, DefaultAllocator: Allocator + Allocator, Rotation: AlgaIsometry

, MatrixN: Mul, { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { self.matrix().abs() * *v } } impl Isometry

for UnitQuaternion where N: Real, UnitQuaternion: AlgaIsometry

, Matrix3: Mul, { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { self.to_rotation_matrix().unwrap().abs() * *v } } impl Isometry

for UnitComplex where N: Real, UnitComplex: AlgaIsometry

, Matrix2: Mul, { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { let r = self.complex().re.abs(); let i = self.complex().im.abs(); Matrix2::new(r, i, i, r) * *v } } impl Isometry

for na::Isometry where N: Real, D: Send + Sync + 'static + DimName, Owned: Copy + Sync + Send + 'static, DefaultAllocator: Allocator + Allocator + Allocator, na::Isometry: AlgaIsometry

, R: Isometry

, { #[inline] fn absolute_rotate_vector(&self, v: &P::Vector) -> P::Vector { self.rotation.absolute_rotate_vector(v) } }