Struct pdbtbx::TransformationMatrix
source · pub struct TransformationMatrix { /* private fields */ }
Expand description
A 3D affine transformation matrix
Implementations§
source§impl TransformationMatrix
impl TransformationMatrix
sourcepub fn matrix_mut(&mut self) -> &mut [[f64; 4]; 3]
pub fn matrix_mut(&mut self) -> &mut [[f64; 4]; 3]
Get the raw matrix (row major order)
sourcepub fn set_matrix(&mut self, new_matrix: [[f64; 4]; 3])
pub fn set_matrix(&mut self, new_matrix: [[f64; 4]; 3])
Set the raw matrix (row major order), the user needs to make sure the matrix is valid
sourcepub const fn from_matrix(matrix: [[f64; 4]; 3]) -> Self
pub const fn from_matrix(matrix: [[f64; 4]; 3]) -> Self
Create a matrix with the given matrix
sourcepub fn rotation_x(deg: f64) -> Self
pub fn rotation_x(deg: f64) -> Self
sourcepub fn rotation_y(deg: f64) -> Self
pub fn rotation_y(deg: f64) -> Self
sourcepub fn rotation_z(deg: f64) -> Self
pub fn rotation_z(deg: f64) -> Self
sourcepub fn translation(x: f64, y: f64, z: f64) -> Self
pub fn translation(x: f64, y: f64, z: f64) -> Self
Create a matrix defining a translation
Panics
It panics if any of the arguments is not finite (f64.is_finite()
)
sourcepub fn scale(x: f64, y: f64, z: f64) -> Self
pub fn scale(x: f64, y: f64, z: f64) -> Self
Create a matrix defining a magnification with three different factors
Arguments
x
the factor for the x dimension where 1.0 is the original sizey
the factor for the y dimension where 1.0 is the original sizez
the factor for the z dimension where 1.0 is the original size
Panics
It panics if any of the arguments is not finite (f64.is_finite()
)
sourcepub fn multiply_translation(&mut self, factors: (f64, f64, f64))
pub fn multiply_translation(&mut self, factors: (f64, f64, f64))
This multiplies the translation with the given factors, this can be used to convert fractional units into absolute units.
Trait Implementations§
source§impl Clone for TransformationMatrix
impl Clone for TransformationMatrix
source§fn clone(&self) -> TransformationMatrix
fn clone(&self) -> TransformationMatrix
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for TransformationMatrix
impl Debug for TransformationMatrix
source§impl<'de> Deserialize<'de> for TransformationMatrix
impl<'de> Deserialize<'de> for TransformationMatrix
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl PartialEq<TransformationMatrix> for TransformationMatrix
impl PartialEq<TransformationMatrix> for TransformationMatrix
source§fn eq(&self, other: &TransformationMatrix) -> bool
fn eq(&self, other: &TransformationMatrix) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for TransformationMatrix
impl Serialize for TransformationMatrix
impl StructuralPartialEq for TransformationMatrix
Auto Trait Implementations§
impl RefUnwindSafe for TransformationMatrix
impl Send for TransformationMatrix
impl Sync for TransformationMatrix
impl Unpin for TransformationMatrix
impl UnwindSafe for TransformationMatrix
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
Mutably borrows from an owned value. Read more