|
matBoost , ,
QVM: Quaternions, Vectors, Matrices
mat
#include <boost/qvm/mat.hpp>[ORIG_END] -->
namespace boost
{
namespace qvm
{
template <class T,int Rows,int Cols>
struct mat
{
T a[Rows][Cols];
template <class R>
operator R() const
{
R r;
assign(r,*this);
return r;
}
};
template <class Matrix>
struct mat_traits;
template <class T,int Rows,int Cols>
struct mat_traits< mat<T,Rows,Cols> >
{
typedef T scalar_type;
static int const rows=Rows;
static int const cols=Cols;
template <int Row,int Col> static scalar_type read_element( mat<T,Rows,Cols> const & x ) { return x.a[Row][Col]; }
template <int Row,int Col> static scalar_type & write_element( mat<T,Rows,Cols> & x ) { return x.a[Row][Col]; }
static scalar_type read_element_idx( int row, int col, mat<T,Rows,Cols> const & x ) { return x.a[row][col]; }
static scalar_type & write_element_idx( int row, int col, mat<T,Rows,Cols> & x ) { return x.a[row][col]; }
};
}
}
Это простой тип матрицы. Преобразуется в любой другой тип матрицы совместимого размера.
Частичная специализация шаблонаmat_traitsделает шаблонmatсовместимым с общими операциями, определенными Boost QVM.
Статья mat раздела может быть полезна для разработчиков на c++ и boost.
:: Главная :: ::
|
|