Add delta-transformation.

This commit is contained in:
Sébastien Crozet 2013-05-19 19:45:04 +00:00
parent ec160e5219
commit f3ed302874
4 changed files with 26 additions and 0 deletions

View File

@ -0,0 +1,10 @@
/// A delta-transformation is the generalization of rotation. A delta transform
/// can apply any transformation to the object without translating it.
/// In partilular, 0 is neutral wrt. the delta-transform.
pub trait DeltaTransform<DT>
{
/// Extracts the delta transformation associated with this transformation.
fn delta_transform(&self) -> DT;
// FIXME: add functions to apply the delta-transform to a vector without
// explicit computation of the transform (does this avoid some matrix copy?)
}

View File

@ -0,0 +1,4 @@
use traits::ring::Ring;
pub trait DivisionRing : Ring + Quot<Self, Self>
{ }

5
src/traits/ring.rs Normal file
View File

@ -0,0 +1,5 @@
use core::num::{One, Zero};
pub trait Ring :
Sub<Self, Self> + Add<Self, Self> + Neg<Self> + Mul<Self, Self> + One + Zero
{ }

View File

@ -0,0 +1,7 @@
use core::num::Zero;
use traits::division_ring::DivisionRing;
use traits::workarounds::scalar_op::{ScalarMul, ScalarDiv};
pub trait VectorSpace<T: DivisionRing> : Sub<Self, Self> + Add<Self, Self> +
Neg<Self> + Zero + ScalarMul<T> + ScalarDiv<T>
{ }