HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ImathMatrixAlgo.h File Reference
#include "ImathEuler.h"
#include "ImathExport.h"
#include "ImathMatrix.h"
#include "ImathNamespace.h"
#include "ImathQuat.h"
#include "ImathVec.h"
#include <math.h>
+ Include dependency graph for ImathMatrixAlgo.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

template<class T >
bool extractScaling (const Matrix44< T > &mat, Vec3< T > &scl, bool exc=true)
 
template<class T >
Matrix44< T > sansScaling (const Matrix44< T > &mat, bool exc=true)
 
template<class T >
bool removeScaling (Matrix44< T > &mat, bool exc=true)
 
template<class T >
bool extractScalingAndShear (const Matrix44< T > &mat, Vec3< T > &scl, Vec3< T > &shr, bool exc=true)
 
template<class T >
Matrix44< T > sansScalingAndShear (const Matrix44< T > &mat, bool exc=true)
 
template<class T >
void sansScalingAndShear (Matrix44< T > &result, const Matrix44< T > &mat, bool exc=true)
 
template<class T >
bool removeScalingAndShear (Matrix44< T > &mat, bool exc=true)
 Remove scaling and shear from the given 4x4 matrix in place. More...
 
template<class T >
bool extractAndRemoveScalingAndShear (Matrix44< T > &mat, Vec3< T > &scl, Vec3< T > &shr, bool exc=true)
 
template<class T >
void extractEulerXYZ (const Matrix44< T > &mat, Vec3< T > &rot)
 
template<class T >
void extractEulerZYX (const Matrix44< T > &mat, Vec3< T > &rot)
 
template<class T >
Quat< T > extractQuat (const Matrix44< T > &mat)
 
template<class T >
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)
 
template<class T >
bool extractSHRT (const Matrix44< T > &mat, Vec3< T > &s, Vec3< T > &h, Vec3< T > &r, Vec3< T > &t, bool exc=true)
 
template<class T >
bool extractSHRT (const Matrix44< T > &mat, Vec3< T > &s, Vec3< T > &h, Euler< T > &r, Vec3< T > &t, bool exc=true)
 
template<class T >
bool checkForZeroScaleInRow (const T &scl, const Vec3< T > &row, bool exc=true)
 
template<class T >
Matrix44< T > outerProduct (const Vec4< T > &a, const Vec4< T > &b)
 Return the 4x4 outer product two 4-vectors. More...
 
template<class T >
Matrix44< T > rotationMatrix (const Vec3< T > &fromDirection, const Vec3< T > &toDirection)
 
template<class T >
Matrix44< T > rotationMatrixWithUpDir (const Vec3< T > &fromDir, const Vec3< T > &toDir, const Vec3< T > &upDir)
 
template<class T >
void alignZAxisWithTargetDir (Matrix44< T > &result, Vec3< T > targetDir, Vec3< T > upDir)
 
template<class T >
Matrix44< T > computeLocalFrame (const Vec3< T > &p, const Vec3< T > &xDir, const Vec3< T > &normal)
 
template<class T >
Matrix44< T > addOffset (const Matrix44< T > &inMat, const Vec3< T > &tOffset, const Vec3< T > &rOffset, const Vec3< T > &sOffset, const Vec3< T > &ref)
 
template<class T >
Matrix44< T > computeRSMatrix (bool keepRotateA, bool keepScaleA, const Matrix44< T > &A, const Matrix44< T > &B)
 
template<class T >
bool extractScaling (const Matrix33< T > &mat, Vec2< T > &scl, bool exc=true)
 
template<class T >
Matrix33< T > sansScaling (const Matrix33< T > &mat, bool exc=true)
 
template<class T >
bool removeScaling (Matrix33< T > &mat, bool exc=true)
 
template<class T >
bool extractScalingAndShear (const Matrix33< T > &mat, Vec2< T > &scl, T &shr, bool exc=true)
 
template<class T >
Matrix33< T > sansScalingAndShear (const Matrix33< T > &mat, bool exc=true)
 
