pub struct PreparedAffine3D { /* private fields */ }Expand description
Validated immutable cache of an affine model, linear inverse transpose and orientation. All accessors return copies, preserving cache invariants.
Use the module recipe for scalar, bounded batch and update examples.
Implementations§
Source§impl PreparedAffine3D
impl PreparedAffine3D
Sourcepub fn try_new(model: Mat4) -> Result<Self, AffineError>
pub fn try_new(model: Mat4) -> Result<Self, AffineError>
Checks finiteness, exact affine row, then the linear checked inverse. Singular models and inverses outside f32 range are rejected. There is no epsilon cutoff or implicit repair of a nearly affine row.
Sourcepub fn try_update(&mut self, model: Mat4) -> Result<(), AffineError>
pub fn try_update(&mut self, model: Mat4) -> Result<(), AffineError>
Atomically replaces all cached state. Failure leaves self unchanged.
Updating to identity resets the transform; there is no hidden history.
Sourcepub const fn model(&self) -> Mat4
pub const fn model(&self) -> Mat4
The exact finite affine model supplied at the last successful preparation.
Sourcepub const fn normal_matrix(&self) -> Mat4
pub const fn normal_matrix(&self) -> Mat4
Linear inverse transpose in a Mat4 with zero translation and affine row.
Its transform_vector3 gives an unnormalized, unchecked normal.
Prefer Self::transform_normal for checked, normalized results.
Sourcepub const fn is_reflected(&self) -> bool
pub const fn is_reflected(&self) -> bool
Whether the computed linear determinant is negative (a mirror). This uses its sign even when f32 magnitude overflows or underflows. Like the checked inverse, it is not an exact-arithmetic rank or conditioning certificate for nearly dependent axes.
Sourcepub fn transform_point(&self, point: Vec3) -> Result<Vec3, AffineError>
pub fn transform_point(&self, point: Vec3) -> Result<Vec3, AffineError>
Transforms a finite position with translation, without projective divide. Returns a finite f32 result or an error; coordinate underflow is allowed.
Sourcepub fn transform_vector(&self, vector: Vec3) -> Result<Vec3, AffineError>
pub fn transform_vector(&self, vector: Vec3) -> Result<Vec3, AffineError>
Transforms a finite direction/displacement without translation. Zero vectors are valid. Does not normalize or preserve length.
Sourcepub fn transform_normal(&self, normal: Vec3) -> Result<Vec3, AffineError>
pub fn transform_normal(&self, normal: Vec3) -> Result<Vec3, AffineError>
Returns a unit inverse-transpose normal, with no determinant-sign flip. Nonunit finite inputs are allowed; zero/nonfinite normals fail. Wide rescaling avoids intermediate f32 overflow/underflow. Component quantization and rounded inverse coefficients can still affect direction.
Sourcepub fn transform_points_into(
&self,
input: &[Vec3],
output: &mut [Vec3],
) -> Result<(), AffineSliceError>
pub fn transform_points_into( &self, input: &[Vec3], output: &mut [Vec3], ) -> Result<(), AffineSliceError>
Transforms every input point into the output prefix, atomically. Empty input succeeds; unused output tail is retained. See module bounds.
Sourcepub fn transform_vectors_into(
&self,
input: &[Vec3],
output: &mut [Vec3],
) -> Result<(), AffineSliceError>
pub fn transform_vectors_into( &self, input: &[Vec3], output: &mut [Vec3], ) -> Result<(), AffineSliceError>
Transforms every input vector into the output prefix, atomically. Zero vectors are accepted; capacity/element errors retain the whole output.
Sourcepub fn transform_normals_into(
&self,
input: &[Vec3],
output: &mut [Vec3],
) -> Result<(), AffineSliceError>
pub fn transform_normals_into( &self, input: &[Vec3], output: &mut [Vec3], ) -> Result<(), AffineSliceError>
Transforms and normalizes every normal into the output prefix, atomically. A zero/nonfinite/collapsed normal fails with its input index. No fallback normal is inserted, and even earlier valid elements are left unwritten.
Trait Implementations§
Source§impl Clone for PreparedAffine3D
impl Clone for PreparedAffine3D
Source§fn clone(&self) -> PreparedAffine3D
fn clone(&self) -> PreparedAffine3D
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more