262 GPGPU Programming for Games and Science
template <int N, typename Real>
Vector <N, Real> Cr os s ( Vector<N, Real> const& v0 , Vector <N, Real> const&v1);
template <int N, typename Real>
Vector <N, Real> UnitCross ( Vector <N, Real> const&v0,
Vector <N, Real> const&v1);
template <int N, typename Real>
Real DotCross ( Vector<N, Real> const& v0 , Vector <N, Real> const&v1,
Vector <N, Real> const&v2);
LISTING 6.7: The vector interface for cross products and dot-cross, where
N is three or four.
The function
Cross computes the cross product of the inputs. If you require a
unit-length orthogonal vector, the cross product can be normalized, a result
returned by function
UnitCross. If the cross product is zero, the function re-
turns the zero vector. Simila