template<class T >
bool removeScalingAndShear (Matrix33< T > &mat, bool exc=true)
 Remove scaling and shear from the given 3x3e matrix in place. More...
 
template<class T >
bool extractAndRemoveScalingAndShear (Matrix33< T > &mat, Vec2< T > &scl, T &shr, bool exc=true)
 
template<class T >
void extractEuler (const Matrix22< T > &mat, T &rot)
 
template<class T >
void extractEuler (const Matrix33< T > &mat, T &rot)
 
template<class T >
bool extractSHRT (const Matrix33< T > &mat, Vec2< T > &s, T &h, T &r, Vec2< T > &t, bool exc=true)
 
template<class T >
bool checkForZeroScaleInRow (const T &scl, const Vec2< T > &row, bool exc=true)
 
template<class T >
Matrix33< T > outerProduct (const Vec3< T > &a, const Vec3< T > &b)
 Return the 3xe outer product two 3-vectors. More...
 
template<class T >
Matrix44< T > addOffset (const Matrix44< T > &inMat, const Vec3< T > &tOffset, const Vec3< T > &rOffset, const Vec3< T > &sOffset, const Matrix44< T > &ref)
 
template<typename T >
M44d procrustesRotationAndTranslation (const Vec3< T > *A, const Vec3< T > *B, const T *weights, const size_t numPoints, const bool doScaling=false)
 
template<typename T >
M44d procrustesRotationAndTranslation (const Vec3< T > *A, const Vec3< T > *B, const size_t numPoints, const bool doScaling=false)
 
template<typename T >
void jacobiSVD (const Matrix33< T > &A, Matrix33< T > &U, Vec3< T > &S, Matrix33< T > &V, const T tol=std::numeric_limits< T >::epsilon(), const bool forcePositiveDeterminant=false)
 
template<typename T >
void jacobiSVD (const Matrix44< T > &A, Matrix44< T > &U, Vec4< T > &S, Matrix44< T > &V, const T tol=std::numeric_limits< T >::epsilon(), const bool forcePositiveDeterminant=false)
 
template<typename T >
void jacobiEigenSolver (Matrix33< T > &A, Vec3< T > &S, Matrix33< T > &V, const T tol)
 
template<typename T >
void jacobiEigenSolver (Matrix33< T > &A, Vec3< T > &S, Matrix33< T > &V)
 
template<typename T >
void jacobiEigenSolver (Matrix44< T > &A, Vec4< T > &S, Matrix44< T > &V, const T tol)
 
template<typename T >
void jacobiEigenSolver (Matrix44< T > &A, Vec4< T > &S, Matrix44< T > &V)
 
template<typename TM , typename TV >
void maxEigenVector (TM &A, TV &S)
 
template<typename TM , typename TV >
void minEigenVector (TM &A, TV &S)
 

Variables

IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
IMATH_EXPORT_CONST M22f 
identity22f
 M22f identity matrix. More...
 
IMATH_EXPORT_CONST M33f identity33f
 M33f identity matrix. More...
 
IMATH_EXPORT_CONST M44f identity44f
 M44f identity matrix. More...
 
IMATH_EXPORT_CONST M22d identity22d
 M22d identity matrix. More...
 
IMATH_EXPORT_CONST M33d identity33d
 M33d identity matrix. More...
 
IMATH_EXPORT_CONST M44d identity44d
 M44d identity matrix. More...
 

Function Documentation

template<class T >
Matrix44<T> addOffset ( const Matrix44< T > &  inMat,
const Vec3< T > &  tOffset,
const Vec3< T > &  rOffset,
const Vec3< T > &  sOffset,
const Vec3< T > &  ref 
)

Add a translate/rotate/scale offset to a 4x4 input frame and put it in another frame of reference

