Skip to main content

ApplyTransform

Trait ApplyTransform 

Source
pub trait ApplyTransform {
    // Required method
    fn apply_transform(&mut self, transform: Transform3<f64>);

    // Provided methods
    fn apply_isometry(&mut self, isometry: Isometry3<f64>) { ... }
    fn apply_translation(&mut self, vector: Vector3<f64>) { ... }
    fn apply_rotation(&mut self, rotation: Rotation3<f64>) { ... }
    fn apply_scale(&mut self, scale: Scale3<f64>) { ... }
}
Expand description

Applies a transform to self in place.

Only apply_transform is required. The other four methods have default implementations that convert to Transform3<f64> and delegate — correct everywhere, but not the fastest path: apply_translation, for instance, ends up doing a full homogeneous matrix multiply per point instead of a plain component-wise add.

A default can only reach self through other trait methods, so it can never be faster than apply_transform on its own. Implementors that care about that cost (in particular leaf position types, and container types that recurse into many of them) should override the specific methods with dedicated math all the way down the recursion — falling back to the default at any layer converts to a general transform there, and every layer below pays the full matrix cost regardless of what leaves further down are capable of.

Required Methods§

Source

fn apply_transform(&mut self, transform: Transform3<f64>)

Provided Methods§

Source

fn apply_isometry(&mut self, isometry: Isometry3<f64>)

Source

fn apply_translation(&mut self, vector: Vector3<f64>)

Source

fn apply_rotation(&mut self, rotation: Rotation3<f64>)

Source

fn apply_scale(&mut self, scale: Scale3<f64>)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§