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§
fn sum(self) -> T
Sourcefn hadamard_add(self, b: Self, c: Self) -> Self
fn hadamard_add(self, b: Self, c: Self) -> Self
self ∘ b + c
fn dot(self, b: Self) -> T
fn norm(self) -> T
Sourcefn mul(self, rhs: Self) -> Quaternion<T>
fn mul(self, rhs: Self) -> Quaternion<T>
self * rhs
fn inv(self) -> Self
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.