UnitQuatExt

Trait UnitQuatExt 

Source
pub trait UnitQuatExt {
    // Required methods
    fn from_array_unchecked(array: [Real; 4]) -> Self;
    fn from_vec4_unchecked(v: Vec4) -> Self;
    fn is_valid(array: [Real; 4], eps: Real) -> bool;
}
Expand description

Extension trait for unit quaternions with spatial algebra utilities.

This trait provides additional methods for creating and validating unit quaternions specifically tailored for use in spatial transformations and dynamics calculations.

Required Methods§

Source

fn from_array_unchecked(array: [Real; 4]) -> Self

Create a unit quaternion from a 4-element array without validation.

§Safety

This function assumes the input represents a valid unit quaternion. Use with caution and only when you’re certain the input is normalized.

§Arguments
  • array - [x, y, z, w] quaternion components (w is scalar part)
Source

fn from_vec4_unchecked(v: Vec4) -> Self

Create a unit quaternion from a 4D vector without validation.

§Safety

This function assumes the input vector represents a valid unit quaternion. Use with caution and only when you’re certain the input is normalized.

§Arguments
  • v - 4D vector containing [x, y, z, w] quaternion components
Source

fn is_valid(array: [Real; 4], eps: Real) -> bool

Check if the array represents a valid unit quaternion.

Validates that the quaternion has unit length within the specified tolerance. This is useful for input validation and debugging quaternion-related issues.

§Arguments
  • array - The [x, y, z, w] array to check
  • eps - The tolerance for checking the unit length (typically 1e-6 or smaller)
§Returns

true if the quaternion is normalized within tolerance, false otherwise

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl UnitQuatExt for UnitQuaternion<Real>

Source§

fn from_array_unchecked(array: [Real; 4]) -> Self

Source§

fn from_vec4_unchecked(v: Vec4) -> Self

Source§

fn is_valid(array: [Real; 4], eps: Real) -> bool

Implementors§