Parameters
[in]inMatInput frame
[in]tOffsetTranslation offset
[in]rOffsetRotation offset in degrees
[in]sOffsetScale offset
[in]refFrame of reference
Returns
The offsetted frame
template<class T >
Matrix44<T> addOffset ( const Matrix44< T > &  inMat,
const Vec3< T > &  tOffset,
const Vec3< T > &  rOffset,
const Vec3< T > &  sOffset,
const Matrix44< T > &  ref 
)

Add a translate/rotate/scale offset to an input frame and put it in another frame of reference.

Parameters
inMatinput frame
tOffsettranslate offset
rOffsetrotate offset in degrees
sOffsetscale offset
refFrame of reference
Returns
The offsetted frame

Definition at line 1027 of file ImathMatrixAlgo.h.

template<class T >
void 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 toDir and upDir are 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
[out]resultThe output matrix
[in]targetDirThe target direction vector
[in]upDirThe up direction vector

Definition at line 908 of file ImathMatrixAlgo.h.

template<class T >
bool checkForZeroScaleInRow ( const T &  scl,
const Vec3< T > &  row,
bool  exc = true 
)

Return true if the given scale can be removed from the given row matrix, false if scl is small enough that the operation would overflow. If exc is true, throw an exception on overflow.

Definition at line 828 of file ImathMatrixAlgo.h.

template<class T >
bool checkForZeroScaleInRow ( const T &  scl,
const Vec2< T > &  row,
bool  exc = true 
)

Return true if the given scale can be removed from the given row matrix, false if scl is small enough that the operation would overflow. If exc is true, throw an exception on overflow.

template<class T >
Matrix44< T > 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.

Parameters
[in]pThe position of the frame
[in]xDirThe x axis direction of the frame
[in]normalA normal to the y axis of the frame
Returns
The orthonormal frame

Definition at line 985 of file ImathMatrixAlgo.h.

template<class T >
Matrix44< T > computeRSMatrix ( bool  keepRotateA,
bool  keepScaleA,
const Matrix44< T > &  A,
const Matrix44< T > &  B 
)

Compute 4x4 translate/rotate/scale matrix from A with the rotate/scale of B.

Parameters
[in]keepRotateAIf true, keep rotate from matrix A, use B otherwise
[in]keepScaleAIf true, keep scale from matrix A, use B otherwise
[in]AMatrix A
[in]BMatrix B
Returns
Matrix A with tweaked rotation/scale

Definition at line 1060 of file ImathMatrixAlgo.h.

template<class T >
bool extractAndRemoveScalingAndShear ( Matrix44< T > &  mat,
Vec3< T > &  scl,
Vec3< T > &  shr,
bool  exc = true 
)

Remove scaling and shear from the given 4x4 matrix in place, returning the extracted values.

Parameters
[in,out]matThe matrix to operate on
[out]sclThe extracted scale
[out]shrThe extracted shear
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 523 of file ImathMatrixAlgo.h.

template<class T >
bool extractAndRemoveScalingAndShear ( Matrix33< T > &  mat,
Vec2< T > &  scl,
T &  shr,
bool  exc = true 
)

Remove scaling and shear from the given 3x3 matrix in place, returning the extracted values.

Parameters
[in,out]matThe matrix to operate on
[out]sclThe extracted scale
[out]shrThe extracted shear
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 1182 of file ImathMatrixAlgo.h.

template<class T >
void extractEuler ( const Matrix22< T > &  mat,
T &  rot 
)

Extract the rotation from the given 2x2 matrix

Parameters
[in]matThe input matrix
[out]rotThe extracted rotation value

Definition at line 1269 of file ImathMatrixAlgo.h.

template<class T >
void extractEuler ( const Matrix33< T > &  mat,
T &  rot 
)

Extract the rotation from the given 3x3 matrix

Parameters
[in]matThe input matrix
[out]rotThe extracted rotation value

Definition at line 1290 of file ImathMatrixAlgo.h.

template<class T >
void extractEulerXYZ ( const Matrix44< T > &  mat,
Vec3< T > &  rot 
)

Extract the rotation from the given 4x4 matrix in the form of XYZ euler angles.

Parameters
[in]matThe input matrix
[out]rotThe extracted XYZ euler angle vector

