282 GPGPU Programming for Games and Science
// special matrices
static Matrix4x4 Zero ();
static Matrix4x4 Identity ();
} ;
LISTING 6.25: The class interface for 4 × 4 matrices.
The constructors are for the specific size four. The constructor and assignment
operator for the base class are provided to allow implicit conversions. Static
functions are implemented to return the zero matrix and the identity matrix.
We use functions to avoid the standard template dilemma of declaring static
members that might be instantiated in multiple modules.
Geometric operations are implemented outside the class; see Listing 6.26.
template <typename Real>
Matrix4x4<Real> Inverse (Matrix4x4<Real> const&M);
template <typename Real>
Matrix4x4<Real> Adjoint (Matrix4x4<Real> co ...