Document Decomp2
This commit is contained in:
parent
f57ef1c141
commit
e5221fbcf8
10
src/mathx.rs
10
src/mathx.rs
|
|
@ -44,13 +44,22 @@ impl MatExt for Mat3 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Represents a 2×2 matrix decomposed as O^T D O, where O is orthogonal and D is diagonal.
|
||||
///
|
||||
/// Not every matrix can be decomposed like this, only that of a symmetric bilinear function.
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub struct Decomp2 {
|
||||
/// The orthogonal part.
|
||||
///
|
||||
/// Using a non-orthogonal matrix will yield to incorrect results (but no UB).
|
||||
pub ortho: Mat2,
|
||||
|
||||
/// The diagonal part.
|
||||
pub diag: Vec2,
|
||||
}
|
||||
|
||||
impl Decomp2 {
|
||||
/// Computes the square of this, more efficiently than doing that with a matrix.
|
||||
pub fn square(&self) -> Self {
|
||||
Self {
|
||||
ortho: self.ortho,
|
||||
|
|
@ -58,6 +67,7 @@ impl Decomp2 {
|
|||
}
|
||||
}
|
||||
|
||||
/// Computes the inverse of this, more efficiently than doing that with a matrix.
|
||||
pub fn inverse(&self) -> Self {
|
||||
Self {
|
||||
ortho: self.ortho,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user