ncollide_utils 0.9.1

DEPRECATED: use ncollide2d or ncollide3d insead.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use alga::linear::FiniteDimInnerSpace;
use na;

/// A 3d cross product that do not require the `Cross<Self, Self>` trait impl.
///
/// Panics if the dimension of `V` is not 3.
#[inline]
pub fn cross3<V: FiniteDimInnerSpace>(a: &V, b: &V) -> V {
    assert!(na::dimension::<V>() == 3);

    let mut res = na::zero::<V>();

    res[0] = a[1] * b[2] - a[2] * b[1];
    res[1] = a[2] * b[0] - a[0] * b[2];
    res[2] = a[0] * b[1] - a[1] * b[0];

    res
}