Function negate

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

Invert the sign of a Vector3 or Quaternion.

ยงExamples

// --- Vector3 --- //
let v: Vector3<f64> = [1.0, 2.0, 3.0];
let v_n = negate(v);
 
assert_eq!(-v[0], v_n[0]);
assert_eq!(-v[1], v_n[1]);
assert_eq!(-v[2], v_n[2]);
 
// --- Quaternion --- //
let q: Quaternion<f64> = (1.0, [2.0, 3.0, 4.0]);
let q_n = negate(q);
 
assert_eq!(-q.0,    q_n.0);
assert_eq!(-q.1[0], q_n.1[0]);
assert_eq!(-q.1[1], q_n.1[1]);
assert_eq!(-q.1[2], q_n.1[2]);