96 void set(
const DT val);
158 this->v[0] = this->v[1] = this->v[2] = this->v[3] = this->v[4] = this->v[5] =
Tvec6<DT>(0);
164 this->v[0][0] = this->v[1][1] = this->v[2][2] = this->v[3][3] = this->v[4][4] = this->v[5][5] =
diagValue;
165 this->v[1][0] = this->v[2][0] = this->v[3][0] = this->v[4][0] = this->v[5][0] = this->v[2][1] = this->v[3][1] =
166 this->v[4][1] = this->v[5][1] = this->v[3][2] = this->v[4][2] = this->v[5][2] = this->v[4][3] = this->v[5][3] =
168 this->v[0][1] = this->v[0][2] = this->v[0][3] = this->v[0][4] = this->v[0][5] = this->v[1][2] = this->v[1][3] =
169 this->v[1][4] = this->v[1][5] = this->v[2][3] = this->v[2][4] = this->v[2][5] = this->v[3][4] = this->v[3][5] =
188 this->v[0] =
mat.
v[0];
189 this->v[1] =
mat.v[1];
190 this->v[2] =
mat.v[2];
191 this->v[3] =
mat.v[3];
192 this->v[4] =
mat.v[4];
193 this->v[5] =
mat.v[5];
211 return Tmat6<DT>(val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val,
212 val, val, val, val, val, val, val, val, val, val, val, val, val, val, val, val);
218 this->v[0] = this->v[1] = this->v[2] = this->v[3] = this->v[4] = this->v[5] =
Tvec6<DT>(val);
239 this->v[0] +=
m.
v[0];
240 this->v[1] +=
m.v[1];
241 this->v[2] +=
m.v[2];
242 this->v[3] +=
m.v[3];
243 this->v[4] +=
m.v[4];
244 this->v[5] +=
m.v[5];
252 this->v[0] -=
m.
v[0];
253 this->v[1] -=
m.v[1];
254 this->v[2] -=
m.v[2];
255 this->v[3] -=
m.v[3];
256 this->v[4] -=
m.v[4];
257 this->v[5] -=
m.v[5];
298 return Tmat6<DT>(a) *=
static_cast<DT
>(-1.0);
357 this->v[0][0] =
static_cast<DT
>(
in00);
358 this->v[0][1] =
static_cast<DT
>(
in01);
359 this->v[0][2] =
static_cast<DT
>(
in02);
360 this->v[0][3] =
static_cast<DT
>(
in03);
361 this->v[0][4] =
static_cast<DT
>(
in04);
362 this->v[0][5] =
static_cast<DT
>(
in05);
363 this->v[1][0] =
static_cast<DT
>(
in10);
364 this->v[1][1] =
static_cast<DT
>(
in11);
365 this->v[1][2] =
static_cast<DT
>(
in12);
366 this->v[1][3] =
static_cast<DT
>(
in13);
367 this->v[1][4] =
static_cast<DT
>(
in14);
368 this->v[1][5] =
static_cast<DT
>(
in15);
369 this->v[2][0] =
static_cast<DT
>(
in20);
370 this->v[2][1] =
static_cast<DT
>(
in21);
371 this->v[2][2] =
static_cast<DT
>(
in22);
372 this->v[2][3] =
static_cast<DT
>(
in23);
373 this->v[2][4] =
static_cast<DT
>(
in24);
374 this->v[2][5] =
static_cast<DT
>(
in25);
375 this->v[3][0] =
static_cast<DT
>(
in30);
376 this->v[3][1] =
static_cast<DT
>(
in31);
377 this->v[3][2] =
static_cast<DT
>(
in32);
378 this->v[3][3] =
static_cast<DT
>(
in33);
379 this->v[3][4] =
static_cast<DT
>(
in34);
380 this->v[3][5] =
static_cast<DT
>(
in35);
381 this->v[4][0] =
static_cast<DT
>(
in40);
382 this->v[4][1] =
static_cast<DT
>(
in41);
383 this->v[4][2] =
static_cast<DT
>(
in42);
384 this->v[4][3] =
static_cast<DT
>(
in43);
385 this->v[4][4] =
static_cast<DT
>(
in44);
386 this->v[4][5] =
static_cast<DT
>(
in45);
387 this->v[5][0] =
static_cast<DT
>(
in50);
388 this->v[5][1] =
static_cast<DT
>(
in51);
389 this->v[5][2] =
static_cast<DT
>(
in52);
390 this->v[5][3] =
static_cast<DT
>(
in53);
391 this->v[5][4] =
static_cast<DT
>(
in54);
392 this->v[5][5] =
static_cast<DT
>(
in55);
402 this->v[0][0] =
static_cast<DT
>(
m[0]);
403 this->v[0][1] =
static_cast<DT
>(
m[1]);
404 this->v[0][2] =
static_cast<DT
>(
m[2]);
405 this->v[0][3] =
static_cast<DT
>(
m[3]);
406 this->v[0][4] =
static_cast<DT
>(
m[4]);
407 this->v[0][5] =
static_cast<DT
>(
m[5]);
408 this->v[1][0] =
static_cast<DT
>(
m[6]);
409 this->v[1][1] =
static_cast<DT
>(
m[7]);
410 this->v[1][2] =
static_cast<DT
>(
m[8]);
411 this->v[1][3] =
static_cast<DT
>(
m[9]);
412 this->v[1][4] =
static_cast<DT
>(
m[10]);
413 this->v[1][5] =
static_cast<DT
>(
m[11]);
414 this->v[2][0] =
static_cast<DT
>(
m[12]);
415 this->v[2][1] =
static_cast<DT
>(
m[13]);
416 this->v[2][2] =
static_cast<DT
>(
m[14]);
417 this->v[2][3] =
static_cast<DT
>(
m[15]);
418 this->v[2][4] =
static_cast<DT
>(
m[16]);
419 this->v[2][5] =
static_cast<DT
>(
m[17]);
420 this->v[3][0] =
static_cast<DT
>(
m[18]);
421 this->v[3][1] =
static_cast<DT
>(
m[19]);
422 this->v[3][2] =
static_cast<DT
>(
m[20]);
423 this->v[3][3] =
static_cast<DT
>(
m[21]);
424 this->v[3][4] =
static_cast<DT
>(
m[22]);
425 this->v[3][5] =
static_cast<DT
>(
m[23]);
426 this->v[4][0] =
static_cast<DT
>(
m[24]);
427 this->v[4][1] =
static_cast<DT
>(
m[25]);
428 this->v[4][2] =
static_cast<DT
>(
m[26]);
429 this->v[4][3] =
static_cast<DT
>(
m[27]);
430 this->v[4][4] =
static_cast<DT
>(
m[28]);
431 this->v[4][5] =
static_cast<DT
>(
m[29]);
432 this->v[5][0] =
static_cast<DT
>(
m[30]);
433 this->v[5][1] =
static_cast<DT
>(
m[31]);
434 this->v[5][2] =
static_cast<DT
>(
m[32]);
435 this->v[5][3] =
static_cast<DT
>(
m[33]);
436 this->v[5][4] =
static_cast<DT
>(
m[34]);
437 this->v[5][5] =
static_cast<DT
>(
m[35]);
448 m[0] =
static_cast<float>(this->v[0][0]);
449 m[1] =
static_cast<float>(this->v[0][1]);
450 m[2] =
static_cast<float>(this->v[0][2]);
451 m[3] =
static_cast<float>(this->v[0][3]);
452 m[4] =
static_cast<float>(this->v[0][4]);
453 m[5] =
static_cast<float>(this->v[0][5]);
454 m[6] =
static_cast<float>(this->v[1][0]);
455 m[7] =
static_cast<float>(this->v[1][1]);
456 m[8] =
static_cast<float>(this->v[1][2]);
457 m[9] =
static_cast<float>(this->v[1][3]);
458 m[10] =
static_cast<float>(this->v[1][4]);
459 m[11] =
static_cast<float>(this->v[1][5]);
460 m[12] =
static_cast<float>(this->v[2][0]);
461 m[13] =
static_cast<float>(this->v[2][1]);
462 m[14] =
static_cast<float>(this->v[2][2]);
463 m[15] =
static_cast<float>(this->v[2][3]);
464 m[16] =
static_cast<float>(this->v[2][4]);
465 m[17] =
static_cast<float>(this->v[2][5]);
466 m[18] =
static_cast<float>(this->v[3][0]);
467 m[19] =
static_cast<float>(this->v[3][1]);
468 m[20] =
static_cast<float>(this->v[3][2]);
469 m[21] =
static_cast<float>(this->v[3][3]);
470 m[22] =
static_cast<float>(this->v[3][4]);
471 m[23] =
static_cast<float>(this->v[3][5]);
472 m[24] =
static_cast<float>(this->v[4][0]);
473 m[25] =
static_cast<float>(this->v[4][1]);
474 m[26] =
static_cast<float>(this->v[4][2]);
475 m[27] =
static_cast<float>(this->v[4][3]);
476 m[28] =
static_cast<float>(this->v[4][4]);
477 m[29] =
static_cast<float>(this->v[4][5]);
478 m[30] =
static_cast<float>(this->v[5][0]);
479 m[31] =
static_cast<float>(this->v[5][1]);
480 m[32] =
static_cast<float>(this->v[5][2]);
481 m[33] =
static_cast<float>(this->v[5][3]);
482 m[34] =
static_cast<float>(this->v[5][4]);
483 m[35] =
static_cast<float>(this->v[5][5]);
492 this->v[0][0] =
static_cast<DT
>(
m[0]);
493 this->v[0][1] =
static_cast<DT
>(
m[1]);
494 this->v[0][2] =
static_cast<DT
>(
m[2]);
495 this->v[0][3] =
static_cast<DT
>(
m[3]);
496 this->v[0][4] =
static_cast<DT
>(
m[4]);
497 this->v[0][5] =
static_cast<DT
>(
m[5]);
498 this->v[1][0] =
static_cast<DT
>(
m[6]);
499 this->v[1][1] =
static_cast<DT
>(
m[7]);
500 this->v[1][2] =
static_cast<DT
>(
m[8]);
501 this->v[1][3] =
static_cast<DT
>(
m[9]);
502 this->v[1][4] =
static_cast<DT
>(
m[10]);
503 this->v[1][5] =
static_cast<DT
>(
m[11]);
504 this->v[2][0] =
static_cast<DT
>(
m[12]);
505 this->v[2][1] =
static_cast<DT
>(
m[13]);
506 this->v[2][2] =
static_cast<DT
>(
m[14]);
507 this->v[2][3] =
static_cast<DT
>(
m[15]);
508 this->v[2][4] =
static_cast<DT
>(
m[16]);
509 this->v[2][5] =
static_cast<DT
>(
m[17]);
510 this->v[3][0] =
static_cast<DT
>(
m[18]);
511 this->v[3][1] =
static_cast<DT
>(
m[19]);
512 this->v[3][2] =
static_cast<DT
>(
m[20]);
513 this->v[3][3] =
static_cast<DT
>(
m[21]);
514 this->v[3][4] =
static_cast<DT
>(
m[22]);
515 this->v[3][5] =
static_cast<DT
>(
m[23]);
516 this->v[4][0] =
static_cast<DT
>(
m[24]);
517 this->v[4][1] =
static_cast<DT
>(
m[25]);
518 this->v[4][2] =
static_cast<DT
>(
m[26]);
519 this->v[4][3] =
static_cast<DT
>(
m[27]);
520 this->v[4][4] =
static_cast<DT
>(
m[28]);
521 this->v[4][5] =
static_cast<DT
>(
m[29]);
522 this->v[5][0] =
static_cast<DT
>(
m[30]);
523 this->v[5][1] =
static_cast<DT
>(
m[31]);
524 this->v[5][2] =
static_cast<DT
>(
m[32]);
525 this->v[5][3] =
static_cast<DT
>(
m[33]);
526 this->v[5][4] =
static_cast<DT
>(
m[34]);
527 this->v[5][5] =
static_cast<DT
>(
m[35]);
536 m[0] =
static_cast<double>(this->v[0][0]);
537 m[1] =
static_cast<double>(this->v[0][1]);
538 m[2] =
static_cast<double>(this->v[0][2]);
539 m[3] =
static_cast<double>(this->v[0][3]);
540 m[4] =
static_cast<double>(this->v[0][4]);
541 m[5] =
static_cast<double>(this->v[0][5]);
542 m[6] =
static_cast<double>(this->v[1][0]);
543 m[7] =
static_cast<double>(this->v[1][1]);
544 m[8] =
static_cast<double>(this->v[1][2]);
545 m[9] =
static_cast<double>(this->v[1][3]);
546 m[10] =
static_cast<double>(this->v[1][4]);
547 m[11] =
static_cast<double>(this->v[1][5]);
548 m[12] =
static_cast<double>(this->v[2][0]);
549 m[13] =
static_cast<double>(this->v[2][1]);
550 m[14] =
static_cast<double>(this->v[2][2]);
551 m[15] =
static_cast<double>(this->v[2][3]);
552 m[16] =
static_cast<double>(this->v[2][4]);
553 m[17] =
static_cast<double>(this->v[2][5]);
554 m[18] =
static_cast<double>(this->v[3][0]);
555 m[19] =
static_cast<double>(this->v[3][1]);
556 m[20] =
static_cast<double>(this->v[3][2]);
557 m[21] =
static_cast<double>(this->v[3][3]);
558 m[22] =
static_cast<double>(this->v[3][4]);
559 m[23] =
static_cast<double>(this->v[3][5]);
560 m[24] =
static_cast<double>(this->v[4][0]);
561 m[25] =
static_cast<double>(this->v[4][1]);
562 m[26] =
static_cast<double>(this->v[4][2]);
563 m[27] =
static_cast<double>(this->v[4][3]);
564 m[28] =
static_cast<double>(this->v[4][4]);
565 m[29] =
static_cast<double>(this->v[4][5]);
566 m[30] =
static_cast<double>(this->v[5][0]);
567 m[31] =
static_cast<double>(this->v[5][1]);
568 m[32] =
static_cast<double>(this->v[5][2]);
569 m[33] =
static_cast<double>(this->v[5][3]);
570 m[34] =
static_cast<double>(this->v[5][4]);
571 m[35] =
static_cast<double>(this->v[5][5]);
580 this->v[0][0] = scale;
587 this->v[1][1] = scale;
594 this->v[2][2] = scale;
601 this->v[3][3] = scale;
608 this->v[4][4] = scale;
615 this->v[5][5] = scale;
644 return (this->v[0][0] * determinantLower5(1, 2, 3, 4, 5) - this->v[0][1] * determinantLower5(0, 2, 3, 4, 5) +
645 this->v[0][2] * determinantLower5(0, 1, 3, 4, 5) - this->v[0][3] * determinantLower5(0, 1, 2, 4, 5) +
646 this->v[0][4] * determinantLower5(0, 1, 2, 3, 5) - this->v[0][5] * determinantLower5(0, 1, 2, 3, 4));
661 static const DT
Epsilon =
static_cast<DT
>(10e-12);
665 "Tmat6<DT> Tmat6<DT>::inverse(bool* isInvertible) const, matrix not invertable",
675 return Tmat6<DT>(
Tvec6<DT>(this->v[0][0], this->v[1][0], this->v[2][0], this->v[3][0], this->v[4][0], this->v[5][0]),
676 Tvec6<DT>(this->v[0][1], this->v[1][1], this->v[2][1], this->v[3][1], this->v[4][1], this->v[5][1]),
677 Tvec6<DT>(this->v[0][2], this->v[1][2], this->v[2][2], this->v[3][2], this->v[4][2], this->v[5][2]),
678 Tvec6<DT>(this->v[0][3], this->v[1][3], this->v[2][3], this->v[3][3], this->v[4][3], this->v[5][3]),
679 Tvec6<DT>(this->v[0][4], this->v[1][4], this->v[2][4], this->v[3][4], this->v[4][4], this->v[5][4]),
680 Tvec6<DT>(this->v[0][5], this->v[1][5], this->v[2][5], this->v[3][5], this->v[4][5], this->v[5][5]));
688 return Tmat6<DT>(
Tvec6<DT>(1, 0, 0, 0, 0, 0),
Tvec6<DT>(0, 1, 0, 0, 0, 0),
Tvec6<DT>(0, 0, 1, 0, 0, 0),
689 Tvec6<DT>(0, 0, 0, 1, 0, 0),
Tvec6<DT>(0, 0, 0, 0, 1, 0),
Tvec6<DT>(0, 0, 0, 0, 0, 1));
698 this->v[1].apply(
fct);
699 this->v[2].apply(
fct);
700 this->v[3].apply(
fct);
701 this->v[4].apply(
fct);
702 this->v[5].apply(
fct);
708#define _ML_MAT6_RC(i, j) \
709 a[i][0] * b[0][j] + a[i][1] * b[1][j] + a[i][2] * b[2][j] + a[i][3] * b[3][j] + a[i][4] * b[4][j] + a[i][5] * b[5][j]
735 return (a[0] == b[0]) && (a[1] == b[1]) && (a[2] == b[2]) && (a[3] == b[3]) && (a[4] == b[4]) && (a[5] == b[5]);
747#define _ML_MAT6_RC(i) \
748 a[i][0] * v[0] + a[i][1] * v[1] + a[i][2] * v[2] + a[i][3] * v[3] + a[i][4] * v[4] + a[i][5] * v[5]
791 template <
class DT>
inline std::ostream&
operator<<(std::ostream&
os,
const ML_LA_NAMESPACE::Tmat6<DT>&
m)
793 return os <<
m[0] <<
'\n' <<
m[1] <<
'\n' <<
m[2] <<
'\n' <<
m[3] <<
'\n' <<
m[4] <<
'\n' <<
m[5];
799 template <
class DT>
inline std::istream&
operator>>(std::istream& is, ML_LA_NAMESPACE::Tmat6<DT>&
m)
801 ML_LA_NAMESPACE::Tmat6<DT>
m_tmp;
Base class of all matrix classes that holds the data buffer and provides some general access methods.
VectorT v[size]
The rows constituting the matrix.
A 6x6 matrix class of six row vectors.
Tmat6()
Builds a 6x6 matrix from 36 zero elements.
Tmat6 transpose() const
Returns the transposed of this matrix.
const Tmat6< DT > & operator*=(const DT d)
Multiplies by a scalar constant d.
void setValues(const float m[36])
Copies the contents from float array m into *this.
const Tmat6< DT > & apply(MLDblFuncPtr fct)
Applies the function fct to each component.
static Tmat6< DT > getMat(const double val)
Returns a matrix filled with values val.
Tmat6(const double in00, const double in01, const double in02, const double in03, const double in04, const double in05, const double in10, const double in11, const double in12, const double in13, const double in14, const double in15, const double in20, const double in21, const double in22, const double in23, const double in24, const double in25, const double in30, const double in31, const double in32, const double in33, const double in34, const double in35, const double in40, const double in41, const double in42, const double in43, const double in44, const double in45, const double in50, const double in51, const double in52, const double in53, const double in54, const double in55)
Initializes all matrix elements explicitly with scalars, filling it row by row.
Tmat6(const Tmat6< DT > &m)
Copy constructor from the Tmat6 mat.
void set(const DT val)
Sets all values to val.
void setScaleMatrix(const DT scale)
Sets the diagonal matrix with scale on the diagonal.
bool operator<(const Tmat6< DT > &) const
Dummy 'lesser than operator' that always returns false.
DT determinantLower5(const int col1, const int col2, const int col3, const int col4, const int col5) const
Determines the (sub)determinant of columns given by col1, col2, col3, col4, and col5.
void getValues(float m[36]) const
Copies the contents of *this into float array m.
DT det() const
Returns the determinant of this matrix.
const Tmat6< DT > & operator+=(const Tmat6< DT > &m)
Adds component-wise with a Tmat6.
Tmat6(const double mat[36])
Constructor from 36 doubles given as array mat, read row by row.
Tmat6(const DT diagValue)
Builds a matrix that has the argument diagValue as the diagonal values, zero otherwise.
void getValues(double m[36]) const
Copies the contents of *this into double array m.
const Tmat6< DT > & operator-=(const Tmat6< DT > &m)
Subtracts component-wise by a Tmat6.
Tmat6(const float mat[36])
Constructor from 36 floats given as array mat, read row by row.
DT ComponentType
A typedef to 'export' the type of components.
const Tmat6< DT > & operator=(const Tmat6< DT > &m)
Assigns from a Tmat6.
const Tmat6< DT > & operator/=(const DT d)
Divides by a scalar constant d.
static Tmat6 getIdentity()
Returns the identity matrix.
void setValues(const double m[36])
Copies the contents from double array m into *this.
Tmat6< DT > inverse(bool *isInvertible=nullptr) const
Returns the inverse.
Tmat6(const Tvec6< DT > &row0, const Tvec6< DT > &row1, const Tvec6< DT > &row2, const Tvec6< DT > &row3, const Tvec6< DT > &row4, const Tvec6< DT > &row5)
Builds a matrix of the six row vectors row0, ..., row5.
A six dimensional vector class for floating point types.
bool MLValueIs0WOM(MLint8 a)
Returns true if value is 0; otherwise, it returns false.
#define ML_CHECK_THROW(x)
#define ML_CHECK_FLOAT_THROW(x)
#define _ML_MAT6_RC(i, j)
Internal helper macro to multiply two matrices, do not use.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
double(* MLDblFuncPtr)(double)
A function pointer type to a function that returns a double and takes a double as argument.
FloatingPointVector< T, size, DataContainer > operator/(FloatingPointVector< T, size, DataContainer > lhs, MLdouble rhs)
Component-wise division of lhs by specialized rhs of type MLdouble.
bool operator==(const Tmat2< DT > &a, const Tmat2< DT > &b)
a == b ? Returns true if yes.
T operator*(const FloatingPointVector< T, size, DataContainer > &a, const FloatingPointVector< T, size, DataContainer > &b)
Dot product, returns a.dot(b).
bool operator!=(const Tmat2< DT > &a, const Tmat2< DT > &b)
a != b ? Returns true if yes.
FloatingPointVector< T, size, DataContainer > operator-(FloatingPointVector< T, size, DataContainer > lhs, const FloatingPointVector< T, size, DataContainer > &rhs)
Return value is the component-wise subtraction of rhs from lhs.
BASE_TYPE MLInverseMatHelper(const BASE_TYPE &origMat, bool *isInvertible, const typename BASE_TYPE::ComponentType, const char *const ZeroDetErrString, const BASE_TYPE &Identity, const size_t Dim)
Computes an N dimensional inverse from given default parameters.
MLEXPORT std::ostream & operator<<(std::ostream &s, const ml::Field &v)
Overloads the operator '<<' for stream output of Field objects.
istream & operator>>(istream &is, ml::FloatingPointVector< T, size, DataContainer > &v)
Reads a vector from std::istream.