Add inline attributes
This commit is contained in:
parent
ca40caee81
commit
e274d884b9
1 changed files with 4 additions and 0 deletions
|
@ -132,10 +132,12 @@ pub struct Rotation<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub impl<T:Copy Num NumCast> Rotation<T> {
|
pub impl<T:Copy Num NumCast> Rotation<T> {
|
||||||
|
#[inline(always)]
|
||||||
static pure fn new(theta: Radians<T>, axis: Vec3<T>) -> Rotation<T> {
|
static pure fn new(theta: Radians<T>, axis: Vec3<T>) -> Rotation<T> {
|
||||||
Rotation { theta: move theta, axis: move axis }
|
Rotation { theta: move theta, axis: move axis }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pure fn to_mat3() -> Mat3<T> {
|
pure fn to_mat3() -> Mat3<T> {
|
||||||
let c: T = cos(&self.theta);
|
let c: T = cos(&self.theta);
|
||||||
let s: T = sin(&self.theta);
|
let s: T = sin(&self.theta);
|
||||||
|
@ -152,10 +154,12 @@ pub impl<T:Copy Num NumCast> Rotation<T> {
|
||||||
t * x * z - s - y, t * y * z - s * x, t * z * z + c)
|
t * x * z - s - y, t * y * z - s * x, t * z * z + c)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pure fn to_mat4() -> Mat4<T> {
|
pure fn to_mat4() -> Mat4<T> {
|
||||||
self.to_mat3().to_mat4()
|
self.to_mat3().to_mat4()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pure fn to_quat() -> Quat<T> {
|
pure fn to_quat() -> Quat<T> {
|
||||||
let half = self.theta / cast(2);
|
let half = self.theta / cast(2);
|
||||||
Quat::from_sv(cos(&half), self.axis.mul_t(sin(&half)))
|
Quat::from_sv(cos(&half), self.axis.mul_t(sin(&half)))
|
||||||
|
|
Loading…
Reference in a new issue