Definition at line 636 of file ImathMatrixAlgo.h.

template<class T >
void extractEulerZYX ( const Matrix44< T > &  mat,
Vec3< T > &  rot 
)

Extract the rotation from the given 4x4 matrix in the form of ZYX euler angles.

Parameters
[in]matThe input matrix
[out]rotThe extracted ZYX euler angle vector

Definition at line 679 of file ImathMatrixAlgo.h.

template<class T >
Quat< T > extractQuat ( const Matrix44< T > &  mat)

Extract the rotation from the given 4x4 matrix in the form of a quaternion.

Parameters
[in]matThe input matrix
Returns
The extracted quaternion

Definition at line 722 of file ImathMatrixAlgo.h.

template<class T >
bool extractScaling ( const Matrix44< T > &  mat,
Vec3< T > &  scl,
bool  exc = true 
)

Extract the scaling component of the given 4x4 matrix.

Parameters
[in]matThe input matrix
[out]sclThe extracted scale, i.e. the output value
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 419 of file ImathMatrixAlgo.h.

template<class T >
bool extractScaling ( const Matrix33< T > &  mat,
Vec2< T > &  scl,
bool  exc = true 
)

Extract the scaling component of the given 3x3 matrix.

Parameters
[in]matThe input matrix
[out]sclThe extracted scale, i.e. the output value
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 1089 of file ImathMatrixAlgo.h.

template<class T >
bool extractScalingAndShear ( const Matrix44< T > &  mat,
Vec3< T > &  scl,
Vec3< T > &  shr,
bool  exc = true 
)

Extract the scaling and shear components of the given 4x4 matrix. Return true if the scale could be successfully extracted, false if the matrix is degenerate.

Parameters
[in]matThe input matrix
[out]sclThe extracted scale
[out]shrThe extracted shear
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 473 of file ImathMatrixAlgo.h.

template<class T >
bool extractScalingAndShear ( const Matrix33< T > &  mat,
Vec2< T > &  scl,
T &  shr,
bool  exc = true 
)

Extract the scaling and shear components of the given 3x3 matrix. Return true if the scale could be successfully extracted, false if the matrix is degenerate.

Parameters
[in]matThe input matrix
[out]sclThe extracted scale
[out]shrThe extracted shear
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 1143 of file ImathMatrixAlgo.h.

template<class T >
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 
)

Extract the scaling, shear, rotation, and translation components of the given 4x4 matrix. The values are such that:

M = S * H * R * T
Parameters
[in]matThe input matrix
[out]sThe extracted scale
[out]hThe extracted shear
[out]rThe extracted rotation
[out]tThe extracted translation
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
[in]rOrderThe order with which to extract the rotation
Returns
True if the values could be extracted, false if the matrix is degenerate.

Definition at line 777 of file ImathMatrixAlgo.h.

template<class T >
bool extractSHRT ( const Matrix44< T > &  mat,
Vec3< T > &  s,
Vec3< T > &  h,
Vec3< T > &  r,
Vec3< T > &  t,
bool  exc = true 
)

Extract the scaling, shear, rotation, and translation components of the given 4x4 matrix.

Parameters
[in]matThe input matrix
[out]sThe extracted scale
[out]hThe extracted shear
[out]rThe extracted rotation, in XYZ euler angles
[out]tThe extracted translation
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the values could be extracted, false if the matrix is degenerate.

Definition at line 809 of file ImathMatrixAlgo.h.

template<class T >
bool extractSHRT ( const Matrix44< T > &  mat,
Vec3< T > &  s,
Vec3< T > &  h,
Euler< T > &  r,
Vec3< T > &  t,
bool  exc = true 
)

Extract the scaling, shear, rotation, and translation components of the given 4x4 matrix.

Parameters
[in]matThe input matrix
[out]sThe extracted scale
[out]hThe extracted shear
[out]rThe extracted rotation, in Euler angles
[out]tThe extracted translation
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the values could be extracted, false if the matrix is degenerate.

