Function dot

Source
pub fn dot<T, U>(a: U, b: U) -> T
where T: Float, U: QuaternionOps<T>,
Expand description

Dot product of two quaternions (or vectors): a · b

§Examples

// --- Vector3 --- //
let v1: Vector3<f64> = [1.0, 2.0, 3.0];
let v2: Vector3<f64> = [0.1, 0.2, 0.3];
 
assert!( (1.4 - dot(v1, v2)).abs() < 1e-12 );
 
// --- Quaternion --- //
let q1: Quaternion<f64> = (1.0, [2.0, 3.0, 4.0]);
let q2: Quaternion<f64> = (0.1, [0.2, 0.3, 0.4]);
 
assert!( (3.0 - dot(q1, q2)).abs() < 1e-12 );