pub struct Linear { /* private fields */ }Expand description
A linear map of an entity’s local space (a transform’s 3x3 part), computed in f64 from the f32 entries and rounded
once per value: what crate::Component::apply_linear maps local-space geometry by.
Points go through M; normals through M^-T with the determinant’s sign kept (they stay on the side they were
on) and directions through M, both then of unit length (zero stays zero); a tangent’s w (the bitangent sign) and
a triangle’s winding flip when the determinant is negative (Linear::mirrors). A singular map
(Linear::singular) turns no normal or tangent.
Implementations§
Source§impl Linear
impl Linear
Sourcepub fn new(cols: [[f32; 3]; 3]) -> Linear
pub fn new(cols: [[f32; 3]; 3]) -> Linear
The map with these columns (images of local +X, +Y, +Z).
Sourcepub fn of_f64(c: [[f64; 3]; 3]) -> Linear
pub fn of_f64(c: [[f64; 3]; 3]) -> Linear
The map with these columns held in f64: a part composed in f64 (a chain of bone transforms) taken as it is, not rounded to f32 first.
Sourcepub fn mirror_x() -> Linear
pub fn mirror_x() -> Linear
x negated: the mirror a mirroring placement keeps out of its transform, M = M' * MIRROR_X.
pub fn determinant(&self) -> f64
Sourcepub fn singular(&self) -> bool
pub fn singular(&self) -> bool
Whether the map has no inverse to turn normals and tangents by: its basis is degenerate, as
Transform::classify says of a transform with this linear part (or its determinant is not finite). The one
rule Linear::normal, Linear::tangent and Linear::inverse_columns answer None by.
Sourcepub fn inverse_columns(&self) -> Option<[[f64; 3]; 3]>
pub fn inverse_columns(&self) -> Option<[[f64; 3]; 3]>
The columns of M^-1 (the transpose of the cofactors over the determinant); None for a singular map
(Linear::singular).
Sourcepub fn mirrors(&self) -> bool
pub fn mirrors(&self) -> bool
Whether it reverses orientation (negative determinant): triangles must be reversed and tangent w negated.
Sourcepub fn similarity(&self) -> Option<f64>
pub fn similarity(&self) -> Option<f64>
The uniform scale s when the map is a rotation or mirror times s (columns orthogonal and of one length, to
a relative 1e-6): a sphere stays a sphere of s times its radius. None for any other map.
Sourcepub fn axis_map(&self) -> Option<[usize; 3]>
pub fn axis_map(&self) -> Option<[usize; 3]>
For each local axis, the world axis it maps onto, when every column has exactly one nonzero entry (a signed,
scaled permutation): an axis-aligned box stays one. None for any other map.