Go to the documentation of this file. 1 #ifndef GfxTL__MATRIXX_HEADER__
2 #define GfxTL__MATRIXX_HEADER__
3 #ifndef _USE_MATH_DEFINES
4 #define _USE_MATH_DEFINES
20 template<
unsigned int D,
class T >
24 template<
unsigned int C,
unsigned int R,
class T >
28 template<
unsigned int C,
unsigned int R,
class T >
30 template<
unsigned int C,
unsigned int R,
class T >
32 template<
unsigned int C,
unsigned int R,
class T >
34 template<
unsigned int C,
unsigned int R,
class T >
36 template<
unsigned int C,
unsigned int R,
class T >
38 template<
unsigned int C,
unsigned int R,
class T >
40 template<
unsigned int C,
unsigned int R,
class T >
46 template<
unsigned int C,
unsigned int R,
class T >
67 memset(
_m, 0,
sizeof(
_m));
83 for (
unsigned int i = 0; i < C * R; ++i)
92 for (
unsigned int i = 0; i < C * R; ++i)
101 for (
unsigned int c = 0;
c < C; ++
c)
102 for (
unsigned int r = 0; r < R; ++r)
104 (*t)[r][
c] = (*this)[
c][r];
114 template<
unsigned int C,
unsigned int R,
class T >
208 template<
unsigned int A,
unsigned int B >
214 Error_InvalidDimension();
221 template<
unsigned int A >
274 operator const T()
const
286 template<
unsigned int C,
unsigned int R,
class T >
289 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
291 m.Data()[i] += b.Data()[i];
296 template<
unsigned int C,
unsigned int R,
class T >
299 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
301 m.Data()[i] -= b.Data()[i];
306 template<
unsigned int C,
unsigned int R,
class T >
313 template<
unsigned int C,
unsigned int R,
class T >
316 return m *= (
const T)b;
319 template<
unsigned int C,
unsigned int R,
class T >
322 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
329 template<
unsigned int C,
unsigned int R,
class T >
332 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
339 template<
unsigned int C,
unsigned int R,
class T >
343 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
350 template<
unsigned int C,
unsigned int R,
class T >
354 return memcmp(
a.Data(), b.Data(),
sizeof(
a)) == 0;
357 template<
unsigned int C,
unsigned int R,
class T >
360 return memcmp(
a.Data(), b.Data(),
sizeof(
a)) != 0;
363 template<
unsigned int C,
unsigned int R,
class T >
372 template<
unsigned int C,
unsigned int R,
class T >
378 template<
unsigned int C,
unsigned int R,
class T >
387 template<
unsigned int C,
unsigned int R,
unsigned int C2,
class T >
392 for (
int c = 0;
c < C2; ++
c)
394 for (
int r = 0; r < R; ++r)
396 x[
c][r] =
a[0][r] * b[
c][0];
397 for (
int i = 1; i < C; ++i)
399 x[
c][r] +=
a[i][r] * b[
c][i];
406 template<
unsigned int C,
unsigned int R,
class T >
410 return ((
const T)
a) * b;
413 template<
unsigned int C,
unsigned int R,
class T >
418 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
420 c.Data()[i] =
a.Data()[i] + b.Data()[i];
425 template<
unsigned int C,
unsigned int R,
class T >
430 for (
unsigned int i = 0; i < MatrixXX< C, R, T >::Entries; ++i)
432 c.Data()[i] =
a.Data()[i] - b.Data()[i];
437 template<
unsigned int N,
class T >
441 for (
unsigned int i = 0; i < N; ++i)
448 template<
unsigned int N,
class T >
452 for (
unsigned int i = 0; i < N; ++i)
469 template<
unsigned int N,
class T >
474 for (
unsigned int i = 0; i < N; ++i, j *= -1)
477 for (
unsigned int k = 1, kk = 0; kk < N - 1; ++kk, ++k)
479 for (
unsigned int l = 0, ll = 0; ll < N - 1; ++ll, ++l)
496 return a[0][0] * (
a[1][1] *
a[2][2] -
a[1][2] *
a[2][1])
497 -
a[0][1] * (
a[1][0] *
a[2][2] -
a[1][2] *
a[2][0])
498 +
a[0][2] * (
a[1][0] *
a[2][1] -
a[1][1] *
a[2][0]);
504 return a[0][0] *
a[1][1] -
a[1][0] *
a[0][1];
516 (*a)[0][0] = std::cos(rad);
517 (*a)[0][1] = std::sin(rad);
518 (*a)[1][0] = -(*a)[0][1];
519 (*a)[1][1] = (*a)[0][0];
522 template<
unsigned int N,
class T >
525 for (
unsigned int c = 0;
c < N; ++
c)
533 for (++r; r < N; ++r)
540 template<
unsigned int N,
class T >
551 template<
unsigned int C,
unsigned int R,
class T >
555 for (
unsigned int i = 0; i < C; ++i)
567 template<
unsigned int C,
unsigned int R,
class T >
572 for (
unsigned int c = 0;
c < C; ++
c)
573 for (
unsigned int r = 0; r < R; ++r)
575 m[
c][r] =
min(
a[
c][r], b[
c][r]);
580 template<
unsigned int C,
unsigned int R,
class T >
585 for (
unsigned int c = 0;
c < C; ++
c)
586 for (
unsigned int r = 0; r < R; ++r)
588 m[
c][r] =
max(
a[
c][r], b[
c][r]);
VectorXD< D, T > sqrt(const VectorXD< D, T > &a)
ThisType & operator=(const ThisType &v)
MatrixXX(const MatrixXX< 1, 1, T > &mat)
VectorXD< R, T > & operator[](unsigned int col)
MatrixXX< 1, 1, T > TransposedType
MatrixXX< C, R, T > max(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
Internal::BaseMatrixXX< C, R, T > SuperType
MatrixXX(const MatrixXX< 1, R, T > &a, const MatrixXX< 1, R, T > &b, const MatrixXX< 1, R, T > &c, const MatrixXX< 1, R, T > &d)
MatrixXX< C, R, T > ThisType
MatrixXX(const SuperType &mat)
ThisType & operator=(T v)
MatrixXX< C, R, T > min(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
bool operator==(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
MatrixXX< C, R, T > & operator/=(MatrixXX< C, R, T > &m, T s)
MatrixXX< C, R, T > & operator*=(MatrixXX< C, R, T > &m, const MatrixXX< C, R, T > &b)
static void AssertEqual()
MatrixXX< C, R, T > & operator+=(MatrixXX< C, R, T > &m, const MatrixXX< C, R, T > &b)
const VectorXD< R, T > & operator[](unsigned int col) const
Matrix in column major order.
void Identity(MatrixXX< N, N, T > *a)
double a(double t, double a0, double j)
std::ostream & operator<<(std::ostream &o, const Array< DimT, IteratorT > &a)
bool operator!=(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
const MatrixXX< C, R, T > SqrComponentMul(const MatrixXX< C, R, T > &a)
MatrixXX< 2, 2, float > Matrix2f
MatrixXX< 3, 3, float > Mat3f
ThisType & operator=(T v)
Internal::BaseMatrixXX< 1, 1, T > SuperType
MatrixXX(const MatrixXX< 1, R, T > &a, const MatrixXX< 1, R, T > &b, const MatrixXX< 1, R, T > &c)
MatrixXX(const ThisType &mat)
TransposedType Transposed()
BaseMatrixXX< C, R, T > ThisType
T TraceAbs(const MatrixXX< N, N, T > &a)
void Rotation(T rad, MatrixXX< 2, 2, T > *a)
const MatrixXX< C, R, T > operator*(T s, const MatrixXX< C, R, T > &a)
void Transpose(BaseMatrixXX< R, C, T > *t) const
MatrixXX< 4, 4, float > Mat4f
T Determinant(const MatrixXX< N, N, T > &a)
T Trace(const MatrixXX< N, N, T > &a)
MatrixXX(const MatrixXX< 1, R, T > &a, const MatrixXX< 1, R, T > &b)
class A(deque< T, A >)) ARMARX_OVERLOAD_STD_HASH_FOR_ITERABLE((class T
Enables hashing of std::list.
MatrixXX(const SuperType &mat)
MatrixXX< 3, 3, float > mat3
double v(double t, double v0, double a0, double j)
MatrixXX< 3, 3, float > Matrix3f
MatrixXX< 4, 4, float > Matrix4f
MatrixXX< 1, 1, T > & ComponentMul(const MatrixXX< 1, 1, T > &a)
const MatrixXX< C, R, T > ComponentMul(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
static void AssertEqual()
const MatrixXX< C, R, T > operator+(const MatrixXX< C, R, T > &a, const MatrixXX< C, R, T > &b)
MatrixXX< C, R, T > & operator-=(MatrixXX< C, R, T > &m, const MatrixXX< C, R, T > &b)
MatrixXX< 2, 2, float > Mat2f
MatrixXX< R, C, T > TransposedType
MatrixXX< 4, 4, float > mat4
MatrixXX< C, R, T > operator-(const MatrixXX< C, R, T > &a)
MatrixXX< 1, 1, T > ThisType
double s(double t, double s0, double v0, double a0, double j)
MatrixXX< C, R, T > & ComponentMul(const MatrixXX< C, R, T > &a)
MatrixXX< 2, 2, float > mat2