pub struct Transformation { /* private fields */ }
Expand description
A transformation corresponds to a translation of a rotation of a scaling
The rotation here is encoded by a Quaternion
Implementations§
Source§impl Transformation
impl Transformation
Sourcepub fn new() -> Transformation
pub fn new() -> Transformation
Create a new identity transformation
Sourcepub fn with_scale(self, scale: [f32; 3]) -> Transformation
pub fn with_scale(self, scale: [f32; 3]) -> Transformation
Set the scaling of a transformation
Sourcepub fn with_translation(self, translation: [f32; 3]) -> Transformation
pub fn with_translation(self, translation: [f32; 3]) -> Transformation
Set the translation of a transformation
Sourcepub fn with_rotation(self, rotation: [f32; 4]) -> Transformation
pub fn with_rotation(self, rotation: [f32; 4]) -> Transformation
Set the rotation of a transformation
Sourcepub fn translation(&mut self) -> [f32; 3]
pub fn translation(&mut self) -> [f32; 3]
Set the translation of a transformation
Sourcepub fn set_translation(&mut self, translation: [f32; 3])
pub fn set_translation(&mut self, translation: [f32; 3])
Set the translation of a transformation
Sourcepub fn set_rotation(&mut self, rotation: [f32; 4])
pub fn set_rotation(&mut self, rotation: [f32; 4])
Set the rotation of a transformation
Sourcepub fn copy_from(&mut self, other: &Transformation)
pub fn copy_from(&mut self, other: &Transformation)
Copy the transformation from another
Sourcepub fn combine(&mut self, base: &Transformation, other: &Transformation)
pub fn combine(&mut self, base: &Transformation, other: &Transformation)
Combine two transformations into this
To operate correctly the scales must be
Sourcepub fn translate(&mut self, translation: &[f32; 3], scale: f32)
pub fn translate(&mut self, translation: &[f32; 3], scale: f32)
Pre-apply a translation to the transformation
Sourcepub fn rotate_axis_angle(&mut self, axis: &[f32; 3], angle: f32)
pub fn rotate_axis_angle(&mut self, axis: &[f32; 3], angle: f32)
Rotate the transformation by an angle about an axis
Sourcepub fn rotate_by(&mut self, quaternion: &[f32; 4])
pub fn rotate_by(&mut self, quaternion: &[f32; 4])
Rotate the transformation by an angle about an axis
Sourcepub fn mat4_inverse(&self) -> [f32; 16]
pub fn mat4_inverse(&self) -> [f32; 16]
Create a mat4 from the inverse of this Transformation
Sourcepub fn from_mat4(&mut self, m: [f32; 16])
pub fn from_mat4(&mut self, m: [f32; 16])
Set this translation from a Mat4 (assuming it can be done)
Sourcepub fn mat4_after(&self, pre_mat: &[f32; 16]) -> [f32; 16]
pub fn mat4_after(&self, pre_mat: &[f32; 16]) -> [f32; 16]
Calculate a Mat4 of this transformation premultiplied by another Mat4
Sourcepub fn interpolate(
&mut self,
t: f32,
in0: &Transformation,
in1: &Transformation,
)
pub fn interpolate( &mut self, t: f32, in0: &Transformation, in1: &Transformation, )
Set this transformation to be an interpolation between two others
Sourcepub fn distance(&self, other: &Transformation) -> f32
pub fn distance(&self, other: &Transformation) -> f32
Calculate an approximate ‘distance’ between two transformations
Trait Implementations§
Source§impl Clone for Transformation
impl Clone for Transformation
Source§fn clone(&self) -> Transformation
fn clone(&self) -> Transformation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more