Definition at line 816 of file ImathMatrixAlgo.h.

template<class T >
bool extractSHRT ( const Matrix33< T > &  mat,
Vec2< T > &  s,
T &  h,
T &  r,
Vec2< T > &  t,
bool  exc = true 
)

Extract the scaling, shear, rotation, and translation components of the given 3x3 matrix. The values are such that:

M = S * H * R * T
Parameters
[in]matThe input matrix
[out]sThe extracted scale
[out]hThe extracted shear
[out]rThe extracted rotation
[out]tThe extracted translation
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the values could be extracted, false if the matrix is degenerate.

Definition at line 1311 of file ImathMatrixAlgo.h.

template<typename T >
void jacobiEigenSolver ( Matrix33< T > &  A,
Vec3< T > &  S,
Matrix33< T > &  V,
const tol 
)

Compute the eigenvalues (S) and the eigenvectors (V) of a real symmetric matrix using Jacobi transformation, using a given tolerance tol.

Jacobi transformation of a 3x3/4x4 matrix A outputs S and V: A = V * S * V^T where V is orthonormal and S is the diagonal matrix of eigenvalues. Input matrix A must be symmetric. A is also modified during the computation so that upper diagonal entries of A become zero.

template<typename T >
void jacobiEigenSolver ( Matrix33< T > &  A,
Vec3< T > &  S,
Matrix33< T > &  V 
)
inline

Compute the eigenvalues (S) and the eigenvectors (V) of a real symmetric matrix using Jacobi transformation.

Jacobi transformation of a 3x3/4x4 matrix A outputs S and V: A = V * S * V^T where V is orthonormal and S is the diagonal matrix of eigenvalues. Input matrix A must be symmetric. A is also modified during the computation so that upper diagonal entries of A become zero.

Definition at line 1474 of file ImathMatrixAlgo.h.

template<typename T >
void jacobiEigenSolver ( Matrix44< T > &  A,
Vec4< T > &  S,
Matrix44< T > &  V,
const tol 
)

Compute the eigenvalues (S) and the eigenvectors (V) of a real symmetric matrix using Jacobi transformation, using a given tolerance tol.

Jacobi transformation of a 3x3/4x4 matrix A outputs S and V: A = V * S * V^T where V is orthonormal and S is the diagonal matrix of eigenvalues. Input matrix A must be symmetric. A is also modified during the computation so that upper diagonal entries of A become zero.

template<typename T >
void jacobiEigenSolver ( Matrix44< T > &  A,
Vec4< T > &  S,
Matrix44< T > &  V 
)
inline

Compute the eigenvalues (S) and the eigenvectors (V) of a real symmetric matrix using Jacobi transformation.

Jacobi transformation of a 3x3/4x4 matrix A outputs S and V: A = V * S * V^T where V is orthonormal and S is the diagonal matrix of eigenvalues. Input matrix A must be symmetric. A is also modified during the computation so that upper diagonal entries of A become zero.

Definition at line 1501 of file ImathMatrixAlgo.h.

template<typename T >
void jacobiSVD ( const Matrix33< T > &  A,
Matrix33< T > &  U,
Vec3< T > &  S,
Matrix33< T > &  V,
const tol = std::numeric_limits< T >::epsilon(),
const bool  forcePositiveDeterminant = false 
)

Compute the SVD of a 3x3 matrix using Jacobi transformations. This method should be quite accurate (competitive with LAPACK) even for poorly conditioned matrices, and because it has been written specifically for the 3x3/4x4 case it is much faster than calling out to LAPACK.

The SVD of a 3x3/4x4 matrix A is defined as follows: A = U * S * V^T where S is the diagonal matrix of singular values and both U and V are orthonormal. By convention, the entries S are all positive and sorted from the largest to the smallest. However, some uses of this function may require that the matrix U*V^T have positive determinant; in this case, we may make the smallest singular value negative to ensure that this is satisfied.

Currently only available for single- and double-precision matrices.

