pub struct SymMat4 {
pub m: [f64; 10],
}Expand description
A symmetric 4×4 matrix stored as 10 unique elements (upper triangle).
Layout: a00 a01 a02 a03 a11 a12 a13 a22 a23 a33
Fields§
§m: [f64; 10]Elements stored in row-major upper-triangle order.
Implementations§
Source§impl SymMat4
impl SymMat4
Sourcepub fn from_plane(a: f64, b: f64, c: f64, d: f64) -> Self
pub fn from_plane(a: f64, b: f64, c: f64, d: f64) -> Self
Build quadric matrix from plane equation ax + by + cz + d = 0.
Sourcepub fn evaluate(&self, v: [f64; 3]) -> f64
pub fn evaluate(&self, v: [f64; 3]) -> f64
Evaluate the quadric error v^T Q v for a 3D point (homogeneous w=1).
Sourcepub fn optimal_point(&self) -> Option<[f64; 3]>
pub fn optimal_point(&self) -> Option<[f64; 3]>
Try to find the optimal point that minimizes the quadric error.
Solves the 3×3 linear system from ∂(v^T Q v)/∂v = 0.
Returns None if the system is singular.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SymMat4
impl RefUnwindSafe for SymMat4
impl Send for SymMat4
impl Sync for SymMat4
impl Unpin for SymMat4
impl UnsafeUnpin for SymMat4
impl UnwindSafe for SymMat4
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
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
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.