10 template<
class Real>
class Quat_;
12 template<
class Real>
class DecompAffine;
28 template<
class Real,
int Options>
39 typedef DecompAffine<Double> DecompAffine;
64 m( 0) = _00;
m( 1) = _01;
m( 2) = _02;
m( 3) = _03;
65 m( 4) = _10;
m( 5) = _11;
m( 6) = _12;
m( 7) = _13;
66 m( 8) = _20;
m( 9) = _21;
m(10) = _22;
m(11) = _23;
67 m(12) = _30;
m(13) = _31;
m(14) = _32;
m(15) = _33;
77 Matrix(
const Transform& tm) { fromTm(tm); }
90 m( 0) = 1;
m( 1) = 0;
m( 2) = 0;
m( 3) = 0;
91 m( 4) = 0;
m( 5) = 1;
m( 6) = 0;
m( 7) = 0;
92 m( 8) = 0;
m( 9) = 0;
m(10) = 1;
m(11) = 0;
93 m(12) = 0;
m(13) = 0;
m(14) = 0;
m(15) = 1;
111 m( 0) *= scale.x;
m( 1) *= scale.y;
m( 2) *= scale.z;
112 m( 4) *= scale.x;
m( 5) *= scale.y;
m( 6) *= scale.z;
113 m( 8) *= scale.x;
m( 9) *= scale.y;
m(10) *= scale.z;
130 mt::for_<0, 16>([&](
sdt i) {
m(i) = f; });
135 Matrix& fromTm(
const Transform& tm);
141 Matrix& fromObliqueProjection(
const Vec3& normal,
const Vec3& point,
const Vec3& dir);
147 Matrix& fromPerspectiveProjection(
const Vec3& normal,
const Vec3& point,
const Vec3& eye);
153 Matrix& fromReflection(
const Vec3& normal,
const Vec3& point);
160 Matrix& fromLookAt(
const Vec3& eye,
const Vec3& at,
const Vec3& up);
168 res( 0) =
m( 0)*rhs( 0) +
m( 1)*rhs( 4) +
m( 2)*rhs( 8) +
m( 3)*rhs(12);
169 res( 1) =
m( 0)*rhs( 1) +
m( 1)*rhs( 5) +
m( 2)*rhs( 9) +
m( 3)*rhs(13);
170 res( 2) =
m( 0)*rhs( 2) +
m( 1)*rhs( 6) +
m( 2)*rhs(10) +
m( 3)*rhs(14);
171 res( 3) =
m( 0)*rhs( 3) +
m( 1)*rhs( 7) +
m( 2)*rhs(11) +
m( 3)*rhs(15);
173 res( 4) =
m( 4)*rhs( 0) +
m( 5)*rhs( 4) +
m( 6)*rhs( 8) +
m( 7)*rhs(12);
174 res( 5) =
m( 4)*rhs( 1) +
m( 5)*rhs( 5) +
m( 6)*rhs( 9) +
m( 7)*rhs(13);
175 res( 6) =
m( 4)*rhs( 2) +
m( 5)*rhs( 6) +
m( 6)*rhs(10) +
m( 7)*rhs(14);
176 res( 7) =
m( 4)*rhs( 3) +
m( 5)*rhs( 7) +
m( 6)*rhs(11) +
m( 7)*rhs(15);
178 res( 8) =
m( 8)*rhs( 0) +
m( 9)*rhs( 4) +
m(10)*rhs( 8) +
m(11)*rhs(12);
179 res( 9) =
m( 8)*rhs( 1) +
m( 9)*rhs( 5) +
m(10)*rhs( 9) +
m(11)*rhs(13);
180 res(10) =
m( 8)*rhs( 2) +
m( 9)*rhs( 6) +
m(10)*rhs(10) +
m(11)*rhs(14);
181 res(11) =
m( 8)*rhs( 3) +
m( 9)*rhs( 7) +
m(10)*rhs(11) +
m(11)*rhs(15);
183 res(12) =
m(12)*rhs( 0) +
m(13)*rhs( 4) +
m(14)*rhs( 8) +
m(15)*rhs(12);
184 res(13) =
m(12)*rhs( 1) +
m(13)*rhs( 5) +
m(14)*rhs( 9) +
m(15)*rhs(13);
185 res(14) =
m(12)*rhs( 2) +
m(13)*rhs( 6) +
m(14)*rhs(10) +
m(15)*rhs(14);
186 res(15) =
m(12)*rhs( 3) +
m(13)*rhs( 7) +
m(14)*rhs(11) +
m(15)*rhs(15);
196 res.x =
m( 0)*v.x +
m( 1)*v.y +
m( 2)*v.z +
m( 3)*v.w;
197 res.y =
m( 4)*v.x +
m( 5)*v.y +
m( 6)*v.z +
m( 7)*v.w;
198 res.z =
m( 8)*v.x +
m( 9)*v.y +
m(10)*v.z +
m(11)*v.w;
199 res.w =
m(12)*v.x +
m(13)*v.y +
m(14)*v.z +
m(15)*v.w;
207 res.x =
m( 0)*v.x +
m( 1)*v.y +
m( 2)*v.z +
m( 3);
208 res.y =
m( 4)*v.x +
m( 5)*v.y +
m( 6)*v.z +
m( 7);
209 res.z =
m( 8)*v.x +
m( 9)*v.y +
m(10)*v.z +
m(11);
210 return res / (
m(12)*v.x +
m(13)*v.y +
m(14)*v.z +
m(15));
217 res.x =
m( 0)*v.x +
m( 1)*v.y +
m( 3);
218 res.y =
m( 4)*v.x +
m( 5)*v.y +
m( 7);
219 return res / (
m(12)*v.x +
m(13)*v.y +
m(15));
226 res.x = v.x*mat( 0) + v.y*mat( 4) + v.z*mat( 8) + v.w*mat(12);
227 res.y = v.x*mat( 1) + v.y*mat( 5) + v.z*mat( 9) + v.w*mat(13);
228 res.z = v.x*mat( 2) + v.y*mat( 6) + v.z*mat(10) + v.w*mat(14);
229 res.w = v.x*mat( 3) + v.y*mat( 7) + v.z*mat(11) + v.w*mat(15);
237 res.x =
m( 0)*v.x +
m( 1)*v.y +
m( 2)*v.z +
m( 3);
238 res.y =
m( 4)*v.x +
m( 5)*v.y +
m( 6)*v.z +
m( 7);
239 res.z =
m( 8)*v.x +
m( 9)*v.y +
m(10)*v.z +
m(11);
247 res.x =
m( 0)*v.x +
m( 1)*v.y +
m( 2)*v.z;
248 res.y =
m( 4)*v.x +
m( 5)*v.y +
m( 6)*v.z;
249 res.z =
m( 8)*v.x +
m( 9)*v.y +
m(10)*v.z;
255 res( 0)=
m( 0); res( 1)=
m( 4); res( 2)=
m( 8); res( 3)=
m(12);
256 res( 4)=
m( 1); res( 5)=
m( 5); res( 6)=
m( 9); res( 7)=
m(13);
257 res( 8)=
m( 2); res( 9)=
m( 6); res(10)=
m(10); res(11)=
m(14);
258 res(12)=
m( 3); res(13)=
m( 7); res(14)=
m(11); res(15)=
m(15);
273 res( 0) =
m( 0)*rhs( 0) +
m( 4)*rhs( 4) +
m( 8)*rhs( 8) +
m(12)*rhs(12);
274 res( 1) =
m( 0)*rhs( 1) +
m( 4)*rhs( 5) +
m( 8)*rhs( 9) +
m(12)*rhs(13);
275 res( 2) =
m( 0)*rhs( 2) +
m( 4)*rhs( 6) +
m( 8)*rhs(10) +
m(12)*rhs(14);
276 res( 3) =
m( 0)*rhs( 3) +
m( 4)*rhs( 7) +
m( 8)*rhs(11) +
m(12)*rhs(15);
278 res( 4) =
m( 1)*rhs( 0) +
m( 5)*rhs( 4) +
m( 9)*rhs( 8) +
m(13)*rhs(12);
279 res( 5) =
m( 1)*rhs( 1) +
m( 5)*rhs( 5) +
m( 9)*rhs( 9) +
m(13)*rhs(13);
280 res( 6) =
m( 1)*rhs( 2) +
m( 5)*rhs( 6) +
m( 9)*rhs(10) +
m(13)*rhs(14);
281 res( 7) =
m( 1)*rhs( 3) +
m( 5)*rhs( 7) +
m( 9)*rhs(11) +
m(13)*rhs(15);
283 res( 8) =
m( 2)*rhs( 0) +
m( 6)*rhs( 4) +
m(10)*rhs( 8) +
m(14)*rhs(12);
284 res( 9) =
m( 2)*rhs( 1) +
m( 6)*rhs( 5) +
m(10)*rhs( 9) +
m(14)*rhs(13);
285 res(10) =
m( 2)*rhs( 2) +
m( 6)*rhs( 6) +
m(10)*rhs(10) +
m(14)*rhs(14);
286 res(11) =
m( 2)*rhs( 3) +
m( 6)*rhs( 7) +
m(10)*rhs(11) +
m(14)*rhs(15);
288 res(12) =
m( 3)*rhs( 0) +
m( 7)*rhs( 4) +
m(11)*rhs( 8) +
m(15)*rhs(12);
289 res(13) =
m( 3)*rhs( 1) +
m( 7)*rhs( 5) +
m(11)*rhs( 9) +
m(15)*rhs(13);
290 res(14) =
m( 3)*rhs( 2) +
m( 7)*rhs( 6) +
m(11)*rhs(10) +
m(15)*rhs(14);
291 res(15) =
m( 3)*rhs( 3) +
m( 7)*rhs( 7) +
m(11)*rhs(11) +
m(15)*rhs(15);
299 res( 0) =
m( 0)*rhs( 0) +
m( 1)*rhs( 1) +
m( 2)*rhs( 2) +
m( 3)*rhs( 3);
300 res( 1) =
m( 0)*rhs( 4) +
m( 1)*rhs( 5) +
m( 2)*rhs( 6) +
m( 3)*rhs( 7);
301 res( 2) =
m( 0)*rhs( 8) +
m( 1)*rhs( 9) +
m( 2)*rhs(10) +
m( 3)*rhs(11);
302 res( 3) =
m( 0)*rhs(12) +
m( 1)*rhs(13) +
m( 2)*rhs(14) +
m( 3)*rhs(15);
304 res( 4) =
m( 4)*rhs( 0) +
m( 5)*rhs( 1) +
m( 6)*rhs( 2) +
m( 7)*rhs( 3);
305 res( 5) =
m( 4)*rhs( 4) +
m( 5)*rhs( 5) +
m( 6)*rhs( 6) +
m( 7)*rhs( 7);
306 res( 6) =
m( 4)*rhs( 8) +
m( 5)*rhs( 9) +
m( 6)*rhs(10) +
m( 7)*rhs(11);
307 res( 7) =
m( 4)*rhs(12) +
m( 5)*rhs(13) +
m( 6)*rhs(14) +
m( 7)*rhs(15);
309 res( 8) =
m( 8)*rhs( 0) +
m( 9)*rhs( 1) +
m(10)*rhs( 2) +
m(11)*rhs( 3);
310 res( 9) =
m( 8)*rhs( 4) +
m( 9)*rhs( 5) +
m(10)*rhs( 6) +
m(11)*rhs( 7);
311 res(10) =
m( 8)*rhs( 8) +
m( 9)*rhs( 9) +
m(10)*rhs(10) +
m(11)*rhs(11);
312 res(11) =
m( 8)*rhs(12) +
m( 9)*rhs(13) +
m(10)*rhs(14) +
m(11)*rhs(15);
314 res(12) =
m(12)*rhs( 0) +
m(13)*rhs( 1) +
m(14)*rhs( 2) +
m(15)*rhs( 3);
315 res(13) =
m(12)*rhs( 4) +
m(13)*rhs( 5) +
m(14)*rhs( 6) +
m(15)*rhs( 7);
316 res(14) =
m(12)*rhs( 8) +
m(13)*rhs( 9) +
m(14)*rhs(10) +
m(15)*rhs(11);
317 res(15) =
m(12)*rhs(12) +
m(13)*rhs(13) +
m(14)*rhs(14) +
m(15)*rhs(15);
325 res( 0) =
m( 0)*rhs( 0) +
m( 4)*rhs( 1) +
m( 8)*rhs( 2) +
m(12)*rhs( 3);
326 res( 1) =
m( 0)*rhs( 4) +
m( 4)*rhs( 5) +
m( 8)*rhs( 6) +
m(12)*rhs( 7);
327 res( 2) =
m( 0)*rhs( 8) +
m( 4)*rhs( 9) +
m( 8)*rhs(10) +
m(12)*rhs(11);
328 res( 3) =
m( 0)*rhs(12) +
m( 4)*rhs(13) +
m( 8)*rhs(14) +
m(12)*rhs(15);
330 res( 4) =
m( 1)*rhs( 0) +
m( 5)*rhs( 1) +
m( 9)*rhs( 2) +
m(13)*rhs( 3);
331 res( 5) =
m( 1)*rhs( 4) +
m( 5)*rhs( 5) +
m( 9)*rhs( 6) +
m(13)*rhs( 7);
332 res( 6) =
m( 1)*rhs( 8) +
m( 5)*rhs( 9) +
m( 9)*rhs(10) +
m(13)*rhs(11);
333 res( 7) =
m( 1)*rhs(12) +
m( 5)*rhs(13) +
m( 9)*rhs(14) +
m(13)*rhs(15);
335 res( 8) =
m( 2)*rhs( 0) +
m( 6)*rhs( 1) +
m(10)*rhs( 2) +
m(14)*rhs( 3);
336 res( 9) =
m( 2)*rhs( 4) +
m( 6)*rhs( 5) +
m(10)*rhs( 6) +
m(14)*rhs( 7);
337 res(10) =
m( 2)*rhs( 8) +
m( 6)*rhs( 9) +
m(10)*rhs(10) +
m(14)*rhs(11);
338 res(11) =
m( 2)*rhs(12) +
m( 6)*rhs(13) +
m(10)*rhs(14) +
m(14)*rhs(15);
340 res(12) =
m( 3)*rhs( 0) +
m( 7)*rhs( 1) +
m(11)*rhs( 2) +
m(15)*rhs( 3);
341 res(13) =
m( 3)*rhs( 4) +
m( 7)*rhs( 5) +
m(11)*rhs( 6) +
m(15)*rhs( 7);
342 res(14) =
m( 3)*rhs( 8) +
m( 7)*rhs( 9) +
m(11)*rhs(10) +
m(15)*rhs(11);
343 res(15) =
m( 3)*rhs(12) +
m( 7)*rhs(13) +
m(11)*rhs(14) +
m(15)*rhs(15);
350 void orthonormalize();
372 void setTrans(
const Vec3& v) {
m(3) = v.x;
m(7) = v.y;
m(11) = v.z; }
388 m(0) = v.x;
m(5) = v.y;
m(10) = v.z;
392 auto scl =
Matrix().fromIdentity();
393 scl(0) = v.x; scl(5) = v.y; scl(10) = v.z;
396 m( 0) = scl( 0);
m( 1) = scl( 1);
m( 2) = scl( 2);
397 m( 4) = scl( 4);
m( 5) = scl( 5);
m( 6) = scl( 6);
398 m( 8) = scl( 8);
m( 9) = scl( 9);
m(10) = scl(10);
440 a[ 0] = (Num)
m( 0); a[ 1] = (Num)
m( 4); a[ 2] = (Num)
m( 8); a[ 3] = (Num)
m(12);
441 a[ 4] = (Num)
m( 1); a[ 5] = (Num)
m( 5); a[ 6] = (Num)
m( 9); a[ 7] = (Num)
m(13);
442 a[ 8] = (Num)
m( 2); a[ 9] = (Num)
m( 6); a[10] = (Num)
m(10); a[11] = (Num)
m(14);
443 a[12] = (Num)
m( 3); a[13] = (Num)
m( 7); a[14] = (Num)
m(11); a[15] = (Num)
m(15);
458 template<
class R,
int Opt>
461 struct priv::map_impl<
Matrix<4,4,R,Opt>,
Matrix<4,4,R,Opt>>
463 template<
class T,
class O,
class Func>
464 static O&& func(T&& m, O&& o, Func&& f)
466 mt::for_<0, 16>([&](
sdt i) { o(i) = f(m(i)); });
467 return forward<O>(o);
471 template<
class R,
int Opt>
472 struct priv::map_impl<Matrix<4,4,R,Opt>, Matrix<4,4,R,Opt>, Matrix<4,4,R,Opt>>
474 template<
class T,
class T2,
class O,
class Func>
475 static O&& func(T&& m, T2&& rhs, O&& o, Func&& f)
477 mt::for_<0, 16>([&](
sdt i) { o(i) = f(m(i), rhs(i)); });
478 return forward<O>(o);
482 template<
class R,
int O,
class Accum_>
483 struct priv::reduce_impl<Matrix<4,4,R,O>, Accum_>
485 template<
class T,
class Accum,
class Func>
486 static Accum_ func(T&& m, Accum&& initVal, Func&& f)
488 return f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(forward<Accum>(initVal),
489 m(0)), m(1)), m(2)), m(3)),
490 m(4)), m(5)), m(6)), m(7)),
491 m(8)), m(9)), m(10)), m(11)),
492 m(12)), m(13)), m(14)), m(15));
497 template<
class R,
int O,
class Accum_>
498 struct priv::reduce_impl<Matrix<4,4,R,O>, Accum_, Matrix<4,4,R,O>>
500 template<
class T,
class T2,
class Accum,
class Func>
501 static Accum_ func(T&& m, T2&& rhs, Accum&& initVal, Func&& f)
503 return f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(f(forward<Accum>(initVal),
504 m(0),rhs(0)), m(1),rhs(1)), m(2),rhs(2)), m(3),rhs(3)),
505 m(4),rhs(4)), m(5),rhs(5)), m(6),rhs(6)), m(7),rhs(7)),
506 m(8),rhs(8)), m(9),rhs(9)), m(10),rhs(10)), m(11),rhs(11)),
507 m(12),rhs(12)), m(13),rhs(13)), m(14),rhs(14)), m(15),rhs(15));
523 #define Section_Header
524 #include "Honey/Math/Alge/Matrix/platform/Matrix4.h"
525 #undef Section_Header
MatrixS & fromScalar(Real f)
Initialize with scalar in every element.
Definition: Base.h:72
(m x n)-dimensional matrix
Definition: Matrix.h:24
Real determinant() const
Get the determinant. Returns the pseudo-determinant if this matrix is not square. ...
Definition: Base.h:487
Matrix && mulTranspose(const Matrix &rhs, Matrix &&res) const
Definition: Matrix4.h:321
Matrix & scale(Real f)
Uniform scale.
Definition: Matrix4.h:418
Matrix()
No init.
Definition: Matrix4.h:56
Vec3 operator*(const Vec3 &v) const
Assumes vector has w = 1, transforms and projects result back into w = 1.
Definition: Matrix4.h:204
static optnull_t optnull
Null optional, use to reset an optional to an uninitialized state or test for initialization.
Definition: Optional.h:12
Matrix && transposeMulTranspose(const Matrix &rhs, Matrix &&res) const
Definition: Matrix4.h:347
const Real & m(sdt i) const
Access matrix element at index. Wrapper for convenience only, more readable than (*this)(i) ...
Definition: Base.h:567
Matrix & transposeMulTranspose(const Matrix &rhs, Matrix &res) const
Definition: Matrix4.h:323
Matrix(const Quat &q)
Construct from quaternion.
Definition: Matrix4.h:75
Matrix & translate(const Vec3 &v)
Make a tm that performs this transform first, then does a translation. ie. T * This.
Definition: Matrix4.h:406
ptrdiff_t sdt
Size difference type, shorthand for ptrdiff_t.
Definition: Core.h:92
Vec3 mulAffine(const Vec3 &v) const
Transform vector with affine part of matrix (apply pos/rot/scale). Same as operator*() but without pr...
Definition: Matrix4.h:234
Matrix4 & toMatrix(Matrix4 &rot, bool b3x3=false) const
Convert quaternion to 4x4 homogeneous rotation matrix. Set b3x3 to true to store the result only in t...
Definition: Quat.cpp:422
Vec2 operator*(const Vec2 &v) const
Assumes vector has (z,w) = (0,1), transforms and projects result back into w = 1. ...
Definition: Matrix4.h:214
Matrix && mul(const Matrix &rhs, Matrix &&res) const
Definition: Matrix4.h:190
Res && transposeMul(const T &rhs, Res &&res) const
Stores result in and returns res.
Definition: Base.h:341
Matrix & transposeMul(const Matrix &rhs, Matrix &res) const
Definition: Matrix4.h:271
Matrix(const MatrixBase< T > &rhs)
Construct from matrix of same size.
Definition: Matrix4.h:80
Matrix & preRotate(const Quat &q)
Make a tm that does a rotation first, then performs this transform. ie. This * R. ...
Definition: Matrix4.h:413
Vec< 2 > Vec2
2D column vector types
Definition: Vec2.h:202
Matrix< s_cols, s_rows, Real > transpose() const
Returns new matrix.
Definition: Base.h:325
Matrix(Real scalar)
Initialize with scalar in every element.
Definition: Matrix4.h:71
Quat_ & fromMatrix(const Matrix4 &rot)
Construct from 4x4 homogeneous matrix. Rotation is extracted from upper-left 3x3 submatrix.
Definition: Quat.cpp:91
MatrixS & fromIdentity()
Make matrix identity. For non-square matrices the identity is in the upper-left square block...
Definition: Base.h:75
Alge_< Real > Alge
Definition: Base.h:28
Matrix(Real _00, Real _01, Real _02, Real _03, Real _10, Real _11, Real _12, Real _13, Real _20, Real _21, Real _22, Real _23, Real _30, Real _31, Real _32, Real _33)
Construct from values.
Definition: Matrix4.h:59
Res && transposeMulTranspose(const T &rhs, Res &&res) const
Stores result in and returns res.
Definition: Base.h:383
Matrix< 4, 4, Double > Matrix4_d
Definition: Matrix4.h:515
Matrix & fromColMajor(const Num *a)
Definition: Matrix4.h:428
void setScale(Real f)
Set uniform scale. Beware: overwrites rotation.
Definition: Matrix4.h:403
Matrix && transpose(Matrix &&res) const
Definition: Matrix4.h:262
Vec< 4 > Vec4
4D column vector types
Definition: Vec4.h:674
Matrix & mul(const Matrix &rhs, Matrix &res) const
Definition: Matrix4.h:166
static const Matrix zero
Definition: Matrix4.h:453
Matrix & fromScalar(Real f)
Initialize with scalar in every element.
Definition: Matrix4.h:128
Res && mul(const T &rhs, Res &&res) const
Multiply with another matrix. This mat's column size must match rhs' row size. Stores result in and r...
Definition: Base.h:161
Matrix operator*(Real rhs) const
Definition: Matrix4.h:85
Matrix & fromTrs(const Vec3 &trans, const Quat &rot=Quat::identity, const Vec3 &scale=Vec3::one, const Quat &skew=Quat::identity)
Init from translation, rotation, scale and skew.
Definition: Matrix4.h:104
Vec3 getScale() const
Get scale. Beware: bogus if mat contains rot/skew.
Definition: Matrix4.h:381
Matrix(const Real *a, sdt rows, sdt cols, bool rowMajor=true)
Initialize from array with dimensions (rows x cols). If the array is in row-major format set rowMajor...
Definition: Matrix4.h:73
Matrix & scale(const Vec3 &v, const Quat &skew=Quat::identity)
Make a tm that performs this transform first, then does a scale. ie. S * This.
Definition: Matrix4.h:416
Quat getRot() const
Get rotation. Beware: bogus if mat contains scale/skew.
Definition: Matrix4.h:375
static const Quat_ identity
Definition: Quat.h:347
VecCol operator*(const VecCol &v) const
Square matrix, so multiplying a column vector on the right returns a column vector of the same dimens...
Definition: Matrix4.h:193
Matrix && transposeMul(const Matrix &rhs, Matrix &&res) const
Definition: Matrix4.h:295
float Real
Real number type. See Real_ for real number operations and constants.
Definition: Real.h:21
MatrixS & resize(sdt rows, sdt cols)
Sets number of rows/columns and reallocates only if the size has changed (rows*cols). All previous data is lost on reallocation. Returns self.
Definition: Base.h:277
friend VecRow operator*(const VecRow &v, const Matrix &mat)
Square matrix, so multiplying a row vector on the left returns a row vector of the same dimension...
Definition: Matrix4.h:223
Enables any type to be optional so it can exist in an uninitialized null state.
Definition: Optional.h:52
void transposeInPlace()
Definition: Matrix4.h:264
Vec< 3 > Vec3
3D column vector types
Definition: Vec3.h:356
Matrix & operator=(const MatrixBase< T > &rhs)
Assign to matrix of any size. Asserts that any fixed dimensions in this matrix match those in rhs...
Definition: Matrix.h:44
Matrix< 4, 4, Real > Matrix4
Definition: Matrix4.h:513
Vec3 getTrans() const
Get translation.
Definition: Matrix4.h:369
void setTrans(const Vec3 &v)
Set translation.
Definition: Matrix4.h:372
Matrix & preTranslate(const Vec3 &v)
Make a tm that does a translation first, then performs this transform. ie. This * T...
Definition: Matrix4.h:408
MatrixS & operator*=(const MatrixBase< T > &rhs)
Definition: Base.h:181
Vec3 mulRotScale(const Vec3 &v) const
Transform vector with upper-left 3x3 rot/scale sub-matrix (no translation)
Definition: Matrix4.h:244
Quat_< Real > Quat
Definition: Quat.h:353
Matrix< s_rows, T::s_cols, Real > operator*(const T &rhs) const
Multiply with another matrix. Returns a new matrix.
Definition: Base.h:178
MatrixBase & operator=(const MatrixBase< T > &rhs)
Assign to matrix of any size. Asserts that any fixed dimensions in this matrix match those in rhs...
Definition: Base.h:97
Quaternion rotation class. Represents a counter-clockwise rotation of an angle about its axis...
Definition: Matrix4.h:10
Matrix & operator=(const MatrixBase< T > &rhs)
Assign to matrix of same size.
Definition: Matrix4.h:164
Matrix< s_cols, s_rows, Real > inverse(optional< Real & > det=optnull) const
Get the pseudo-inverse of this matrix. The pseudo-determinant will be returned in det if specified...
Definition: Base.h:421
void setScale(const Vec3 &v, const Quat &skew=Quat::identity)
Set scale. Beware: overwrites rotation.
Definition: Matrix4.h:384
Matrix & fromIdentity()
Make matrix identity.
Definition: Matrix4.h:88
Matrix & mulTranspose(const Matrix &rhs, Matrix &res) const
Definition: Matrix4.h:297
Vec< s_rows, Real > VecCol
Definition: Base.h:48
Matrix & preScale(const Vec3 &v, const Quat &skew=Quat::identity)
Make a tm that does a scale first, then performs this transform. ie. This * S.
Definition: Matrix4.h:421
Matrix(const Transform &tm)
Initialize from transform.
Definition: Matrix4.h:77
Num * toColMajor(Num *a) const
Definition: Matrix4.h:438
Transform_< Real > Transform
Definition: Transform.h:242
Matrix & preScale(Real f)
Uniform prescale.
Definition: Matrix4.h:423
Matrix()
No init.
Definition: Matrix.h:29
Matrix base class.
Definition: Base.h:17
void setRot(const Quat &q)
Set rotation. Beware: overwrites scale/skew.
Definition: Matrix4.h:378
Matrix< 4, 4, Float > Matrix4_f
Definition: Matrix4.h:514
Matrix & transpose(Matrix &res) const
Definition: Matrix4.h:253
MatrixS & fromArray(const Num *a, bool rowMajor=true)
Initialize from array. If the array is in row-major format set rowMajor to true, otherwise set to fal...
Definition: Base.h:53
Matrix< s_rows, T::s_cols, Real > operator*(const T &rhs) const
Forward to base.
Definition: Matrix4.h:84
Global Honeycomb namespace.
static const Matrix identity
Definition: Matrix4.h:454
Vec< s_cols, Real, matrix::Option::vecRow > VecRow
Definition: Base.h:49
Trig_< Real > Trig
Definition: Base.h:30
Matrix & rotate(const Quat &q)
Make a tm that performs this transform first, then does a rotation. ie. R * This. ...
Definition: Matrix4.h:411
Res && mulTranspose(const T &rhs, Res &&res) const
Stores result in and returns res.
Definition: Base.h:362