template<typename T >
void jacobiSVD ( const Matrix44< T > &  A,
Matrix44< T > &  U,
Vec4< T > &  S,
Matrix44< T > &  V,
const tol = std::numeric_limits< T >::epsilon(),
const bool  forcePositiveDeterminant = false 
)

Compute the SVD of a 3x3 matrix using Jacobi transformations. This method should be quite accurate (competitive with LAPACK) even for poorly conditioned matrices, and because it has been written specifically for the 3x3/4x4 case it is much faster than calling out to LAPACK.

The SVD of a 3x3/4x4 matrix A is defined as follows: A = U * S * V^T where S is the diagonal matrix of singular values and both U and V are orthonormal. By convention, the entries S are all positive and sorted from the largest to the smallest. However, some uses of this function may require that the matrix U*V^T have positive determinant; in this case, we may make the smallest singular value negative to ensure that this is satisfied.

Currently only available for single- and double-precision matrices.

template<typename TM , typename TV >
void 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 >
void minEigenVector ( TM &  A,
TV &  S 
)

Compute a eigenvector corresponding to the abs min eigenvalue of a real symmetric matrix using Jacobi transformation.

template<class T >
Matrix44< T > outerProduct ( const Vec4< T > &  a,
const Vec4< T > &  b 
)

Return the 4x4 outer product two 4-vectors.

Definition at line 847 of file ImathMatrixAlgo.h.

template<class T >
Matrix33< T > outerProduct ( const Vec3< T > &  a,
const Vec3< T > &  b 
)

Return the 3xe outer product two 3-vectors.

Definition at line 1349 of file ImathMatrixAlgo.h.

template<typename T >
M44d procrustesRotationAndTranslation ( const Vec3< T > *  A,
const Vec3< T > *  B,
const T *  weights,
const size_t  numPoints,
const bool  doScaling = false 
)

Computes the translation and rotation that brings the 'from' points as close as possible to the 'to' points under the Frobenius norm. To be more specific, let x be the matrix of 'from' points and y be the matrix of 'to' points, we want to find the matrix A of the form [ R t ] [ 0 1 ] that minimizes || (A*x - y)^T * W * (A*x - y) ||_F If doScaling is true, then a uniform scale is allowed also.

Parameters
AFrom points
BTo points
weightsPer-point weights
numPointsThe number of points in A, B, and weights (must be equal)
doScalingIf true, include a scaling transformation
Returns
The procrustes transformation
template<typename T >
M44d procrustesRotationAndTranslation ( const Vec3< T > *  A,
const Vec3< T > *  B,
const size_t  numPoints,
const bool  doScaling = false 
)

Computes the translation and rotation that brings the 'from' points as close as possible to the 'to' points under the Frobenius norm. To be more specific, let x be the matrix of 'from' points and y be the matrix of 'to' points, we want to find the matrix A of the form [ R t ] [ 0 1 ] that minimizes || (A*x - y)^T * W * (A*x - y) ||_F If doScaling is true, then a uniform scale is allowed also.

Parameters
AFrom points
BTo points
numPointsThe number of points in A and B (must be equal)
doScalingIf true, include a scaling transformation
Returns
The procrustes transformation
template<class T >
bool removeScaling ( Matrix44< T > &  mat,
bool  exc = true 
)

Remove scaling from the given 4x4 matrix in place. Return true if the scale could be successfully extracted, false if the matrix is degenerate.

Parameters
[in]matThe matrix to operate on
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 453 of file ImathMatrixAlgo.h.

template<class T >
bool removeScaling ( Matrix33< T > &  mat,
bool  exc = true 
)

Remove scaling from the given 3x3 matrix in place. Return true if the scale could be successfully extracted, false if the matrix is degenerate.

Parameters
[in]matThe matrix to operate on
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 1123 of file ImathMatrixAlgo.h.

template<class T >
bool removeScalingAndShear ( Matrix44< T > &  mat,
bool  exc = true 
)

Remove scaling and shear from the given 4x4 matrix in place.

