pub struct Transform4x4 { /* private fields */ }Expand description
4x4 transformation matrix.
Represents a full 3D affine transformation including rotation, scale, translation, and perspective. The matrix is stored in column-major order.
§Matrix Layout
[ m00 m01 m02 m03 ]
[ m10 m11 m12 m13 ]
[ m20 m21 m22 m23 ]
[ m30 m31 m32 m33 ]§Note
This struct does not have automatic getters for matrix elements. Use the
Matrix trait methods (m00(), m01(), etc.) to access elements.
§Conversions
- Can be converted from/to
Cubefor bounding box storage
§Example
ⓘ
use rpfm_lib::files::bmd::common::{Transform4x4, Matrix};
let transform = Transform4x4::identity();
let rotation = transform.rotation_matrix();
let (rx, ry, rz) = Transform4x4::rotation_matrix_to_euler_angles(rotation, true);Implementations§
Source§impl Transform4x4
impl Transform4x4
Source§impl Transform4x4
impl Transform4x4
Sourcepub fn set_m30(&mut self, val: f32) -> &mut Self
pub fn set_m30(&mut self, val: f32) -> &mut Self
Matrix element at row 3, column 0 (translation X).
Sourcepub fn set_m31(&mut self, val: f32) -> &mut Self
pub fn set_m31(&mut self, val: f32) -> &mut Self
Matrix element at row 3, column 1 (translation Y).
Trait Implementations§
Source§impl Clone for Transform4x4
impl Clone for Transform4x4
Source§fn clone(&self) -> Transform4x4
fn clone(&self) -> Transform4x4
Returns a duplicate 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 Transform4x4
impl Debug for Transform4x4
Source§impl Decodeable for Transform4x4
impl Decodeable for Transform4x4
Source§impl Default for Transform4x4
impl Default for Transform4x4
Source§fn default() -> Transform4x4
fn default() -> Transform4x4
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for Transform4x4
impl<'de> Deserialize<'de> for Transform4x4
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 Encodeable for Transform4x4
impl Encodeable for Transform4x4
Source§fn encode<W: WriteBytes>(
&mut self,
buffer: &mut W,
_extra_data: &Option<EncodeableExtraData<'_>>,
) -> Result<()>
fn encode<W: WriteBytes>( &mut self, buffer: &mut W, _extra_data: &Option<EncodeableExtraData<'_>>, ) -> Result<()>
Encodes the implementing type into binary data. Read more
Source§impl From<Cube> for Transform4x4
impl From<Cube> for Transform4x4
Source§impl From<Transform4x4> for Cube
impl From<Transform4x4> for Cube
Source§fn from(value: Transform4x4) -> Self
fn from(value: Transform4x4) -> Self
Converts to this type from the input type.
Source§impl Matrix for Transform4x4
impl Matrix for Transform4x4
Source§fn extract_scales(matrix: Matrix3<f64>) -> (f64, f64, f64)
fn extract_scales(matrix: Matrix3<f64>) -> (f64, f64, f64)
Extracts scale factors from a rotation matrix. Read more
Source§fn apply_scales(matrix: Matrix3<f64>, scales: (f64, f64, f64)) -> Matrix3<f64>
fn apply_scales(matrix: Matrix3<f64>, scales: (f64, f64, f64)) -> Matrix3<f64>
Applies scale factors to a rotation matrix. Read more
Source§fn normalize_rotation_matrix(
matrix: Matrix3<f64>,
scales: (f64, f64, f64),
) -> Matrix3<f64>
fn normalize_rotation_matrix( matrix: Matrix3<f64>, scales: (f64, f64, f64), ) -> Matrix3<f64>
Normalizes a rotation matrix by removing scale factors. Read more
Source§impl PartialEq for Transform4x4
impl PartialEq for Transform4x4
Source§impl Serialize for Transform4x4
impl Serialize for Transform4x4
impl StructuralPartialEq for Transform4x4
Auto Trait Implementations§
impl Freeze for Transform4x4
impl RefUnwindSafe for Transform4x4
impl Send for Transform4x4
impl Sync for Transform4x4
impl Unpin for Transform4x4
impl UnsafeUnpin for Transform4x4
impl UnwindSafe for Transform4x4
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.