Struct mod3d_base::Transformation
source · 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 with_scale(self, scale: Vec3) -> Self
pub fn with_scale(self, scale: Vec3) -> Self
Set the scaling of a transformation
sourcepub fn with_translation(self, translation: Vec3) -> Self
pub fn with_translation(self, translation: Vec3) -> Self
Set the translation of a transformation
sourcepub fn with_rotation(self, rotation: Quat) -> Self
pub fn with_rotation(self, rotation: Quat) -> Self
Set the rotation of a transformation
sourcepub fn translation(&mut self) -> Vec3
pub fn translation(&mut self) -> Vec3
Set the translation of a transformation
sourcepub fn set_translation(&mut self, translation: Vec3)
pub fn set_translation(&mut self, translation: Vec3)
Set the translation of a transformation
sourcepub fn set_rotation(&mut self, rotation: Quat)
pub fn set_rotation(&mut self, rotation: Quat)
Set the rotation of a transformation
sourcepub fn combine(&mut self, base: &Self, other: &Self)
pub fn combine(&mut self, base: &Self, other: &Self)
Combine two transformations into this
To operate correctly the scales must be
sourcepub fn translate(&mut self, translation: &Vec3, scale: f32)
pub fn translate(&mut self, translation: &Vec3, scale: f32)
Pre-apply a translation to the transformation
sourcepub fn rotate_axis_angle(&mut self, axis: &Vec3, angle: f32)
pub fn rotate_axis_angle(&mut self, axis: &Vec3, angle: f32)
Rotate the transformation by an angle about an axis
sourcepub fn rotate_by(&mut self, quaternion: &Quat)
pub fn rotate_by(&mut self, quaternion: &Quat)
Rotate the transformation by an angle about an axis
sourcepub fn mat4_inverse(&self) -> Mat4
pub fn mat4_inverse(&self) -> Mat4
Create a mat4 from the inverse of this Transformation
sourcepub fn from_mat4(&mut self, m: Mat4)
pub fn from_mat4(&mut self, m: Mat4)
Set this translation from a Mat4 (assuming it can be done)
sourcepub fn mat4_after(&self, pre_mat: &Mat4) -> Mat4
pub fn mat4_after(&self, pre_mat: &Mat4) -> Mat4
Calculate a Mat4 of this transformation premultiplied by another Mat4
sourcepub fn interpolate(&mut self, t: f32, in0: &Self, in1: &Self)
pub fn interpolate(&mut self, t: f32, in0: &Self, in1: &Self)
Set this transformation to be an interpolation between two others
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 moresource§impl Debug for Transformation
impl Debug for Transformation
source§impl Default for Transformation
impl Default for Transformation
source§impl Display for Transformation
impl Display for Transformation
impl Copy for Transformation
Auto Trait Implementations§
impl Freeze for Transformation
impl RefUnwindSafe for Transformation
impl Send for Transformation
impl Sync for Transformation
impl Unpin for Transformation
impl UnwindSafe for Transformation
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)