pub struct Matrix3x3 { /* private fields */ }Expand description
Matrice 3×3 en f32, stockée en row-major.
use embedded_matrix::Matrix3x3;
let m = Matrix3x3::identity();
assert!((m.det() - 1.0).abs() < 1e-5);
assert!((m.trace() - 3.0).abs() < 1e-5);Implementations§
Source§impl Matrix3x3
impl Matrix3x3
Sourcepub const fn new(data: [[f32; 3]; 3]) -> Self
pub const fn new(data: [[f32; 3]; 3]) -> Self
Crée une matrice à partir d’un tableau row-major.
Sourcepub const fn from_diagonal(d: [f32; 3]) -> Self
pub const fn from_diagonal(d: [f32; 3]) -> Self
Matrice diagonale.
Sourcepub fn get(&self, row: usize, col: usize) -> f32
pub fn get(&self, row: usize, col: usize) -> f32
Retourne l’élément à la ligne row et colonne col (0-indexé).
§Panics
Panique si row ou col vaut 3 ou plus.
Sourcepub fn approx_eq(&self, other: &Self, tol: f32) -> bool
pub fn approx_eq(&self, other: &Self, tol: f32) -> bool
Compare deux matrices terme à terme avec une tolérance absolue.
Renvoie false si un terme est NaN.
Sourcepub fn inv(&self) -> Result<Self, MatrixError>
pub fn inv(&self) -> Result<Self, MatrixError>
Inverse par la méthode des cofacteurs (matrice adjointe / déterminant).
§Errors
MatrixError::SingularMatrixsi|det|est négligeable devant la somme des valeurs absolues des termes du déterminant (seuil relatif, voir la doc de la crate).MatrixError::NonFiniteValuesi la matrice contient NaN / ±∞ ou si le calcul déborde.
Trait Implementations§
Source§impl AddAssign for Matrix3x3
impl AddAssign for Matrix3x3
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+= operation. Read moreimpl Copy for Matrix3x3
Source§impl MulAssign for Matrix3x3
impl MulAssign for Matrix3x3
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreSource§impl MulAssign<f32> for Matrix3x3
impl MulAssign<f32> for Matrix3x3
Source§fn mul_assign(&mut self, s: f32)
fn mul_assign(&mut self, s: f32)
Performs the
*= operation. Read moreimpl 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 UnsafeUnpin 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