pub struct SymmetricEigen3 {
pub eigenvalues: Vec3,
pub eigenvectors: Mat3,
}Expand description
The eigen decomposition of a symmetric 3x3 matrix (f32 precision).
Fields§
§eigenvalues: Vec3The eigenvalues of the symmetric 3x3 matrix.
eigenvectors: Mat3The three eigenvectors of the symmetric 3x3 matrix (as columns).
Implementations§
Source§impl SymmetricEigen3
impl SymmetricEigen3
Sourcepub fn new(mat: Mat3) -> Self
pub fn new(mat: Mat3) -> Self
Computes the eigen decomposition of the given symmetric 3x3 matrix.
The eigenvalues are returned in ascending order eigen1 < eigen2 < eigen3.
This can be reversed with the reverse method.
Sourcepub fn reverse(&self) -> Self
pub fn reverse(&self) -> Self
Reverses the order of the eigenvalues and their corresponding eigenvectors.
Sourcepub fn eigenvalues(mat: Mat3) -> Vec3
pub fn eigenvalues(mat: Mat3) -> Vec3
Computes the eigenvalues of a symmetric 3x3 matrix.
Reference: https://en.wikipedia.org/wiki/Eigenvalue_algorithm#3%C3%973_matrices
Sourcepub fn eigenvector1(mat: Mat3, eigenvalue1: f32) -> Vec3
pub fn eigenvector1(mat: Mat3, eigenvalue1: f32) -> Vec3
Computes the unit-length eigenvector corresponding to the eigenvalue1 of mat that was
computed from the root of a cubic polynomial with a multiplicity of 1.
If the other two eigenvalues are well separated, this method can be used for computing
all three eigenvectors. However, to avoid numerical issues when eigenvalues are close to
each other, it’s recommended to use the eigenvector2 method for the second eigenvector.
The third eigenvector can be computed as the cross product of the first two.
Sourcepub fn eigenvector2(mat: Mat3, eigenvector1: Vec3, eigenvalue2: f32) -> Vec3
pub fn eigenvector2(mat: Mat3, eigenvector1: Vec3, eigenvalue2: f32) -> Vec3
Computes the unit-length eigenvector corresponding to the eigenvalue2 of mat that was
computed from the root of a cubic polynomial with a potential multiplicity of 2.
The third eigenvector can be computed as the cross product of the first two.
Sourcepub fn eigenvector3(eigenvector1: Vec3, eigenvector2: Vec3) -> Vec3
pub fn eigenvector3(eigenvector1: Vec3, eigenvector2: Vec3) -> Vec3
Computes the third eigenvector as the cross product of the first two. If the given eigenvectors are valid, the returned vector should be unit length.
Trait Implementations§
Source§impl Clone for SymmetricEigen3
impl Clone for SymmetricEigen3
Source§fn clone(&self) -> SymmetricEigen3
fn clone(&self) -> SymmetricEigen3
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SymmetricEigen3
impl Debug for SymmetricEigen3
Source§impl From<DSymmetricEigen3> for SymmetricEigen3
impl From<DSymmetricEigen3> for SymmetricEigen3
Source§fn from(e: DSymmetricEigen3) -> Self
fn from(e: DSymmetricEigen3) -> Self
Source§impl From<SymmetricEigen3> for DSymmetricEigen3
impl From<SymmetricEigen3> for DSymmetricEigen3
Source§fn from(e: SymmetricEigen3) -> Self
fn from(e: SymmetricEigen3) -> Self
Source§impl From<SymmetricEigen3> for SymmetricEigen3A
impl From<SymmetricEigen3> for SymmetricEigen3A
Source§fn from(e: SymmetricEigen3) -> Self
fn from(e: SymmetricEigen3) -> Self
Source§impl From<SymmetricEigen3A> for SymmetricEigen3
impl From<SymmetricEigen3A> for SymmetricEigen3
Source§fn from(e: SymmetricEigen3A) -> Self
fn from(e: SymmetricEigen3A) -> Self
Source§impl PartialEq for SymmetricEigen3
impl PartialEq for SymmetricEigen3
impl Copy for SymmetricEigen3
impl StructuralPartialEq for SymmetricEigen3
Auto Trait Implementations§
impl Freeze for SymmetricEigen3
impl RefUnwindSafe for SymmetricEigen3
impl Send for SymmetricEigen3
impl Sync for SymmetricEigen3
impl Unpin for SymmetricEigen3
impl UnwindSafe for SymmetricEigen3
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,
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.