pub struct Matrix3 {
pub rows: [[f64; 3]; 3],
}Expand description
A 3×3 matrix, row-major.
Fields§
§rows: [[f64; 3]; 3]Rows, each [m[i][0], m[i][1], m[i][2]].
Implementations§
Source§impl Matrix3
impl Matrix3
Sourcepub const fn from_columns(a: Vector, b: Vector, c: Vector) -> Self
pub const fn from_columns(a: Vector, b: Vector, c: Vector) -> Self
From column vectors.
Sourcepub const fn scaling_xyz(x: f64, y: f64, z: f64) -> Self
pub const fn scaling_xyz(x: f64, y: f64, z: f64) -> Self
A non-uniform scaling along the coordinate axes.
Sourcepub fn rotation(axis: Direction, angle: f64) -> Self
pub fn rotation(axis: Direction, angle: f64) -> Self
A right-handed rotation of angle radians about axis.
Rodrigues’ formula. Orthonormal to within rounding for any unit axis,
which Direction guarantees.
Sourcepub fn reflection(n: Direction) -> Self
pub fn reflection(n: Direction) -> Self
Reflection in the plane through the origin with normal n.
Sourcepub const fn transposed(&self) -> Self
pub const fn transposed(&self) -> Self
The transpose.
Sourcepub fn determinant(&self) -> f64
pub fn determinant(&self) -> f64
The determinant.
Sourcepub fn inverse(&self) -> OgeomResult<Self>
pub fn inverse(&self) -> OgeomResult<Self>
The inverse.
§Errors
OgeomError::Numeric if the matrix is
singular.
Singularity is a question of numerical conditioning, not of modelling
tolerance, so this takes no Tolerances.
The determinant is compared against the rounding error incurred
computing it: for an n x n matrix
with entries bounded by s, that is on the order of n * n! * eps * s^n. The bound scales with the entries and has no absolute floor,
because a matrix scaled by 1e-3 has a determinant scaled by 1e-9 and
is no less invertible for it.
Sourcepub fn is_orthonormal(&self, eps: f64) -> bool
pub fn is_orthonormal(&self, eps: f64) -> bool
Whether the matrix is orthonormal: its rows form an orthonormal basis, so it represents a rotation or a reflection and its inverse is its transpose.
Sourcepub fn is_equal(&self, other: &Self, eps: f64) -> bool
pub fn is_equal(&self, other: &Self, eps: f64) -> bool
Whether every element agrees with other within eps.
Takes a bare epsilon rather than Tolerances: matrix entries are
dimensionless ratios, and a length tolerance does not apply to them.
Trait Implementations§
impl Copy for Matrix3
impl StructuralPartialEq for Matrix3
Auto Trait Implementations§
impl Freeze for Matrix3
impl RefUnwindSafe for Matrix3
impl Send for Matrix3
impl Sync for Matrix3
impl Unpin for Matrix3
impl UnsafeUnpin for Matrix3
impl UnwindSafe for Matrix3
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,
impl<T> ClosedNeg for Twhere
T: Neg<Output = T>,
impl<T> Scalar for T
§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>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.