pub struct Matrix3x3 {
pub col1: Vector3,
pub col2: Vector3,
pub col3: Vector3,
}
Expand description
A column-major 3x3 matrix of contiguous floats.
Fields§
§col1: Vector3
§col2: Vector3
§col3: Vector3
Implementations§
source§impl Matrix3x3
impl Matrix3x3
sourcepub fn identity() -> Matrix3x3
pub fn identity() -> Matrix3x3
The identity transformation matrix.
use ssbh_lib::{Vector3, Matrix3x3};
let m = Matrix3x3::identity();
assert_eq!(Vector3::new(1f32, 0f32, 0f32), m.col1);
assert_eq!(Vector3::new(0f32, 1f32, 0f32), m.col2);
assert_eq!(Vector3::new(0f32, 0f32, 1f32), m.col3);
sourcepub fn to_cols_array(&self) -> [[f32; 3]; 3]
pub fn to_cols_array(&self) -> [[f32; 3]; 3]
Converts the elements to a 2d array in column-major order.
use ssbh_lib::{Vector3, Matrix3x3};
let m = Matrix3x3 {
col1: Vector3::new(1f32, 2f32, 3f32),
col2: Vector3::new(4f32, 5f32, 6f32),
col3: Vector3::new(7f32, 8f32, 9f32),
};
assert_eq!(
[
[1f32, 2f32, 3f32],
[4f32, 5f32, 6f32],
[7f32, 8f32, 9f32],
],
m.to_cols_array(),
);
Trait Implementations§
source§impl BinRead for Matrix3x3
impl BinRead for Matrix3x3
source§fn read_options<R: Read + Seek>(
__binrw_generated_var_reader: &mut R,
__binrw_generated_var_endian: Endian,
__binrw_generated_var_arguments: Self::Args<'_>,
) -> BinResult<Self>
fn read_options<R: Read + Seek>( __binrw_generated_var_reader: &mut R, __binrw_generated_var_endian: Endian, __binrw_generated_var_arguments: Self::Args<'_>, ) -> BinResult<Self>
source§fn read_be<R>(reader: &mut R) -> Result<Self, Error>
fn read_be<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
big-endian byte order. Read moresource§fn read_le<R>(reader: &mut R) -> Result<Self, Error>
fn read_le<R>(reader: &mut R) -> Result<Self, Error>
Read
Self
from the reader using default arguments and assuming
little-endian byte order. Read moresource§fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
fn read_ne<R>(reader: &mut R) -> Result<Self, Error>
Read
T
from the reader assuming native-endian byte order. Read moresource§fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
fn read_be_args<R>(reader: &mut R, args: Self::Args<'_>) -> Result<Self, Error>
Read
Self
from the reader, assuming big-endian byte order, using the
given arguments. Read moresource§impl PartialEq for Matrix3x3
impl PartialEq for Matrix3x3
source§impl SsbhWrite for Matrix3x3
impl SsbhWrite for Matrix3x3
source§fn ssbh_write<W: Write + Seek>(
&self,
writer: &mut W,
data_ptr: &mut u64,
) -> Result<()>
fn ssbh_write<W: Write + Seek>( &self, writer: &mut W, data_ptr: &mut u64, ) -> Result<()>
Writes the byte representation of
self
to writer
.
data_ptr
is assumed to be the absolute offset where the next data stored behind an offset will be written.
Struct that contains no offsets as fields can skip updating data_ptr
. Read moresource§fn size_in_bytes(&self) -> u64
fn size_in_bytes(&self) -> u64
The offset in bytes between successive elements in an array of this type.
This should include any alignment or padding.
source§fn alignment_in_bytes() -> u64
fn alignment_in_bytes() -> u64
The alignment for pointers of this type, which is useful for offset calculations.
impl Copy for Matrix3x3
impl StructuralPartialEq for Matrix3x3
Auto Trait Implementations§
impl Freeze for Matrix3x3
impl RefUnwindSafe for Matrix3x3
impl Send for Matrix3x3
impl Sync for Matrix3x3
impl Unpin for Matrix3x3
impl UnwindSafe for Matrix3x3
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)