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) -> SymmetricEigen3
pub fn new(mat: Mat3) -> SymmetricEigen3
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) -> SymmetricEigen3
pub fn reverse(&self) -> SymmetricEigen3
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) -> SymmetricEigen3
fn from(e: DSymmetricEigen3) -> SymmetricEigen3
Source§impl From<SymmetricEigen3A> for SymmetricEigen3
impl From<SymmetricEigen3A> for SymmetricEigen3
Source§fn from(e: SymmetricEigen3A) -> SymmetricEigen3
fn from(e: SymmetricEigen3A) -> SymmetricEigen3
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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<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>
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>
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 moreSource§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.