Merge pull request #176 from bfops/master

Add a phantom type annotation on Transform.
This commit is contained in:
tomaka 2015-02-21 07:42:09 +01:00
commit 63666e66c4

View file

@ -21,12 +21,13 @@ use num::{BaseNum, BaseFloat, zero, one};
use point::{Point, Point3}; use point::{Point, Point3};
use ray::Ray; use ray::Ray;
use rotation::{Rotation, Rotation3}; use rotation::{Rotation, Rotation3};
use std::marker::PhantomFn;
use vector::{Vector, Vector3}; use vector::{Vector, Vector3};
/// A trait representing an [affine /// A trait representing an [affine
/// transformation](https://en.wikipedia.org/wiki/Affine_transformation) that /// transformation](https://en.wikipedia.org/wiki/Affine_transformation) that
/// can be applied to points or vectors. An affine transformation is one which /// can be applied to points or vectors. An affine transformation is one which
pub trait Transform<S: BaseNum, V: Vector<S>, P: Point<S,V>>: Sized { pub trait Transform<S: BaseNum, V: Vector<S>, P: Point<S,V>>: Sized + PhantomFn<S> {
/// Create an identity transformation. That is, a transformation which /// Create an identity transformation. That is, a transformation which
/// does nothing. /// does nothing.
fn identity() -> Self; fn identity() -> Self;