Trait cgmath::Rotation
[−]
[src]
pub trait Rotation<S: BaseFloat, V: Vector<S>, P: Point<S, V>>: PartialEq + ApproxEq<S> + Sized { fn identity() -> Self; fn look_at(dir: &V, up: &V) -> Self; fn between_vectors(a: &V, b: &V) -> Self; fn rotate_vector(&self, vec: &V) -> V; fn concat(&self, other: &Self) -> Self; fn invert(&self) -> Self; fn rotate_point(&self, point: &P) -> P { ... } fn rotate_ray(&self, ray: &Ray<S, P, V>) -> Ray<S, P, V> { ... } fn concat_self(&mut self, other: &Self) { ... } fn invert_self(&mut self) { ... } }
A trait for a generic rotation. A rotation is a transformation that creates a circular motion, and preserves at least one point in the space.
Required Methods
fn identity() -> Self
Create the identity transform (causes no transformation).
fn look_at(dir: &V, up: &V) -> Self
Create a rotation to a given direction with an 'up' vector
fn between_vectors(a: &V, b: &V) -> Self
Create a shortest rotation to transform vector 'a' into 'b'. Both given vectors are assumed to have unit length.
fn rotate_vector(&self, vec: &V) -> V
Rotate a vector using this rotation.
fn concat(&self, other: &Self) -> Self
Create a new rotation which combines both this rotation, and another.
fn invert(&self) -> Self
Create a new rotation which "un-does" this rotation. That is,
r.concat(r.invert())
is the identity.
Provided Methods
fn rotate_point(&self, point: &P) -> P
Rotate a point using this rotation, by converting it to its representation as a vector.
fn rotate_ray(&self, ray: &Ray<S, P, V>) -> Ray<S, P, V>
Rotate a ray using this rotation.
fn concat_self(&mut self, other: &Self)
Modify this rotation in-place by combining it with another.
fn invert_self(&mut self)
Invert this rotation in-place.