Parameters
[in,out]matThe matrix to operate on
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 510 of file ImathMatrixAlgo.h.

template<class T >
bool removeScalingAndShear ( Matrix33< T > &  mat,
bool  exc = true 
)

Remove scaling and shear from the given 3x3e matrix in place.

Parameters
[in,out]matThe matrix to operate on
[in]excIf true, throw an exception if the scaling in mat is very close to zero.
Returns
True if the scale could be extracted, false if the matrix is degenerate.

Definition at line 1169 of file ImathMatrixAlgo.h.

template<class T >
Matrix44< T > rotationMatrix ( const Vec3< T > &  fromDirection,
const Vec3< T > &  toDirection 
)

Return a 4x4 matrix that rotates the vector fromDirection to toDirection

Definition at line 869 of file ImathMatrixAlgo.h.

template<class T >
Matrix44< T > rotationMatrixWithUpDir ( const Vec3< T > &  fromDir,
const Vec3< T > &  toDir,
const Vec3< T > &  upDir 
)

Return a 4x4 matrix that rotates the fromDir vector so that it points towards `toDir1. You may also specify that you want the up vector to be pointing in a certain direction 1upDir`.

Definition at line 878 of file ImathMatrixAlgo.h.

template<class T >
Matrix44< T > sansScaling ( const Matrix44< T > &  mat,
bool  exc = true 
)

Return the given 4x4 matrix with scaling removed.

Parameters
[in]matThe input matrix
[in]excIf true, throw an exception if the scaling in mat

Definition at line 432 of file ImathMatrixAlgo.h.

template<class T >
Matrix33< T > sansScaling ( const Matrix33< T > &  mat,
bool  exc = true 
)

Return the given 3x3 matrix with scaling removed.

Parameters
[in]matThe input matrix
[in]excIf true, throw an exception if the scaling in mat

Definition at line 1102 of file ImathMatrixAlgo.h.

template<class T >
Matrix44< T > sansScalingAndShear ( const Matrix44< T > &  mat,
bool  exc = true 
)

Return the given 4x4 matrix with scaling and shear removed.

Parameters
[in]matThe input matrix
[in]excIf true, throw an exception if the scaling in mat is very close to zero.

Definition at line 485 of file ImathMatrixAlgo.h.

template<class T >
void sansScalingAndShear ( Matrix44< T > &  result,
const Matrix44< T > &  mat,
bool  exc = true 
)

Extract scaling and shear from the given 4x4 matrix in-place.

Parameters
[in,out]resultThe output matrix
[in]matThe return value if result is degenerate
[in]excIf true, throw an exception if the scaling in mat is very close to zero.

Definition at line 499 of file ImathMatrixAlgo.h.

template<class T >
Matrix33< T > sansScalingAndShear ( const Matrix33< T > &  mat,
bool  exc = true 
)

Return the given 3x3 matrix with scaling and shear removed.

Parameters
[in]matThe input matrix
[in]excIf true, throw an exception if the scaling in mat is very close to zero.

Definition at line 1155 of file ImathMatrixAlgo.h.

Variable Documentation

IMATH_EXPORT_CONST M22d identity22d

M22d identity matrix.

Definition at line 37 of file ImathMatrixAlgo.h.

IMATH_INTERNAL_NAMESPACE_HEADER_ENTER IMATH_EXPORT_CONST M22f identity22f

M22f identity matrix.

Definition at line 31 of file ImathMatrixAlgo.h.

IMATH_EXPORT_CONST M33d identity33d

M33d identity matrix.

Definition at line 39 of file ImathMatrixAlgo.h.

IMATH_EXPORT_CONST M33f identity33f

M33f identity matrix.

Definition at line 33 of file ImathMatrixAlgo.h.

IMATH_EXPORT_CONST M44d identity44d

M44d identity matrix.

Definition at line 41 of file ImathMatrixAlgo.h.

IMATH_EXPORT_CONST M44f identity44f

M44f identity matrix.

Definition at line 35 of file ImathMatrixAlgo.h.