|
@@ -112,10 +112,7 @@ FLOATNAME(LMatrix3)() {
|
|
|
// Description:
|
|
// Description:
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::
|
|
|
-FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) ©) {
|
|
|
|
|
- TAU_PROFILE("LMatrix3::LMatrix3(const LMatrix3 &)", " ", TAU_USER);
|
|
|
|
|
-
|
|
|
|
|
- memcpy(_m.data, copy._m.data, sizeof(_m.data));
|
|
|
|
|
|
|
+FLOATNAME(LMatrix3)(const FLOATNAME(LMatrix3) ©) : _m(copy._m) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -127,7 +124,7 @@ INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
|
operator = (const FLOATNAME(LMatrix3) ©) {
|
|
operator = (const FLOATNAME(LMatrix3) ©) {
|
|
|
TAU_PROFILE("void LMatrix3::operator = (const LMatrix3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("void LMatrix3::operator = (const LMatrix3 &)", " ", TAU_USER);
|
|
|
|
|
|
|
|
- memcpy(_m.data, copy._m.data, sizeof(_m.data));
|
|
|
|
|
|
|
+ _m = copy._m;
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -152,15 +149,15 @@ FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
|
|
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
|
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
|
|
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
|
|
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
|
|
|
TAU_PROFILE("LMatrix3::LMatrix3(FLOATTYPE, ...)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3::LMatrix3(FLOATTYPE, ...)", " ", TAU_USER);
|
|
|
- _m.m._00 = e00;
|
|
|
|
|
- _m.m._01 = e01;
|
|
|
|
|
- _m.m._02 = e02;
|
|
|
|
|
- _m.m._10 = e10;
|
|
|
|
|
- _m.m._11 = e11;
|
|
|
|
|
- _m.m._12 = e12;
|
|
|
|
|
- _m.m._20 = e20;
|
|
|
|
|
- _m.m._21 = e21;
|
|
|
|
|
- _m.m._22 = e22;
|
|
|
|
|
|
|
+ _m(0, 0) = e00;
|
|
|
|
|
+ _m(0, 1) = e01;
|
|
|
|
|
+ _m(0, 2) = e02;
|
|
|
|
|
+ _m(1, 0) = e10;
|
|
|
|
|
+ _m(1, 1) = e11;
|
|
|
|
|
+ _m(1, 2) = e12;
|
|
|
|
|
+ _m(2, 0) = e20;
|
|
|
|
|
+ _m(2, 1) = e21;
|
|
|
|
|
+ _m(2, 2) = e22;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -173,15 +170,15 @@ set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
|
|
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
|
FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12,
|
|
|
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
|
|
FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22) {
|
|
|
TAU_PROFILE("void LMatrix3::set(FLOATTYPE, ...)", " ", TAU_USER);
|
|
TAU_PROFILE("void LMatrix3::set(FLOATTYPE, ...)", " ", TAU_USER);
|
|
|
- _m.m._00 = e00;
|
|
|
|
|
- _m.m._01 = e01;
|
|
|
|
|
- _m.m._02 = e02;
|
|
|
|
|
- _m.m._10 = e10;
|
|
|
|
|
- _m.m._11 = e11;
|
|
|
|
|
- _m.m._12 = e12;
|
|
|
|
|
- _m.m._20 = e20;
|
|
|
|
|
- _m.m._21 = e21;
|
|
|
|
|
- _m.m._22 = e22;
|
|
|
|
|
|
|
+ _m(0, 0) = e00;
|
|
|
|
|
+ _m(0, 1) = e01;
|
|
|
|
|
+ _m(0, 2) = e02;
|
|
|
|
|
+ _m(1, 0) = e10;
|
|
|
|
|
+ _m(1, 1) = e11;
|
|
|
|
|
+ _m(1, 2) = e12;
|
|
|
|
|
+ _m(2, 0) = e20;
|
|
|
|
|
+ _m(2, 1) = e21;
|
|
|
|
|
+ _m(2, 2) = e22;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -192,9 +189,13 @@ set(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_row(int row, const FLOATNAME(LVecBase3) &v) {
|
|
set_row(int row, const FLOATNAME(LVecBase3) &v) {
|
|
|
- (*this)(row, 0) = v._v.v._0;
|
|
|
|
|
- (*this)(row, 1) = v._v.v._1;
|
|
|
|
|
- (*this)(row, 2) = v._v.v._2;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ _m.row(row) = v._v;
|
|
|
|
|
+#else
|
|
|
|
|
+ (*this)(row, 0) = v._v(0);
|
|
|
|
|
+ (*this)(row, 1) = v._v(1);
|
|
|
|
|
+ (*this)(row, 2) = v._v(2);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -205,9 +206,13 @@ set_row(int row, const FLOATNAME(LVecBase3) &v) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_col(int col, const FLOATNAME(LVecBase3) &v) {
|
|
set_col(int col, const FLOATNAME(LVecBase3) &v) {
|
|
|
- (*this)(0, col) = v._v.v._0;
|
|
|
|
|
- (*this)(1, col) = v._v.v._1;
|
|
|
|
|
- (*this)(2, col) = v._v.v._2;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ _m.col(col) = v._v;
|
|
|
|
|
+#else
|
|
|
|
|
+ (*this)(0, col) = v._v(0);
|
|
|
|
|
+ (*this)(1, col) = v._v(1);
|
|
|
|
|
+ (*this)(2, col) = v._v(2);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -218,8 +223,12 @@ set_col(int col, const FLOATNAME(LVecBase3) &v) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_row(int row, const FLOATNAME(LVecBase2) &v) {
|
|
set_row(int row, const FLOATNAME(LVecBase2) &v) {
|
|
|
- (*this)(row, 0) = v._v.v._0;
|
|
|
|
|
- (*this)(row, 1) = v._v.v._1;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ _m.block<1, 2>(row, 0) = v._v;
|
|
|
|
|
+#else
|
|
|
|
|
+ (*this)(row, 0) = v._v(0);
|
|
|
|
|
+ (*this)(row, 1) = v._v(1);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -230,8 +239,12 @@ set_row(int row, const FLOATNAME(LVecBase2) &v) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_col(int col, const FLOATNAME(LVecBase2) &v) {
|
|
set_col(int col, const FLOATNAME(LVecBase2) &v) {
|
|
|
- (*this)(0, col) = v._v.v._0;
|
|
|
|
|
- (*this)(1, col) = v._v.v._1;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ _m.block<2, 1>(0, col) = v._v;
|
|
|
|
|
+#else
|
|
|
|
|
+ (*this)(0, col) = v._v(0);
|
|
|
|
|
+ (*this)(1, col) = v._v(1);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -242,14 +255,28 @@ set_col(int col, const FLOATNAME(LVecBase2) &v) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
|
get_row(int row) const {
|
|
get_row(int row) const {
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ return FLOATNAME(LVecBase3)(_m.row(row));
|
|
|
|
|
+#else
|
|
|
return FLOATNAME(LVecBase3)((*this)(row, 0), (*this)(row, 1), (*this)(row, 2));
|
|
return FLOATNAME(LVecBase3)((*this)(row, 0), (*this)(row, 1), (*this)(row, 2));
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
|
|
+// Function: LMatrix3::get_row
|
|
|
|
|
+// Access: Published
|
|
|
|
|
+// Description: Stores the indicated row of the matrix as a
|
|
|
|
|
+// three-component vector.
|
|
|
|
|
+////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
get_row(FLOATNAME(LVecBase3) &result_vec,int row) const {
|
|
get_row(FLOATNAME(LVecBase3) &result_vec,int row) const {
|
|
|
- result_vec._v.v._0 = (*this)(row, 0);
|
|
|
|
|
- result_vec._v.v._1 = (*this)(row, 1);
|
|
|
|
|
- result_vec._v.v._2 = (*this)(row, 2);
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ result_vec._v = _m.row(row);
|
|
|
|
|
+#else
|
|
|
|
|
+ result_vec._v(0) = (*this)(row, 0);
|
|
|
|
|
+ result_vec._v(1) = (*this)(row, 1);
|
|
|
|
|
+ result_vec._v(2) = (*this)(row, 2);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -260,7 +287,11 @@ get_row(FLOATNAME(LVecBase3) &result_vec,int row) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
|
get_col(int col) const {
|
|
get_col(int col) const {
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ return FLOATNAME(LVecBase3)(_m.col(col));
|
|
|
|
|
+#else
|
|
|
return FLOATNAME(LVecBase3)((*this)(0, col), (*this)(1, col), (*this)(2, col));
|
|
return FLOATNAME(LVecBase3)((*this)(0, col), (*this)(1, col), (*this)(2, col));
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -292,8 +323,8 @@ get_col2(int col) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATTYPE &FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATTYPE &FLOATNAME(LMatrix3)::
|
|
|
operator () (int row, int col) {
|
|
operator () (int row, int col) {
|
|
|
- nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, _m.data[0]);
|
|
|
|
|
- return _m.data[row * 3 + col];
|
|
|
|
|
|
|
+ nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, _m(0, 0));
|
|
|
|
|
+ return _m(row, col);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -304,7 +335,7 @@ operator () (int row, int col) {
|
|
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
|
operator () (int row, int col) const {
|
|
operator () (int row, int col) const {
|
|
|
nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, 0.0);
|
|
nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, 0.0);
|
|
|
- return _m.data[row * 3 + col];
|
|
|
|
|
|
|
+ return _m(row, col);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -314,8 +345,8 @@ operator () (int row, int col) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::CRow FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::CRow FLOATNAME(LMatrix3)::
|
|
|
operator [](int i) const {
|
|
operator [](int i) const {
|
|
|
- nassertr(i >= 0 && i < 3, CRow(&_m.data[0]));
|
|
|
|
|
- return CRow(&_m.data[i * 3]);
|
|
|
|
|
|
|
+ nassertr(i >= 0 && i < 3, CRow(&_m(0, 0)));
|
|
|
|
|
+ return CRow(&_m(i, 0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -325,8 +356,8 @@ operator [](int i) const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::Row FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::Row FLOATNAME(LMatrix3)::
|
|
|
operator [](int i) {
|
|
operator [](int i) {
|
|
|
- nassertr(i >= 0 && i < 3, Row(&_m.data[0]));
|
|
|
|
|
- return Row(&_m.data[i * 3]);
|
|
|
|
|
|
|
+ nassertr(i >= 0 && i < 3, Row(&_m(0, 0)));
|
|
|
|
|
+ return Row(&_m(i, 0));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -349,9 +380,9 @@ INLINE_LINMATH bool FLOATNAME(LMatrix3)::
|
|
|
is_nan() const {
|
|
is_nan() const {
|
|
|
TAU_PROFILE("bool LMatrix3::is_nan()", " ", TAU_USER);
|
|
TAU_PROFILE("bool LMatrix3::is_nan()", " ", TAU_USER);
|
|
|
return
|
|
return
|
|
|
- cnan(_m.data[0]) || cnan(_m.data[1]) || cnan(_m.data[2]) ||
|
|
|
|
|
- cnan(_m.data[3]) || cnan(_m.data[4]) || cnan(_m.data[5]) ||
|
|
|
|
|
- cnan(_m.data[6]) || cnan(_m.data[7]) || cnan(_m.data[8]);
|
|
|
|
|
|
|
+ cnan(_m(0, 0)) || cnan(_m(0, 1)) || cnan(_m(0, 2)) ||
|
|
|
|
|
+ cnan(_m(1, 0)) || cnan(_m(1, 1)) || cnan(_m(1, 2)) ||
|
|
|
|
|
+ cnan(_m(2, 0)) || cnan(_m(2, 1)) || cnan(_m(2, 2));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -362,7 +393,7 @@ is_nan() const {
|
|
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
|
get_cell(int row, int col) const {
|
|
get_cell(int row, int col) const {
|
|
|
nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, 0.0);
|
|
nassertr(row >= 0 && row < 3 && col >= 0 && col < 3, 0.0);
|
|
|
- return _m.data[row * 3 + col];
|
|
|
|
|
|
|
+ return _m(row, col);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -373,7 +404,7 @@ get_cell(int row, int col) const {
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_cell(int row, int col, FLOATTYPE value) {
|
|
set_cell(int row, int col, FLOATTYPE value) {
|
|
|
nassertv(row >= 0 && row < 3 && col >= 0 && col < 3);
|
|
nassertv(row >= 0 && row < 3 && col >= 0 && col < 3);
|
|
|
- _m.data[row * 3 + col] = value;
|
|
|
|
|
|
|
+ _m(row, col) = value;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -385,7 +416,7 @@ set_cell(int row, int col, FLOATTYPE value) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH const FLOATTYPE *FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH const FLOATTYPE *FLOATNAME(LMatrix3)::
|
|
|
get_data() const {
|
|
get_data() const {
|
|
|
- return _m.data;
|
|
|
|
|
|
|
+ return &_m(0, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -406,7 +437,7 @@ get_num_components() const {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::iterator FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::iterator FLOATNAME(LMatrix3)::
|
|
|
begin() {
|
|
begin() {
|
|
|
- return _m.data;
|
|
|
|
|
|
|
+ return &_m(0, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -428,7 +459,7 @@ end() {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::const_iterator FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3)::const_iterator FLOATNAME(LMatrix3)::
|
|
|
begin() const {
|
|
begin() const {
|
|
|
- return _m.data;
|
|
|
|
|
|
|
+ return &_m(0, 0);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -527,25 +558,25 @@ add_hash(size_t hash, FLOATTYPE threshold) const {
|
|
|
TAU_PROFILE("size_t LMatrix3::add_hash(size_t, FLOATTYPE)", " ", TAU_USER);
|
|
TAU_PROFILE("size_t LMatrix3::add_hash(size_t, FLOATTYPE)", " ", TAU_USER);
|
|
|
float_hash fhasher(threshold);
|
|
float_hash fhasher(threshold);
|
|
|
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._00);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._01);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._02);
|
|
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(0, 0));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(0, 1));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(0, 2));
|
|
|
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._10);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._11);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._12);
|
|
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(1, 0));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(1, 1));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(1, 2));
|
|
|
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._20);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._21);
|
|
|
|
|
- hash = fhasher.add_hash(hash, _m.m._22);
|
|
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(2, 0));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(2, 1));
|
|
|
|
|
+ hash = fhasher.add_hash(hash, _m(2, 2));
|
|
|
|
|
|
|
|
return hash;
|
|
return hash;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#define VECTOR3_MATRIX3_PRODUCT(v_res, v, mat) \
|
|
#define VECTOR3_MATRIX3_PRODUCT(v_res, v, mat) \
|
|
|
-v_res._v.v._0 = v._v.v._0*mat._m.m._00 + v._v.v._1*mat._m.m._10 + v._v.v._2*mat._m.m._20; \
|
|
|
|
|
-v_res._v.v._1 = v._v.v._0*mat._m.m._01 + v._v.v._1*mat._m.m._11 + v._v.v._2*mat._m.m._21; \
|
|
|
|
|
-v_res._v.v._2 = v._v.v._0*mat._m.m._02 + v._v.v._1*mat._m.m._12 + v._v.v._2*mat._m.m._22;
|
|
|
|
|
|
|
+v_res._v(0) = v._v(0)*mat._m(0, 0) + v._v(1)*mat._m(1, 0) + v._v(2)*mat._m(2, 0); \
|
|
|
|
|
+v_res._v(1) = v._v(0)*mat._m(0, 1) + v._v(1)*mat._m(1, 1) + v._v(2)*mat._m(2, 1); \
|
|
|
|
|
+v_res._v(2) = v._v(0)*mat._m(0, 2) + v._v(1)*mat._m(1, 2) + v._v(2)*mat._m(2, 2);
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: LMatrix3::xform
|
|
// Function: LMatrix3::xform
|
|
@@ -556,7 +587,11 @@ INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
|
xform(const FLOATNAME(LVecBase3) &v) const {
|
|
xform(const FLOATNAME(LVecBase3) &v) const {
|
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform(const LVecBase3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform(const LVecBase3 &)", " ", TAU_USER);
|
|
|
FLOATNAME(LVecBase3) v_res;
|
|
FLOATNAME(LVecBase3) v_res;
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ v_res._v.noalias() = v._v * _m;
|
|
|
|
|
+#else
|
|
|
VECTOR3_MATRIX3_PRODUCT(v_res, v,(*this));
|
|
VECTOR3_MATRIX3_PRODUCT(v_res, v,(*this));
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
|
|
|
|
|
return v_res;
|
|
return v_res;
|
|
|
}
|
|
}
|
|
@@ -573,10 +608,14 @@ xform_point(const FLOATNAME(LVecBase2) &v) const {
|
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_point(const LVecBase3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_point(const LVecBase3 &)", " ", TAU_USER);
|
|
|
FLOATNAME(LVecBase2) v_res;
|
|
FLOATNAME(LVecBase2) v_res;
|
|
|
|
|
|
|
|
- // v._v.v._2 == 1.0f for this case
|
|
|
|
|
|
|
+ // v._v(2) == 1.0f for this case
|
|
|
|
|
|
|
|
- v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + _m.m._20;
|
|
|
|
|
- v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + _m.m._21;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ v_res._v.noalias() = v._v * _m.block<2, 2>(0, 0) + _m.block<1, 2>(2, 0);
|
|
|
|
|
+#else
|
|
|
|
|
+ v_res._v(0) = v._v(0)*_m(0, 0) + v._v(1)*_m(1, 0) + _m(2, 0);
|
|
|
|
|
+ v_res._v(1) = v._v(0)*_m(0, 1) + v._v(1)*_m(1, 1) + _m(2, 1);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
|
|
|
|
|
return v_res;
|
|
return v_res;
|
|
|
}
|
|
}
|
|
@@ -594,15 +633,16 @@ xform_vec(const FLOATNAME(LVecBase2) &v) const {
|
|
|
|
|
|
|
|
FLOATNAME(LVecBase2) v_res;
|
|
FLOATNAME(LVecBase2) v_res;
|
|
|
|
|
|
|
|
- // v._v.v._2 == 0.0f for this case
|
|
|
|
|
|
|
+ // v._v(2) == 0.0f for this case
|
|
|
|
|
|
|
|
- v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10;
|
|
|
|
|
- v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11;
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ v_res._v.noalias() = v._v * _m.block<2, 2>(0, 0);
|
|
|
|
|
+#else
|
|
|
|
|
+ v_res._v(0) = v._v(0)*_m(0, 0) + v._v(1)*_m(1, 0);
|
|
|
|
|
+ v_res._v(1) = v._v(0)*_m(0, 1) + v._v(1)*_m(1, 1);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
|
|
|
|
|
return v_res;
|
|
return v_res;
|
|
|
-
|
|
|
|
|
-// return FLOATNAME(LVecBase2)(v.dot(get_col2(0)),
|
|
|
|
|
-// v.dot(get_col2(1)));
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -617,15 +657,7 @@ xform_vec(const FLOATNAME(LVecBase2) &v) const {
|
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
|
xform_vec(const FLOATNAME(LVecBase3) &v) const {
|
|
xform_vec(const FLOATNAME(LVecBase3) &v) const {
|
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_vec(const LVecBase3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_vec(const LVecBase3 &)", " ", TAU_USER);
|
|
|
- FLOATNAME(LVecBase3) v_res;
|
|
|
|
|
-
|
|
|
|
|
- // v._v.v._3 == 0.0f for this case
|
|
|
|
|
-
|
|
|
|
|
- v_res._v.v._0 = v._v.v._0*_m.m._00 + v._v.v._1*_m.m._10 + v._v.v._2*_m.m._20;
|
|
|
|
|
- v_res._v.v._1 = v._v.v._0*_m.m._01 + v._v.v._1*_m.m._11 + v._v.v._2*_m.m._21;
|
|
|
|
|
- v_res._v.v._2 = v._v.v._0*_m.m._02 + v._v.v._1*_m.m._12 + v._v.v._2*_m.m._22;
|
|
|
|
|
-
|
|
|
|
|
- return v_res;
|
|
|
|
|
|
|
+ return xform(v);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -638,34 +670,26 @@ xform_vec(const FLOATNAME(LVecBase3) &v) const {
|
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LVecBase3) FLOATNAME(LMatrix3)::
|
|
|
xform_vec_general(const FLOATNAME(LVecBase3) &v) const {
|
|
xform_vec_general(const FLOATNAME(LVecBase3) &v) const {
|
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_vec_general(const LVecBase3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LVecBase3 LMatrix3::xform_vec_general(const LVecBase3 &)", " ", TAU_USER);
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ return FLOATNAME(LVecBase3)(v._v * _m.inverse().transpose());
|
|
|
|
|
+#else
|
|
|
FLOATNAME(LMatrix3) i;
|
|
FLOATNAME(LMatrix3) i;
|
|
|
i.invert_transpose_from(*this);
|
|
i.invert_transpose_from(*this);
|
|
|
|
|
|
|
|
return i.xform(v);
|
|
return i.xform(v);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: LMatrix3::mult_cel
|
|
|
|
|
-// Access: Private
|
|
|
|
|
-// Description: Returns one cell of the result of a matrix-matrix
|
|
|
|
|
-// multiplication operation.
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
|
|
|
-mult_cel(const FLOATNAME(LMatrix3) &other, int row, int col) const {
|
|
|
|
|
- return get_row(row).dot(other.get_col(col));
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
#define MATRIX3_PRODUCT(res, a, b) \
|
|
#define MATRIX3_PRODUCT(res, a, b) \
|
|
|
-res._m.m._00 = a._m.m._00*b._m.m._00 + a._m.m._01*b._m.m._10 + a._m.m._02*b._m.m._20; \
|
|
|
|
|
-res._m.m._01 = a._m.m._00*b._m.m._01 + a._m.m._01*b._m.m._11 + a._m.m._02*b._m.m._21; \
|
|
|
|
|
-res._m.m._02 = a._m.m._00*b._m.m._02 + a._m.m._01*b._m.m._12 + a._m.m._02*b._m.m._22; \
|
|
|
|
|
-res._m.m._10 = a._m.m._10*b._m.m._00 + a._m.m._11*b._m.m._10 + a._m.m._12*b._m.m._20; \
|
|
|
|
|
-res._m.m._11 = a._m.m._10*b._m.m._01 + a._m.m._11*b._m.m._11 + a._m.m._12*b._m.m._21; \
|
|
|
|
|
-res._m.m._12 = a._m.m._10*b._m.m._02 + a._m.m._11*b._m.m._12 + a._m.m._12*b._m.m._22; \
|
|
|
|
|
-res._m.m._20 = a._m.m._20*b._m.m._00 + a._m.m._21*b._m.m._10 + a._m.m._22*b._m.m._20; \
|
|
|
|
|
-res._m.m._21 = a._m.m._20*b._m.m._01 + a._m.m._21*b._m.m._11 + a._m.m._22*b._m.m._21; \
|
|
|
|
|
-res._m.m._22 = a._m.m._20*b._m.m._02 + a._m.m._21*b._m.m._12 + a._m.m._22*b._m.m._22;
|
|
|
|
|
|
|
+res._m(0, 0) = a._m(0, 0)*b._m(0, 0) + a._m(0, 1)*b._m(1, 0) + a._m(0, 2)*b._m(2, 0); \
|
|
|
|
|
+res._m(0, 1) = a._m(0, 0)*b._m(0, 1) + a._m(0, 1)*b._m(1, 1) + a._m(0, 2)*b._m(2, 1); \
|
|
|
|
|
+res._m(0, 2) = a._m(0, 0)*b._m(0, 2) + a._m(0, 1)*b._m(1, 2) + a._m(0, 2)*b._m(2, 2); \
|
|
|
|
|
+res._m(1, 0) = a._m(1, 0)*b._m(0, 0) + a._m(1, 1)*b._m(1, 0) + a._m(1, 2)*b._m(2, 0); \
|
|
|
|
|
+res._m(1, 1) = a._m(1, 0)*b._m(0, 1) + a._m(1, 1)*b._m(1, 1) + a._m(1, 2)*b._m(2, 1); \
|
|
|
|
|
+res._m(1, 2) = a._m(1, 0)*b._m(0, 2) + a._m(1, 1)*b._m(1, 2) + a._m(1, 2)*b._m(2, 2); \
|
|
|
|
|
+res._m(2, 0) = a._m(2, 0)*b._m(0, 0) + a._m(2, 1)*b._m(1, 0) + a._m(2, 2)*b._m(2, 0); \
|
|
|
|
|
+res._m(2, 1) = a._m(2, 0)*b._m(0, 1) + a._m(2, 1)*b._m(1, 1) + a._m(2, 2)*b._m(2, 1); \
|
|
|
|
|
+res._m(2, 2) = a._m(2, 0)*b._m(0, 2) + a._m(2, 1)*b._m(1, 2) + a._m(2, 2)*b._m(2, 2);
|
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -703,17 +727,17 @@ operator * (FLOATTYPE scalar) const {
|
|
|
TAU_PROFILE("LMatrix3 operator *(const LMatrix3 &, FLOATTYPE)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 operator *(const LMatrix3 &, FLOATTYPE)", " ", TAU_USER);
|
|
|
FLOATNAME(LMatrix3) t;
|
|
FLOATNAME(LMatrix3) t;
|
|
|
|
|
|
|
|
- t._m.m._00 = _m.m._00 * scalar;
|
|
|
|
|
- t._m.m._01 = _m.m._01 * scalar;
|
|
|
|
|
- t._m.m._02 = _m.m._02 * scalar;
|
|
|
|
|
|
|
+ t._m(0, 0) = _m(0, 0) * scalar;
|
|
|
|
|
+ t._m(0, 1) = _m(0, 1) * scalar;
|
|
|
|
|
+ t._m(0, 2) = _m(0, 2) * scalar;
|
|
|
|
|
|
|
|
- t._m.m._10 = _m.m._10 * scalar;
|
|
|
|
|
- t._m.m._11 = _m.m._11 * scalar;
|
|
|
|
|
- t._m.m._12 = _m.m._12 * scalar;
|
|
|
|
|
|
|
+ t._m(1, 0) = _m(1, 0) * scalar;
|
|
|
|
|
+ t._m(1, 1) = _m(1, 1) * scalar;
|
|
|
|
|
+ t._m(1, 2) = _m(1, 2) * scalar;
|
|
|
|
|
|
|
|
- t._m.m._20 = _m.m._20 * scalar;
|
|
|
|
|
- t._m.m._21 = _m.m._21 * scalar;
|
|
|
|
|
- t._m.m._22 = _m.m._22 * scalar;
|
|
|
|
|
|
|
+ t._m(2, 0) = _m(2, 0) * scalar;
|
|
|
|
|
+ t._m(2, 1) = _m(2, 1) * scalar;
|
|
|
|
|
+ t._m(2, 2) = _m(2, 2) * scalar;
|
|
|
|
|
|
|
|
return t;
|
|
return t;
|
|
|
}
|
|
}
|
|
@@ -737,17 +761,17 @@ operator / (FLOATTYPE scalar) const {
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
|
operator += (const FLOATNAME(LMatrix3) &other) {
|
|
operator += (const FLOATNAME(LMatrix3) &other) {
|
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator +=(const LMatrix3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator +=(const LMatrix3 &)", " ", TAU_USER);
|
|
|
- _m.m._00 += other._m.m._00;
|
|
|
|
|
- _m.m._01 += other._m.m._01;
|
|
|
|
|
- _m.m._02 += other._m.m._02;
|
|
|
|
|
|
|
+ _m(0, 0) += other._m(0, 0);
|
|
|
|
|
+ _m(0, 1) += other._m(0, 1);
|
|
|
|
|
+ _m(0, 2) += other._m(0, 2);
|
|
|
|
|
|
|
|
- _m.m._10 += other._m.m._10;
|
|
|
|
|
- _m.m._11 += other._m.m._11;
|
|
|
|
|
- _m.m._12 += other._m.m._12;
|
|
|
|
|
|
|
+ _m(1, 0) += other._m(1, 0);
|
|
|
|
|
+ _m(1, 1) += other._m(1, 1);
|
|
|
|
|
+ _m(1, 2) += other._m(1, 2);
|
|
|
|
|
|
|
|
- _m.m._20 += other._m.m._20;
|
|
|
|
|
- _m.m._21 += other._m.m._21;
|
|
|
|
|
- _m.m._22 += other._m.m._22;
|
|
|
|
|
|
|
+ _m(2, 0) += other._m(2, 0);
|
|
|
|
|
+ _m(2, 1) += other._m(2, 1);
|
|
|
|
|
+ _m(2, 2) += other._m(2, 2);
|
|
|
|
|
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
@@ -760,17 +784,17 @@ operator += (const FLOATNAME(LMatrix3) &other) {
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
|
operator -= (const FLOATNAME(LMatrix3) &other) {
|
|
operator -= (const FLOATNAME(LMatrix3) &other) {
|
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator -=(const LMatrix3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator -=(const LMatrix3 &)", " ", TAU_USER);
|
|
|
- _m.m._00 -= other._m.m._00;
|
|
|
|
|
- _m.m._01 -= other._m.m._01;
|
|
|
|
|
- _m.m._02 -= other._m.m._02;
|
|
|
|
|
|
|
+ _m(0, 0) -= other._m(0, 0);
|
|
|
|
|
+ _m(0, 1) -= other._m(0, 1);
|
|
|
|
|
+ _m(0, 2) -= other._m(0, 2);
|
|
|
|
|
|
|
|
- _m.m._10 -= other._m.m._10;
|
|
|
|
|
- _m.m._11 -= other._m.m._11;
|
|
|
|
|
- _m.m._12 -= other._m.m._12;
|
|
|
|
|
|
|
+ _m(1, 0) -= other._m(1, 0);
|
|
|
|
|
+ _m(1, 1) -= other._m(1, 1);
|
|
|
|
|
+ _m(1, 2) -= other._m(1, 2);
|
|
|
|
|
|
|
|
- _m.m._20 -= other._m.m._20;
|
|
|
|
|
- _m.m._21 -= other._m.m._21;
|
|
|
|
|
- _m.m._22 -= other._m.m._22;
|
|
|
|
|
|
|
+ _m(2, 0) -= other._m(2, 0);
|
|
|
|
|
+ _m(2, 1) -= other._m(2, 1);
|
|
|
|
|
+ _m(2, 2) -= other._m(2, 2);
|
|
|
|
|
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
@@ -797,17 +821,17 @@ operator *= (const FLOATNAME(LMatrix3) &other) {
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
|
operator *= (FLOATTYPE scalar) {
|
|
operator *= (FLOATTYPE scalar) {
|
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator *=(FLOATTYPE)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator *=(FLOATTYPE)", " ", TAU_USER);
|
|
|
- _m.m._00 *= scalar;
|
|
|
|
|
- _m.m._01 *= scalar;
|
|
|
|
|
- _m.m._02 *= scalar;
|
|
|
|
|
|
|
+ _m(0, 0) *= scalar;
|
|
|
|
|
+ _m(0, 1) *= scalar;
|
|
|
|
|
+ _m(0, 2) *= scalar;
|
|
|
|
|
|
|
|
- _m.m._10 *= scalar;
|
|
|
|
|
- _m.m._11 *= scalar;
|
|
|
|
|
- _m.m._12 *= scalar;
|
|
|
|
|
|
|
+ _m(1, 0) *= scalar;
|
|
|
|
|
+ _m(1, 1) *= scalar;
|
|
|
|
|
+ _m(1, 2) *= scalar;
|
|
|
|
|
|
|
|
- _m.m._20 *= scalar;
|
|
|
|
|
- _m.m._21 *= scalar;
|
|
|
|
|
- _m.m._22 *= scalar;
|
|
|
|
|
|
|
+ _m(2, 0) *= scalar;
|
|
|
|
|
+ _m(2, 1) *= scalar;
|
|
|
|
|
+ _m(2, 2) *= scalar;
|
|
|
|
|
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
@@ -821,17 +845,17 @@ INLINE_LINMATH FLOATNAME(LMatrix3) &FLOATNAME(LMatrix3)::
|
|
|
operator /= (FLOATTYPE scalar) {
|
|
operator /= (FLOATTYPE scalar) {
|
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator /=(FLOATTYPE)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 LMatrix3::operator /=(FLOATTYPE)", " ", TAU_USER);
|
|
|
FLOATTYPE recip_scalar = 1.0f/scalar;
|
|
FLOATTYPE recip_scalar = 1.0f/scalar;
|
|
|
- _m.m._00 *= recip_scalar;
|
|
|
|
|
- _m.m._01 *= recip_scalar;
|
|
|
|
|
- _m.m._02 *= recip_scalar;
|
|
|
|
|
|
|
+ _m(0, 0) *= recip_scalar;
|
|
|
|
|
+ _m(0, 1) *= recip_scalar;
|
|
|
|
|
+ _m(0, 2) *= recip_scalar;
|
|
|
|
|
|
|
|
- _m.m._10 *= recip_scalar;
|
|
|
|
|
- _m.m._11 *= recip_scalar;
|
|
|
|
|
- _m.m._12 *= recip_scalar;
|
|
|
|
|
|
|
+ _m(1, 0) *= recip_scalar;
|
|
|
|
|
+ _m(1, 1) *= recip_scalar;
|
|
|
|
|
+ _m(1, 2) *= recip_scalar;
|
|
|
|
|
|
|
|
- _m.m._20 *= recip_scalar;
|
|
|
|
|
- _m.m._21 *= recip_scalar;
|
|
|
|
|
- _m.m._22 *= recip_scalar;
|
|
|
|
|
|
|
+ _m(2, 0) *= recip_scalar;
|
|
|
|
|
+ _m(2, 1) *= recip_scalar;
|
|
|
|
|
+ _m(2, 2) *= recip_scalar;
|
|
|
|
|
|
|
|
return *this;
|
|
return *this;
|
|
|
}
|
|
}
|
|
@@ -844,17 +868,17 @@ operator /= (FLOATTYPE scalar) {
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
transpose_from(const FLOATNAME(LMatrix3) &other) {
|
|
transpose_from(const FLOATNAME(LMatrix3) &other) {
|
|
|
TAU_PROFILE("LMatrix3 LMatrix3::transpose_from(const LMatrix3 &other)", " ", TAU_USER);
|
|
TAU_PROFILE("LMatrix3 LMatrix3::transpose_from(const LMatrix3 &other)", " ", TAU_USER);
|
|
|
- _m.m._00 = other._m.m._00;
|
|
|
|
|
- _m.m._01 = other._m.m._10;
|
|
|
|
|
- _m.m._02 = other._m.m._20;
|
|
|
|
|
|
|
+ _m(0, 0) = other._m(0, 0);
|
|
|
|
|
+ _m(0, 1) = other._m(1, 0);
|
|
|
|
|
+ _m(0, 2) = other._m(2, 0);
|
|
|
|
|
|
|
|
- _m.m._10 = other._m.m._01;
|
|
|
|
|
- _m.m._11 = other._m.m._11;
|
|
|
|
|
- _m.m._12 = other._m.m._21;
|
|
|
|
|
|
|
+ _m(1, 0) = other._m(0, 1);
|
|
|
|
|
+ _m(1, 1) = other._m(1, 1);
|
|
|
|
|
+ _m(1, 2) = other._m(2, 1);
|
|
|
|
|
|
|
|
- _m.m._20 = other._m.m._02;
|
|
|
|
|
- _m.m._21 = other._m.m._12;
|
|
|
|
|
- _m.m._22 = other._m.m._22;
|
|
|
|
|
|
|
+ _m(2, 0) = other._m(0, 2);
|
|
|
|
|
+ _m(2, 1) = other._m(1, 2);
|
|
|
|
|
+ _m(2, 2) = other._m(2, 2);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -868,9 +892,9 @@ transpose_in_place() {
|
|
|
TAU_PROFILE("void LMatrix3::transpose_in_place()", " ", TAU_USER);
|
|
TAU_PROFILE("void LMatrix3::transpose_in_place()", " ", TAU_USER);
|
|
|
|
|
|
|
|
#define SWAP__(x,y) { FLOATTYPE temp = (x); (x) = (y); (y) = temp;}
|
|
#define SWAP__(x,y) { FLOATTYPE temp = (x); (x) = (y); (y) = temp;}
|
|
|
- SWAP__(_m.m._01,_m.m._10);
|
|
|
|
|
- SWAP__(_m.m._02,_m.m._20);
|
|
|
|
|
- SWAP__(_m.m._12,_m.m._21);
|
|
|
|
|
|
|
+ SWAP__(_m(0, 1),_m(1, 0));
|
|
|
|
|
+ SWAP__(_m(0, 2),_m(2, 0));
|
|
|
|
|
+ SWAP__(_m(1, 2),_m(2, 1));
|
|
|
#undef SWAP__
|
|
#undef SWAP__
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -879,21 +903,9 @@ transpose_in_place() {
|
|
|
// don't trust compilers to inline these
|
|
// don't trust compilers to inline these
|
|
|
#define DET2(E00,E01,E10,E11) ((E00)*(E11) - (E10)*(E01))
|
|
#define DET2(E00,E01,E10,E11) ((E00)*(E11) - (E10)*(E01))
|
|
|
#define MATRIX3_DETERMINANT(mat) \
|
|
#define MATRIX3_DETERMINANT(mat) \
|
|
|
- ( (mat)._00 * DET2((mat)._11,(mat)._12,(mat)._21,(mat)._22) \
|
|
|
|
|
- -(mat)._01 * DET2((mat)._10,(mat)._12,(mat)._20,(mat)._22) \
|
|
|
|
|
- +(mat)._02 * DET2((mat)._10,(mat)._11,(mat)._20,(mat)._21))
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-// Function: LMatrix3::det2
|
|
|
|
|
-// Access: Private, Static
|
|
|
|
|
-// Description: Returns the determinant of a 2x2 matrix.
|
|
|
|
|
-////////////////////////////////////////////////////////////////////
|
|
|
|
|
-INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
|
|
|
-det2(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e10, FLOATTYPE e11) const {
|
|
|
|
|
- TAU_PROFILE("FLOATTYPE LMatrix3::det2()", " ", TAU_USER);
|
|
|
|
|
- return DET2(e00, e01, e10, e11);
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ ( (mat)(0, 0) * DET2((mat)(1, 1),(mat)(1, 2),(mat)(2, 1),(mat)(2, 2)) \
|
|
|
|
|
+ -(mat)(0, 1) * DET2((mat)(1, 0),(mat)(1, 2),(mat)(2, 0),(mat)(2, 2)) \
|
|
|
|
|
+ +(mat)(0, 2) * DET2((mat)(1, 0),(mat)(1, 1),(mat)(2, 0),(mat)(2, 1)))
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
// Function: LMatrix3::determinant
|
|
// Function: LMatrix3::determinant
|
|
@@ -904,7 +916,11 @@ INLINE_LINMATH FLOATTYPE FLOATNAME(LMatrix3)::
|
|
|
determinant() const {
|
|
determinant() const {
|
|
|
TAU_PROFILE("FLOATTYPE LMatrix3::determinant()", " ", TAU_USER);
|
|
TAU_PROFILE("FLOATTYPE LMatrix3::determinant()", " ", TAU_USER);
|
|
|
|
|
|
|
|
- return MATRIX3_DETERMINANT(_m.m);
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ return _m.determinant();
|
|
|
|
|
+#else
|
|
|
|
|
+ return MATRIX3_DETERMINANT(_m);
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -927,7 +943,23 @@ INLINE_LINMATH bool FLOATNAME(LMatrix3)::
|
|
|
invert_from(const FLOATNAME(LMatrix3) &other) {
|
|
invert_from(const FLOATNAME(LMatrix3) &other) {
|
|
|
TAU_PROFILE("bool LMatrix3::invert_from(const LMatrix3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("bool LMatrix3::invert_from(const LMatrix3 &)", " ", TAU_USER);
|
|
|
|
|
|
|
|
- FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m.m);
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ bool invertible;
|
|
|
|
|
+ other._m.computeInverseWithCheck(_m, invertible);
|
|
|
|
|
+
|
|
|
|
|
+ if (!invertible) {
|
|
|
|
|
+#ifdef NDEBUG
|
|
|
|
|
+ linmath_cat.warning() << "Tried to invert singular LMatrix3.\n";
|
|
|
|
|
+#endif
|
|
|
|
|
+ (*this) = ident_mat();
|
|
|
|
|
+ nassertr(!no_singular_invert, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return invertible;
|
|
|
|
|
+
|
|
|
|
|
+#else // HAVE_EIGEN
|
|
|
|
|
+
|
|
|
|
|
+ FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m);
|
|
|
|
|
|
|
|
// We throw the value out only if it's smaller than our "small"
|
|
// We throw the value out only if it's smaller than our "small"
|
|
|
// threshold squared. This helps reduce overly-sensitive
|
|
// threshold squared. This helps reduce overly-sensitive
|
|
@@ -943,19 +975,20 @@ invert_from(const FLOATNAME(LMatrix3) &other) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
other_det = 1.0f / other_det;
|
|
other_det = 1.0f / other_det;
|
|
|
- _m.m._00 = other_det * DET2(other._m.m._11, other._m.m._12, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._10 = -other_det * DET2(other._m.m._10, other._m.m._12, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._20 = other_det * DET2(other._m.m._10, other._m.m._11, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(0, 0) = other_det * DET2(other._m(1, 1), other._m(1, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(1, 0) = -other_det * DET2(other._m(1, 0), other._m(1, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(2, 0) = other_det * DET2(other._m(1, 0), other._m(1, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._01 = -other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._11 = other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._21 = -other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(0, 1) = -other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(1, 1) = other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(2, 1) = -other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._02 = other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._11, other._m.m._12);
|
|
|
|
|
- _m.m._12 = -other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._10, other._m.m._12);
|
|
|
|
|
- _m.m._22 = other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._10, other._m.m._11);
|
|
|
|
|
|
|
+ _m(0, 2) = other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(1, 1), other._m(1, 2));
|
|
|
|
|
+ _m(1, 2) = -other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(1, 0), other._m(1, 2));
|
|
|
|
|
+ _m(2, 2) = other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(1, 0), other._m(1, 1));
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -982,30 +1015,49 @@ INLINE_LINMATH bool FLOATNAME(LMatrix3)::
|
|
|
invert_transpose_from(const FLOATNAME(LMatrix3) &other) {
|
|
invert_transpose_from(const FLOATNAME(LMatrix3) &other) {
|
|
|
TAU_PROFILE("bool LMatrix3::invert_transpose_from(const LMatrix3 &)", " ", TAU_USER);
|
|
TAU_PROFILE("bool LMatrix3::invert_transpose_from(const LMatrix3 &)", " ", TAU_USER);
|
|
|
|
|
|
|
|
- FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m.m);
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ bool invertible;
|
|
|
|
|
+ EMatrix3 temp;
|
|
|
|
|
+ other._m.computeInverseWithCheck(temp, invertible);
|
|
|
|
|
+
|
|
|
|
|
+ if (!invertible) {
|
|
|
|
|
+#ifdef NDEBUG
|
|
|
|
|
+ linmath_cat.warning() << "Tried to invert singular LMatrix3.\n";
|
|
|
|
|
+#endif
|
|
|
|
|
+ (*this) = ident_mat();
|
|
|
|
|
+ nassertr(!no_singular_invert, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _m = temp.transpose();
|
|
|
|
|
+ return true;
|
|
|
|
|
+
|
|
|
|
|
+#else // HAVE_EIGEN
|
|
|
|
|
+ FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m);
|
|
|
|
|
|
|
|
if (IS_THRESHOLD_ZERO(other_det, (NEARLY_ZERO(FLOATTYPE) * NEARLY_ZERO(FLOATTYPE)))) {
|
|
if (IS_THRESHOLD_ZERO(other_det, (NEARLY_ZERO(FLOATTYPE) * NEARLY_ZERO(FLOATTYPE)))) {
|
|
|
#ifdef NOTIFY_DEBUG
|
|
#ifdef NOTIFY_DEBUG
|
|
|
linmath_cat.warning() << "Tried to invert singular LMatrix3.\n";
|
|
linmath_cat.warning() << "Tried to invert singular LMatrix3.\n";
|
|
|
#endif
|
|
#endif
|
|
|
(*this) = ident_mat();
|
|
(*this) = ident_mat();
|
|
|
|
|
+ nassertr(!no_singular_invert, false);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
other_det = 1.0f / other_det;
|
|
other_det = 1.0f / other_det;
|
|
|
- _m.m._00 = other_det * DET2(other._m.m._11, other._m.m._12, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._01 = -other_det * DET2(other._m.m._10, other._m.m._12, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._02 = other_det * DET2(other._m.m._10, other._m.m._11, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(0, 0) = other_det * DET2(other._m(1, 1), other._m(1, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(0, 1) = -other_det * DET2(other._m(1, 0), other._m(1, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(0, 2) = other_det * DET2(other._m(1, 0), other._m(1, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._10 = -other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._11 = other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._12 = -other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(1, 0) = -other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(1, 1) = other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(1, 2) = -other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._20 = other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._11, other._m.m._12);
|
|
|
|
|
- _m.m._21 = -other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._10, other._m.m._12);
|
|
|
|
|
- _m.m._22 = other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._10, other._m.m._11);
|
|
|
|
|
|
|
+ _m(2, 0) = other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(1, 1), other._m(1, 2));
|
|
|
|
|
+ _m(2, 1) = -other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(1, 0), other._m(1, 2));
|
|
|
|
|
+ _m(2, 2) = other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(1, 0), other._m(1, 1));
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -1018,30 +1070,50 @@ INLINE_LINMATH bool FLOATNAME(LMatrix3)::
|
|
|
invert_transpose_from(const FLOATNAME(LMatrix4) &other) {
|
|
invert_transpose_from(const FLOATNAME(LMatrix4) &other) {
|
|
|
TAU_PROFILE("bool LMatrix3::invert_transpose_from(const LMatrix4 &)", " ", TAU_USER);
|
|
TAU_PROFILE("bool LMatrix3::invert_transpose_from(const LMatrix4 &)", " ", TAU_USER);
|
|
|
|
|
|
|
|
- FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m.m);
|
|
|
|
|
|
|
+#ifdef HAVE_EIGEN
|
|
|
|
|
+ bool invertible;
|
|
|
|
|
+ EMatrix3 temp;
|
|
|
|
|
+ other._m.block<3, 3>(0, 0).computeInverseWithCheck(temp, invertible);
|
|
|
|
|
+
|
|
|
|
|
+ if (!invertible) {
|
|
|
|
|
+#ifdef NDEBUG
|
|
|
|
|
+ linmath_cat.warning() << "Tried to invert singular LMatrix3.\n";
|
|
|
|
|
+#endif
|
|
|
|
|
+ (*this) = ident_mat();
|
|
|
|
|
+ nassertr(!no_singular_invert, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _m = temp.transpose();
|
|
|
|
|
+ return true;
|
|
|
|
|
+
|
|
|
|
|
+#else // HAVE_EIGEN
|
|
|
|
|
+
|
|
|
|
|
+ FLOATTYPE other_det = MATRIX3_DETERMINANT(other._m);
|
|
|
|
|
|
|
|
if (IS_THRESHOLD_ZERO(other_det, (NEARLY_ZERO(FLOATTYPE) * NEARLY_ZERO(FLOATTYPE)))) {
|
|
if (IS_THRESHOLD_ZERO(other_det, (NEARLY_ZERO(FLOATTYPE) * NEARLY_ZERO(FLOATTYPE)))) {
|
|
|
#ifdef NOTIFY_DEBUG
|
|
#ifdef NOTIFY_DEBUG
|
|
|
linmath_cat.warning() << "Tried to invert singular LMatrix4.\n";
|
|
linmath_cat.warning() << "Tried to invert singular LMatrix4.\n";
|
|
|
#endif
|
|
#endif
|
|
|
(*this) = ident_mat();
|
|
(*this) = ident_mat();
|
|
|
|
|
+ nassertr(!no_singular_invert, false);
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
other_det = 1.0f / other_det;
|
|
other_det = 1.0f / other_det;
|
|
|
- _m.m._00 = other_det * DET2(other._m.m._11, other._m.m._12, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._01 = -other_det * DET2(other._m.m._10, other._m.m._12, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._02 = other_det * DET2(other._m.m._10, other._m.m._11, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(0, 0) = other_det * DET2(other._m(1, 1), other._m(1, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(0, 1) = -other_det * DET2(other._m(1, 0), other._m(1, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(0, 2) = other_det * DET2(other._m(1, 0), other._m(1, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._10 = -other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._21, other._m.m._22);
|
|
|
|
|
- _m.m._11 = other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._20, other._m.m._22);
|
|
|
|
|
- _m.m._12 = -other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._20, other._m.m._21);
|
|
|
|
|
|
|
+ _m(1, 0) = -other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(2, 1), other._m(2, 2));
|
|
|
|
|
+ _m(1, 1) = other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(2, 0), other._m(2, 2));
|
|
|
|
|
+ _m(1, 2) = -other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(2, 0), other._m(2, 1));
|
|
|
|
|
|
|
|
- _m.m._20 = other_det * DET2(other._m.m._01, other._m.m._02, other._m.m._11, other._m.m._12);
|
|
|
|
|
- _m.m._21 = -other_det * DET2(other._m.m._00, other._m.m._02, other._m.m._10, other._m.m._12);
|
|
|
|
|
- _m.m._22 = other_det * DET2(other._m.m._00, other._m.m._01, other._m.m._10, other._m.m._11);
|
|
|
|
|
|
|
+ _m(2, 0) = other_det * DET2(other._m(0, 1), other._m(0, 2), other._m(1, 1), other._m(1, 2));
|
|
|
|
|
+ _m(2, 1) = -other_det * DET2(other._m(0, 0), other._m(0, 2), other._m(1, 0), other._m(1, 2));
|
|
|
|
|
+ _m(2, 2) = other_det * DET2(other._m(0, 0), other._m(0, 1), other._m(1, 0), other._m(1, 1));
|
|
|
|
|
|
|
|
return true;
|
|
return true;
|
|
|
|
|
+#endif // HAVE_EIGEN
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -1054,7 +1126,7 @@ INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_translate_mat(const FLOATNAME(LVecBase2) &trans) {
|
|
set_translate_mat(const FLOATNAME(LVecBase2) &trans) {
|
|
|
set(1.0f, 0.0f, 0.0f,
|
|
set(1.0f, 0.0f, 0.0f,
|
|
|
0.0f, 1.0f, 0.0f,
|
|
0.0f, 1.0f, 0.0f,
|
|
|
- trans._v.v._0, trans._v.v._1, 1.0f);
|
|
|
|
|
|
|
+ trans._v(0), trans._v(1), 1.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -1082,8 +1154,8 @@ set_rotate_mat(FLOATTYPE angle) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_scale_mat(const FLOATNAME(LVecBase2) &scale) {
|
|
set_scale_mat(const FLOATNAME(LVecBase2) &scale) {
|
|
|
- set(scale._v.v._0, 0.0f, 0.0f,
|
|
|
|
|
- 0.0f, scale._v.v._1, 0.0f,
|
|
|
|
|
|
|
+ set(scale._v(0), 0.0f, 0.0f,
|
|
|
|
|
+ 0.0f, scale._v(1), 0.0f,
|
|
|
0.0f, 0.0f, 1.0f);
|
|
0.0f, 0.0f, 1.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1097,7 +1169,7 @@ INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
|
|
|
translate_mat(const FLOATNAME(LVecBase2) &trans) {
|
|
translate_mat(const FLOATNAME(LVecBase2) &trans) {
|
|
|
return FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f,
|
|
return FLOATNAME(LMatrix3)(1.0f, 0.0f, 0.0f,
|
|
|
0.0f, 1.0f, 0.0f,
|
|
0.0f, 1.0f, 0.0f,
|
|
|
- trans._v.v._0, trans._v.v._1, 1.0f);
|
|
|
|
|
|
|
+ trans._v(0), trans._v(1), 1.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -1134,8 +1206,8 @@ rotate_mat(FLOATTYPE angle) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
|
|
|
scale_mat(const FLOATNAME(LVecBase2) &scale) {
|
|
scale_mat(const FLOATNAME(LVecBase2) &scale) {
|
|
|
- return FLOATNAME(LMatrix3)(scale._v.v._0, 0.0f, 0.0f,
|
|
|
|
|
- 0.0f, scale._v.v._1, 0.0f,
|
|
|
|
|
|
|
+ return FLOATNAME(LMatrix3)(scale._v(0), 0.0f, 0.0f,
|
|
|
|
|
+ 0.0f, scale._v(1), 0.0f,
|
|
|
0.0f, 0.0f, 1.0f);
|
|
0.0f, 0.0f, 1.0f);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1189,9 +1261,9 @@ rotate_mat_normaxis(FLOATTYPE angle, const FLOATNAME(LVecBase3) &axis,
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH void FLOATNAME(LMatrix3)::
|
|
|
set_scale_mat(const FLOATNAME(LVecBase3) &scale) {
|
|
set_scale_mat(const FLOATNAME(LVecBase3) &scale) {
|
|
|
- set(scale._v.v._0, 0.0f, 0.0f,
|
|
|
|
|
- 0.0f, scale._v.v._1, 0.0f,
|
|
|
|
|
- 0.0f, 0.0f, scale._v.v._2);
|
|
|
|
|
|
|
+ set(scale._v(0), 0.0f, 0.0f,
|
|
|
|
|
+ 0.0f, scale._v(1), 0.0f,
|
|
|
|
|
+ 0.0f, 0.0f, scale._v(2));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
@@ -1202,9 +1274,9 @@ set_scale_mat(const FLOATNAME(LVecBase3) &scale) {
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
|
|
INLINE_LINMATH FLOATNAME(LMatrix3) FLOATNAME(LMatrix3)::
|
|
|
scale_mat(const FLOATNAME(LVecBase3) &scale) {
|
|
scale_mat(const FLOATNAME(LVecBase3) &scale) {
|
|
|
- return FLOATNAME(LMatrix3)(scale._v.v._0, 0.0f, 0.0f,
|
|
|
|
|
- 0.0f, scale._v.v._1, 0.0f,
|
|
|
|
|
- 0.0f, 0.0f, scale._v.v._2);
|
|
|
|
|
|
|
+ return FLOATNAME(LMatrix3)(scale._v(0), 0.0f, 0.0f,
|
|
|
|
|
+ 0.0f, scale._v(1), 0.0f,
|
|
|
|
|
+ 0.0f, 0.0f, scale._v(2));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////
|
|
////////////////////////////////////////////////////////////////////
|