Struct PreparedAffine3D

Source
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

Source

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.

Source

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.

Source

pub const fn model(&self) -> Mat4

The exact finite affine model supplied at the last successful preparation.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> PreparedAffine3D

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PreparedAffine3D

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PreparedAffine3D

Source§

fn eq(&self, other: &PreparedAffine3D) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for PreparedAffine3D

Source§

impl StructuralPartialEq for PreparedAffine3D

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.