ResidualVM logo ResidualVM website - Forums - Contact us BuildBot - Doxygen - Wiki curved edge

Math:: This Namespace Reference

namespace contains some useful classes dealing with math and geometry. More...

Detailed Description

namespace contains some useful classes dealing with math and geometry.

The most important classes are Matrix and its base classes. MatrixBase is a template class which is the base of all the matrices with many convenient functions. MatrixType is an intermediate class that, using template specialization, is able to create different kinds of matrices, like vectors or square matrices. Matrix is the actual matrix class and it is derived from MatrixType.

MatrixBase and MatrixType have their constructors protected, so they can't be instantiated. But while MatrixBase is just a backend class, MatrixType can be used to create new kinds of matrices:

 template<int dim>
 class MatrixType<1, dim> : public MatrixBase<1, dim> {

Given that declaration, every Matrix<1, dim>, with "dim" whatever positive number, will have the methods and members defined in MatrixType<1, dim>.

This design allows us to have the equality of, say, the class "three-dimensional vector" and Matrix<3, 1>. Vector3d is not a Matrix<3, 1>, it is Matrix<3, 1>. Every method in MatrixBase and MatrixType returning a matrix returns a Matrix<, c>, and not a MatrixBase<, c>. This reduces code duplication, since otherwise many functions declared for Matrix would need to be declared for MatrixBase too, like many operators.

Generated on Sat May 18 2019 05:06:54 for ResidualVM by doxygen 1.7.1
curved edge   curved edge