Add Rotation trait
This will eventually be implemented on Mat3 and Quat
This commit is contained in:
parent
16e06c3855
commit
6485ff070e
3 changed files with 29 additions and 0 deletions
|
@ -14,6 +14,7 @@ extern mod numeric;
|
|||
pub mod gltypes;
|
||||
pub mod mat;
|
||||
pub mod quat;
|
||||
pub mod rot;
|
||||
pub mod vec;
|
||||
|
||||
#[test]
|
||||
|
@ -21,6 +22,7 @@ mod test {
|
|||
mod test_gltypes;
|
||||
mod test_mat;
|
||||
mod test_quat;
|
||||
mod test_rot;
|
||||
mod test_vec;
|
||||
}
|
||||
|
||||
|
|
27
src/rot.rs
Normal file
27
src/rot.rs
Normal file
|
@ -0,0 +1,27 @@
|
|||
use numeric::types::angle::Angle;
|
||||
|
||||
use mat::Mat3;
|
||||
use quat::Quat;
|
||||
use vec::Vec3;
|
||||
|
||||
/**
|
||||
* A trait that includes some common rotation methods, constructors and conversions
|
||||
*/
|
||||
pub trait Rotation<T> {
|
||||
static pure fn from<R: Rotation<T>>(rot: R) -> self;
|
||||
|
||||
static pure fn from_angle_x<A:Angle<T>>(theta: A) -> self;
|
||||
static pure fn from_angle_y<A:Angle<T>>(theta: A) -> self;
|
||||
static pure fn from_angle_z<A:Angle<T>>(theta: A) -> self;
|
||||
static pure fn from_angle_xyz<A:Angle<T>>(x: A, y: A, z: A) -> self;
|
||||
static pure fn from_angle_axis<A:Angle<T>>(theta: A, axis: &Vec3<T>) -> self;
|
||||
static pure fn from_axes(x: Vec3<T>, y: Vec3<T>, z: Vec3<T>) -> self;
|
||||
static pure fn look_at(dir: &Vec3<T>, up: &Vec3<T>) -> self;
|
||||
|
||||
pure fn concat(&self, other: &self) -> self;
|
||||
pure fn rotate_vec(&self, vec: &Vec3<T>) -> Vec3<T>;
|
||||
|
||||
pure fn to_mat3(&self) -> Mat3<T>;
|
||||
pure fn to_quat(&self) -> Quat<T>;
|
||||
// pure fn to_euler(&self) -> Euler<T>;
|
||||
}
|
0
src/test/test_rot.rs
Normal file
0
src/test/test_rot.rs
Normal file
Loading…
Reference in a new issue