36 #ifndef INCLUDED_IMATHMATRIXALGO_H 37 #define INCLUDED_IMATHMATRIXALGO_H 61 #define IMATH_EXPORT_CONST extern __declspec(dllexport) 63 #define IMATH_EXPORT_CONST extern __declspec(dllimport) 66 #define IMATH_EXPORT_CONST extern const 423 row[0] =
Vec3<T> (mat[0][0], mat[0][1], mat[0][2]);
424 row[1] =
Vec3<T> (mat[1][0], mat[1][1], mat[1][2]);
425 row[2] =
Vec3<T> (mat[2][0], mat[2][1], mat[2][2]);
428 for (
int i=0; i < 3; i++)
429 for (
int j=0; j < 3; j++)
443 for (
int i=0; i < 3; i++)
469 shr[0] = row[0].
dot (row[1]);
470 row[1] -= shr[0] * row[0];
473 scl.
y = row[1].length ();
482 shr[1] = row[0].
dot (row[2]);
483 row[2] -= shr[1] * row[0];
484 shr[2] = row[1].
dot (row[2]);
485 row[2] -= shr[2] * row[1];
488 scl.
z = row[2].length ();
500 if (row[0].dot (row[1].cross (row[2])) < 0)
501 for (
int i=0; i < 3; i++)
509 for (
int i=0; i < 3; i++)
511 mat[i][0] = row[i][0];
512 mat[i][1] = row[i][1];
513 mat[i][2] = row[i][2];
533 Vec3<T> i (mat[0][0], mat[0][1], mat[0][2]);
534 Vec3<T> j (mat[1][0], mat[1][1], mat[1][2]);
535 Vec3<T> k (mat[2][0], mat[2][1], mat[2][2]);
581 Vec3<T> i (mat[0][0], mat[0][1], mat[0][2]);
582 Vec3<T> j (mat[1][0], mat[1][1], mat[1][2]);
583 Vec3<T> k (mat[2][0], mat[2][1], mat[2][2]);
631 int nxt[3] = {1, 2, 0};
632 tr = mat[0][0] + mat[1][1] + mat[2][2];
640 quat.
v.x = (mat[1][2] - mat[2][1]) * s;
641 quat.
v.y = (mat[2][0] - mat[0][2]) * s;
642 quat.
v.z = (mat[0][1] - mat[1][0]) * s;
647 if (mat[1][1] > mat[0][0])
649 if (mat[2][2] > mat[i][i])
654 s =
Math<T>::sqrt ((mat[i][i] - (mat[j][j] + mat[k][k])) + 1.0);
660 q[3] = (mat[j][k] - mat[k][j]) * s;
661 q[j] = (mat[i][j] + mat[j][i]) * s;
662 q[k] = (mat[i][k] + mat[k][i]) * s;
736 for (
int i = 0; i < 3; i++)
741 throw Imath::ZeroScaleExc (
"Cannot remove zero scaling " 777 if (fromDir.
length () == 0)
789 return fromDir2zAxis * zAxis2ToDir;
802 if ( targetDir.
length () == 0 )
809 if ( upDir.
length () == 0 )
843 Matrix44<T> mat ( row[0][0], row[0][1], row[0][2], 0,
844 row[1][0], row[1][1], row[1][2], 0,
845 row[2][0], row[2][1], row[2][2], 0,
959 Vec2<T> &scl, T &shr,
bool exc)
963 row[0] =
Vec2<T> (mat[0][0], mat[0][1]);
964 row[1] =
Vec2<T> (mat[1][0], mat[1][1]);
967 for (
int i=0; i < 2; i++)
968 for (
int j=0; j < 2; j++)
982 for (
int i=0; i < 2; i++)
1007 shr = row[0].
dot (row[1]);
1008 row[1] -= shr * row[0];
1011 scl.
y = row[1].length ();
1023 if (row[0][0] * row[1][1] - row[0][1] * row[1][0] < 0)
1033 for (
int i=0; i < 2; i++)
1035 mat[i][0] = row[i][0];
1036 mat[i][1] = row[i][1];
1053 Vec2<T> i (mat[0][0], mat[0][1]);
1054 Vec2<T> j (mat[1][0], mat[1][1]);
1097 for (
int i = 0; i < 2; i++)
1102 throw Imath::ZeroScaleExc (
"Cannot remove zero scaling " Vec3< T > v
Definition: ImathQuat.h:76
T x
Definition: ImathVec.h:76
Order order() const
Definition: ImathEuler.h:773
Matrix44< T > sansScaling(const Matrix44< T > &mat, bool exc=true)
Definition: ImathMatrixAlgo.h:326
T dot(const Vec3 &v) const
Definition: ImathVec.h:1466
const Matrix33 & shear(const S &xy)
Quat< T > extractQuat(const Matrix44< T > &mat)
Definition: ImathMatrixAlgo.h:622
T y
Definition: ImathVec.h:76
Order
Definition: ImathEuler.h:151
Definition: ImathFrame.h:42
const Matrix33 & rotate(S r)
Definition: ImathFrame.h:43
IMATH_EXPORT_CONST M33d identity33d
Definition: ImathMatrixAlgo.h:78
bool extractScaling(const Matrix44< T > &mat, Vec3< T > &scl, bool exc=true)
Definition: ImathMatrixAlgo.h:312
const Matrix44 & rotate(const Vec3< S > &r)
T length() const
Definition: ImathVec.h:1662
bool extractScalingAndShear(const Matrix44< T > &mat, Vec3< T > &scl, Vec3< T > &shr, bool exc=true)
Definition: ImathMatrixAlgo.h:369
IMATH_EXPORT_CONST M44f identity44f
Definition: ImathMatrixAlgo.h:77
bool extractAndRemoveScalingAndShear(Matrix44< T > &mat, Vec3< T > &scl, Vec3< T > &shr, bool exc=true)
Definition: ImathMatrixAlgo.h:412
static T atan2(T x, T y)
Definition: ImathMath.h:96
void extractEuler(const Matrix33< T > &mat, T &rot)
Definition: ImathMatrixAlgo.h:1047
Quat< T > & setRotation(const Vec3< T > &fromDirection, const Vec3< T > &toDirection)
Definition: ImathQuat.h:702
bool removeScaling(Matrix44< T > &mat, bool exc=true)
Definition: ImathMatrixAlgo.h:348
T dot(const Vec2 &v) const
Definition: ImathVec.h:1003
void extractEulerZYX(const Matrix44< T > &mat, Vec3< T > &rot)
Definition: ImathMatrixAlgo.h:575
const Matrix44 & translate(const Vec3< S > &t)
T abs(T a)
Definition: ImathFun.h:53
Matrix44< T > rotationMatrixWithUpDir(const Vec3< T > &fromDir, const Vec3< T > &toDir, const Vec3< T > &upDir)
Definition: ImathMatrixAlgo.h:764
const Matrix44 & shear(const Vec3< S > &h)
Definition: ImathMatrix.h:66
Vec3< T > toXYZVector() const
Definition: ImathEuler.h:387
Definition: ImathLimits.h:117
const Matrix33 & translate(const Vec2< S > &t)
T x
Definition: ImathVec.h:274
T y
Definition: ImathVec.h:274
Definition: ImathEuler.h:143
const Vec3 & normalize()
Definition: ImathVec.h:1681
Vec3 cross(const Vec3 &v) const
Definition: ImathVec.h:1480
Matrix44< T > toMatrix44() const
Definition: ImathQuat.h:826
T length() const
Definition: ImathVec.h:1171
Definition: ImathQuat.h:71
T z
Definition: ImathVec.h:274
void makeIdentity()
Definition: ImathMatrix.h:1016
T r
Definition: ImathQuat.h:75
Vec3< T > normalized() const
Definition: ImathVec.h:1730
Matrix44< T > alignZAxisWithTargetDir(Vec3< T > targetDir, Vec3< T > upDir)
Definition: ImathMatrixAlgo.h:796
Definition: ImathVec.h:61
void extractEulerXYZ(const Matrix44< T > &mat, Vec3< T > &rot)
Definition: ImathMatrixAlgo.h:527
bool removeScalingAndShear(Matrix44< T > &mat, bool exc=true)
Definition: ImathMatrixAlgo.h:398
bool checkForZeroScaleInRow(const T &scl, const Vec3< T > &row, bool exc=true)
Definition: ImathMatrixAlgo.h:732
#define IMATH_EXPORT_CONST
Definition: ImathMatrixAlgo.h:66
IMATH_EXPORT_CONST M33f identity33f
Definition: ImathMatrixAlgo.h:76
Definition: ImathBox.h:67
Matrix44 transposed() const
Definition: ImathMatrix.h:2589
IMATH_EXPORT_CONST M44d identity44d
Definition: ImathMatrixAlgo.h:79
static T sqrt(T x)
Definition: ImathMath.h:114
Matrix44< T > sansScalingAndShear(const Matrix44< T > &mat, bool exc=true)
Definition: ImathMatrixAlgo.h:383
void makeIdentity()
Definition: ImathMatrix.h:2096
bool extractSHRT(const Matrix44< T > &mat, Vec3< T > &s, Vec3< T > &h, Vec3< T > &r, Vec3< T > &t, bool exc, typename Euler< T >::Order rOrder)
Definition: ImathMatrixAlgo.h:675
Matrix44< T > rotationMatrix(const Vec3< T > &fromDirection, const Vec3< T > &toDirection)
Definition: ImathMatrixAlgo.h:754
const Vec2 & normalize()
Definition: ImathVec.h:1190