Trait QuaternionOps

Source
pub trait QuaternionOps<T>: Copy {
Show 13 methods // Required methods fn sum(self) -> T; fn add(self, rhs: Self) -> Self; fn sub(self, rhs: Self) -> Self; fn scale(self, s: T) -> Self; fn scale_add(self, s: T, b: Self) -> Self; fn hadamard(self, rhs: Self) -> Self; fn hadamard_add(self, b: Self, c: Self) -> Self; fn dot(self, b: Self) -> T; fn norm(self) -> T; fn negate(self) -> Self; fn mul(self, rhs: Self) -> Quaternion<T>; fn inv(self) -> Self; fn exp(self) -> Quaternion<T>;
}
Expand description

This trait provides operations common to Quaternions and Pure Quaternions (Vector3).

This is to allow functions such as add, dot and negate to take both Vector3 and Quaternion types as arguments. You can use this trait directly, but it is easier to see if you use the one provided as a function (i.e., write add(a, b) instead of a.add(b)).

Required Methods§

Source

fn sum(self) -> T

Source

fn add(self, rhs: Self) -> Self

self + rhs

Source

fn sub(self, rhs: Self) -> Self

self - rhs

Source

fn scale(self, s: T) -> Self

s * self

Source

fn scale_add(self, s: T, b: Self) -> Self

s * self + b

Source

fn hadamard(self, rhs: Self) -> Self

self ∘ rhs

Source

fn hadamard_add(self, b: Self, c: Self) -> Self

self ∘ b + c

Source

fn dot(self, b: Self) -> T

Source

fn norm(self) -> T

Source

fn negate(self) -> Self

-self

Source

fn mul(self, rhs: Self) -> Quaternion<T>

self * rhs

Source

fn inv(self) -> Self

Source

fn exp(self) -> Quaternion<T>

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.

Implementors§