pair_system_to_local

Function pair_system_to_local 

Source
pub fn pair_system_to_local<V, R>(r_a: &V, o_a: &R, r_b: &V, o_b: &R) -> (V, R)
where V: Vector, R: Rotation + Rotate<V>,
Expand description

Get the relative position and orientation given pairs of positions and orientations.

ยงExample

use approxim::assert_relative_eq;
use hoomd_vector::{self, Angle, Cartesian};
use std::f64::consts::PI;

let r_a = Cartesian::from([1.0, -2.0]);
let o_a = Angle::from(PI / 2.0);

let r_b = Cartesian::from([2.0, -1.0]);
let o_b = Angle::from(PI);

let (v_ab, o_ab) =
    hoomd_vector::pair_system_to_local(&r_a, &o_a, &r_b, &o_b);
assert_relative_eq!(v_ab[0], 1.0);
assert_relative_eq!(v_ab[1], -1.0);
assert_relative_eq!(o_ab.theta, PI / 2.0);