Matrix Functions¶
Functions that operate on matrices
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractScaling” with arguments (const Matrix44<T>& mat, Vec3<T>& scl, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractScaling(const Matrix33<T>&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractScaling(const Matrix44<T>&, Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “sansScaling” with arguments (const Matrix44<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::sansScaling(const Matrix33<T>&, bool)
- template <class T>
Matrix44<T> Imath::sansScaling(const Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “removeScaling” with arguments (Matrix44<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::removeScaling(Matrix33<T>&, bool)
- template <class T>
bool Imath::removeScaling(Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractScalingAndShear” with arguments (const Matrix44<T>& mat, Vec3<T>& scl, Vec3<T>& shr, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractScalingAndShear(const Matrix33<T>&, Vec2<T>&, T&, bool)
- template <class T>
bool Imath::extractScalingAndShear(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “sansScalingAndShear” with arguments (const Matrix44<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::sansScalingAndShear(const Matrix33<T>&, bool)
- template <class T>
Matrix44<T> Imath::sansScalingAndShear(const Matrix44<T>&, bool)
- template <class T>
void Imath::sansScalingAndShear(Matrix44<T>&, const Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “sansScalingAndShear” with arguments (Matrix44<T>& result, const Matrix44<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::sansScalingAndShear(const Matrix33<T>&, bool)
- template <class T>
Matrix44<T> Imath::sansScalingAndShear(const Matrix44<T>&, bool)
- template <class T>
void Imath::sansScalingAndShear(Matrix44<T>&, const Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “removeScalingAndShear” with arguments (Matrix44<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::removeScalingAndShear(Matrix33<T>&, bool)
- template <class T>
bool Imath::removeScalingAndShear(Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractAndRemoveScalingAndShear” with arguments (Matrix44<T>& mat, Vec3<T>& scl, Vec3<T>& shr, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractAndRemoveScalingAndShear(Matrix33<T>&, Vec2<T>&, T&, bool)
- template <class T>
bool Imath::extractAndRemoveScalingAndShear(Matrix44<T>&, Vec3<T>&, Vec3<T>&, bool)
-
template <class T>
voidImath::extractEulerXYZ(const Matrix44<T> &mat, Vec3<T> &rot)¶ Extract the rotation from the given 4x4 matrix in the form of XYZ euler angles.
- Parameters
mat: The input matrixrot: The extracted XYZ euler angle vector
-
template <class T>
voidImath::extractEulerZYX(const Matrix44<T> &mat, Vec3<T> &rot)¶ Extract the rotation from the given 4x4 matrix in the form of ZYX euler angles.
- Parameters
mat: The input matrixrot: The extracted ZYX euler angle vector
-
template <class T>
Quat<T>Imath::extractQuat(const Matrix44<T> &mat)¶ Extract the rotation from the given 4x4 matrix in the form of a quaternion.
- Return
- The extracted quaternion
- Parameters
mat: The input matrix
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractSHRT” with arguments (const Matrix44<T>& mat, Vec3<T>& s, Vec3<T>& h, Vec3<T>& r, Vec3<T>& t, bool exc, typename Euler<T>::Order rOrder) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractSHRT(const Matrix33<T>&, Vec2<T>&, T&, T&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Euler<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool, typename Euler<T>::Order)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractSHRT” with arguments (const Matrix44<T>& mat, Vec3<T>& s, Vec3<T>& h, Vec3<T>& r, Vec3<T>& t, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractSHRT(const Matrix33<T>&, Vec2<T>&, T&, T&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Euler<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool, typename Euler<T>::Order)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractSHRT” with arguments (const Matrix44<T>& mat, Vec3<T>& s, Vec3<T>& h, Euler<T>& r, Vec3<T>& t, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractSHRT(const Matrix33<T>&, Vec2<T>&, T&, T&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Euler<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool, typename Euler<T>::Order)
Warning
doxygenfunction: Unable to resolve multiple matches for function “checkForZeroScaleInRow” with arguments (const T& scl, const Vec3<T>& row, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::checkForZeroScaleInRow(const T&, const Vec2<T>&, bool)
- template <class T>
bool Imath::checkForZeroScaleInRow(const T&, const Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “outerProduct” with arguments (const Vec4<T>& a, const Vec4<T>& b) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::outerProduct(const Vec3<T>&, const Vec3<T>&)
- template <class T>
Matrix44<T> Imath::outerProduct(const Vec4<T>&, const Vec4<T>&)
-
template <class T>
Matrix44<T>Imath::rotationMatrix(const Vec3<T> &fromDirection, const Vec3<T> &toDirection)¶ Return a 4x4 matrix that rotates the vector
fromDirectiontotoDirection
-
template <class T>
Matrix44<T>Imath::rotationMatrixWithUpDir(const Vec3<T> &fromDir, const Vec3<T> &toDir, const Vec3<T> &upDir)¶ Return a 4x4 matrix that rotates the
fromDirvector so that it points towards `toDir1.You may also specify that you want the up vector to be pointing in a certain direction 1upDir`.
-
template <class T>
voidImath::alignZAxisWithTargetDir(Matrix44<T> &result, Vec3<T> targetDir, Vec3<T> upDir)¶ Construct a 4x4 matrix that rotates the z-axis so that it points towards
targetDir.You must also specify that you want the up vector to be pointing in a certain direction
upDir.Notes: The following degenerate cases are handled: (a) when the directions given by
toDirandupDirare parallel or opposite (the direction vectors must have a non-zero cross product); (b) when any of the given direction vectors have zero length- Parameters
result: The output matrixtargetDir: The target direction vectorupDir: The up direction vector
-
template <class T>
Matrix44<T>Imath::computeLocalFrame(const Vec3<T> &p, const Vec3<T> &xDir, const Vec3<T> &normal)¶ Compute an orthonormal direct 4x4 frame from a position, an x axis direction and a normal to the y axis.
If the x axis and normal are perpendicular, then the normal will have the same direction as the z axis.
- Return
- The orthonormal frame
- Parameters
p: The position of the framexDir: The x axis direction of the framenormal: A normal to the y axis of the frame
Warning
doxygenfunction: Unable to resolve multiple matches for function “addOffset” with arguments (const Matrix44<T>& inMat, const Vec3<T>& tOffset, const Vec3<T>& rOffset, const Vec3<T>& sOffset, const Vec3<T>& ref) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix44<T> Imath::addOffset(const Matrix44<T>&, const Vec3<T>&, const Vec3<T>&, const Vec3<T>&, const Matrix44<T>&)
- template <class T>
Matrix44<T> Imath::addOffset(const Matrix44<T>&, const Vec3<T>&, const Vec3<T>&, const Vec3<T>&, const Vec3<T>&)
-
template <class T>
Matrix44<T>Imath::computeRSMatrix(bool keepRotateA, bool keepScaleA, const Matrix44<T> &A, const Matrix44<T> &B)¶ Compute 4x4 translate/rotate/scale matrix from
Awith the rotate/scale ofB.- Return
- Matrix
Awith tweaked rotation/scale - Parameters
keepRotateA: If true, keep rotate from matrixA, useBotherwisekeepScaleA: If true, keep scale from matrixA, useBotherwiseA: Matrix AB: Matrix B
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractScaling” with arguments (const Matrix33<T>& mat, Vec2<T>& scl, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractScaling(const Matrix33<T>&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractScaling(const Matrix44<T>&, Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “sansScaling” with arguments (const Matrix33<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::sansScaling(const Matrix33<T>&, bool)
- template <class T>
Matrix44<T> Imath::sansScaling(const Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “removeScaling” with arguments (Matrix33<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::removeScaling(Matrix33<T>&, bool)
- template <class T>
bool Imath::removeScaling(Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractScalingAndShear” with arguments (const Matrix33<T>& mat, Vec2<T>& scl, T& shr, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractScalingAndShear(const Matrix33<T>&, Vec2<T>&, T&, bool)
- template <class T>
bool Imath::extractScalingAndShear(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “sansScalingAndShear” with arguments (const Matrix33<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::sansScalingAndShear(const Matrix33<T>&, bool)
- template <class T>
Matrix44<T> Imath::sansScalingAndShear(const Matrix44<T>&, bool)
- template <class T>
void Imath::sansScalingAndShear(Matrix44<T>&, const Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “removeScalingAndShear” with arguments (Matrix33<T>& mat, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::removeScalingAndShear(Matrix33<T>&, bool)
- template <class T>
bool Imath::removeScalingAndShear(Matrix44<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractAndRemoveScalingAndShear” with arguments (Matrix33<T>& mat, Vec2<T>& scl, T& shr, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractAndRemoveScalingAndShear(Matrix33<T>&, Vec2<T>&, T&, bool)
- template <class T>
bool Imath::extractAndRemoveScalingAndShear(Matrix44<T>&, Vec3<T>&, Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractEuler” with arguments (const Matrix22<T>& mat, T& rot) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
void Imath::extractEuler(const Matrix22<T>&, T&)
- template <class T>
void Imath::extractEuler(const Matrix33<T>&, T&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractEuler” with arguments (const Matrix33<T>& mat, T& rot) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
void Imath::extractEuler(const Matrix22<T>&, T&)
- template <class T>
void Imath::extractEuler(const Matrix33<T>&, T&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “extractSHRT” with arguments (const Matrix33<T>& mat, Vec2<T>& s, T& h, T& r, Vec2<T>& t, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::extractSHRT(const Matrix33<T>&, Vec2<T>&, T&, T&, Vec2<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Euler<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool)
- template <class T>
bool Imath::extractSHRT(const Matrix44<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, Vec3<T>&, bool, typename Euler<T>::Order)
Warning
doxygenfunction: Unable to resolve multiple matches for function “checkForZeroScaleInRow” with arguments (const T& scl, const Vec2<T>& row, bool exc) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
bool Imath::checkForZeroScaleInRow(const T&, const Vec2<T>&, bool)
- template <class T>
bool Imath::checkForZeroScaleInRow(const T&, const Vec3<T>&, bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “outerProduct” with arguments (const Vec3<T>& a, const Vec3<T>& b) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <class T>
Matrix33<T> Imath::outerProduct(const Vec3<T>&, const Vec3<T>&)
- template <class T>
Matrix44<T> Imath::outerProduct(const Vec4<T>&, const Vec4<T>&)
Warning
doxygenfunction: Unable to resolve multiple matches for function “procrustesRotationAndTranslation” with arguments (const Vec3<T>* A, const Vec3<T>* B, const T* weights, const size_t numPoints, const bool doScaling) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
M44d Imath::procrustesRotationAndTranslation(const Vec3<T> *, const Vec3<T> *, const T *, const size_t, const bool)
- template <typename T>
M44d Imath::procrustesRotationAndTranslation(const Vec3<T> *, const Vec3<T> *, const size_t, const bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “procrustesRotationAndTranslation” with arguments (const Vec3<T>* A, const Vec3<T>* B, const size_t numPoints, const bool doScaling) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
M44d Imath::procrustesRotationAndTranslation(const Vec3<T> *, const Vec3<T> *, const T *, const size_t, const bool)
- template <typename T>
M44d Imath::procrustesRotationAndTranslation(const Vec3<T> *, const Vec3<T> *, const size_t, const bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiSVD” with arguments (const Matrix33<T>& A, Matrix33<T>& U, Vec3<T>& S, Matrix33<T>& V, const T tol, const bool forcePositiveDeterminant) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiSVD(const Matrix33<T>&, Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T, const bool)
- template <typename T>
void Imath::jacobiSVD(const Matrix44<T>&, Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T, const bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiSVD” with arguments (const Matrix44<T>& A, Matrix44<T>& U, Vec4<T>& S, Matrix44<T>& V, const T tol, const bool forcePositiveDeterminant) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiSVD(const Matrix33<T>&, Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T, const bool)
- template <typename T>
void Imath::jacobiSVD(const Matrix44<T>&, Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T, const bool)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiEigenSolver” with arguments (Matrix33<T>& A, Vec3<T>& S, Matrix33<T>& V, const T tol) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiEigenSolver” with arguments (Matrix33<T>& A, Vec3<T>& S, Matrix33<T>& V) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiEigenSolver” with arguments (Matrix44<T>& A, Vec4<T>& S, Matrix44<T>& V, const T tol) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T)
Warning
doxygenfunction: Unable to resolve multiple matches for function “jacobiEigenSolver” with arguments (Matrix44<T>& A, Vec4<T>& S, Matrix44<T>& V) in doxygen xml output for project “Imath” from directory: doxyxml/. Potential matches:
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix33<T>&, Vec3<T>&, Matrix33<T>&, const T)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&)
- template <typename T>
void Imath::jacobiEigenSolver(Matrix44<T>&, Vec4<T>&, Matrix44<T>&, const T)
-
template <typename TM, typename TV>
voidImath::maxEigenVector(TM &A, TV &S)¶ Compute a eigenvector corresponding to the abs max eigenvalue of a real symmetric matrix using Jacobi transformation.
-
template <typename TM, typename TV>
voidImath::minEigenVector(TM &A, TV &S)¶ Compute a eigenvector corresponding to the abs min eigenvalue of a real symmetric matrix using Jacobi transformation.