3x3 matrix commonly used for pure rotations, but in general may also have scales and non-perpendicular rows and columns. More...
#include <rotmatrix.h>
Public Member Functions | |
void | InitIdentity () |
Initialize an identity matrix. More... | |
void | Zero () |
returns a zero matrix. More... | |
void | InitFromScale (double scale) |
Initializes a uniform scaling matrix. More... | |
void | InitFromScaleFactors (double xscale, double yscale, double zscale) |
Returns a scaling matrix with respective x, y, and z scaling factors. More... | |
void | ScaleRows (RotMatrixCR inMatrix, double xScale, double yScale, double zScale) |
Applies scale factors to corresponding rows of the input matrix, and places the result in this instance matrix. More... | |
void | ScaleColumns (RotMatrixCR in, double xs, double ys, double zs) |
Applies scale factors to corresponding columns of the input matrix, and places the result in this instance matrix. More... | |
void | ScaleColumns (double xs, double ys, double zs) |
Applies scale factors to corresponding columns. More... | |
void | NormalizeRowsOf (RotMatrixCR inMatrix, DVec3dR scaleVector) |
Returns a matrix whose rows are unit vectors in the same drection as corresponding rows of the input matrix. More... | |
void | NormalizeColumnsOf (RotMatrixCR inMatrix, DVec3dR scaleVector) |
Returns a matrix whose rows are unit vectors in the same drection as corresponding columns of the input matrix. More... | |
void | Scale (RotMatrixCR leftMatrix, double xs, double ys, double zs, RotMatrixCR rightMatrix) |
Returns a matrix formed from a scaling matrix which is multiplied on the left and/or right with other matrices. More... | |
void | InitFromScaledOuterProduct (DVec3dCR vectorU, DVec3dCR vectorV, double scale) |
Returns a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e. More... | |
void | AddScaledOuterProductInPlace (DVec3dCR vectorU, DVec3dCR vectorV, double scale) |
Accumulates a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e. More... | |
void | ShuffleColumnsOf (RotMatrixCR inMatrix, int i0, int i1, int i2) |
Moves columns 0, 1, 2 of the input matrix into columns i0, i1, i2 of the instance. More... | |
void | InitFromRowValues (double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22) |
Initializes a matrix with the 9 specified coefficients given in "row major" order. More... | |
void | InitFromRowValuesXY (double x00, double x01, double x10, double x11) |
Initializes a matrix with the 4 specified coefficients in xx,xy,yx,yy positions, and 1 in zz in "row major" order. More... | |
void | InitFromRowValuesXY (double const data[4]) |
Initializes a matrix with 4 coefficients in xx,xy,yx,yy positions, and 1 in zz in "row major" order. More... | |
void | InitFromColumnVectors (DVec3dCR vectorU, DVec3dCR vectorV, DVec3dCR vectorW) |
Returns a matrix with 3 points copied to respective columns. More... | |
void | InitFromRowVectors (DVec3dCR vectorU, DVec3dCR vectorV, DVec3dCR vectorW) |
Initializes a matrix with 3 points copied to respective rows. More... | |
void | InitFromVectorAndRotationAngle (DVec3dCR axis, double radians) |
Initializes a matrix representing rotation around a vector. More... | |
void | InitFromAxisAndRotationAngle (int axis, double radians) |
Returns a matrix of rotation about the x,y, or z axis (indicated by axis = 0,1, or 2) by an angle in radians. More... | |
bool | InitRotationFromVectorToVector (DVec3dCR startVector, DVec3dCR endVector) |
(conditionally) initialize the instance as the (smallest) rotation that moves startVector so it is in the direction of endVector. More... | |
void | InitFromDirectionAndScale (DVec3dCR vector, double scale) |
Initializes a matrix which scales along a vector direction. More... | |
void | InitFromPrincipleAxisRotations (RotMatrixCR inMatrix, double xrot, double yrot, double zrot) |
Returns the product {RX*RY*RZ*M} where RX, RY, and RZ are rotations (in radians) around X, Y, and Z axes, and M is the input matrix. More... | |
bool | InitFrom1Vector (DVec3dCR dir, int axis, bool normalize) |
Initializes this instance matrix so that the indicated axis (axis = 0,1,or 2) is aligned with the vector dir. More... | |
void | InitFrom2Vectors (DVec3dCR xVector, DVec3dCR yVector) |
Copies vectors into the x and y columns of this instance matrix and sets the z column to their cross product. More... | |
bool | InitRotationFromOriginXY (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Set this instance matrix to be an orthogonal (rotation) matrix with column 0 in the direction from the origin to the x point, column 1 in the plane of the 3 points, directed so the Y point on the positive side, and column 2 as their cross product. More... | |
bool | SquareAndNormalizeColumns (RotMatrixCR inMatrix, int primaryAxis, int secondaryAxis) |
Adjust the direction and length of columns of the input matrix to produce an instance matrix which has perpendicular, unit length columns. More... | |
bool | SquareAndNormalizeColumns (RotMatrixCR inMatrix, int primaryAxis, int secondaryAxis, int preferredOrientation) |
bool | SquareAndNormalizeColumnsAnyOrder (RotMatrixCR inMatrix, int preferredOrientation) |
Returns an orthogonal matrix that preserves aligns with the columns of inMatrix. More... | |
bool | SquareAndNormalizeColumnsAnyOrder (RotMatrixCR inMatrix) |
Returns an orthogonal matrix that preserves aligns with the columns of inMatrix. More... | |
void | InitFrom (TransformCR transform) |
Sets this instance matrix by copying the matrix part of the trasnform. More... | |
void | Copy (RotMatrixCR in) |
Sets this instance matrix by copying from the matrix parameter. More... | |
void | InitProduct (RotMatrixCR rotMatrixA, RotMatrixCR rotMatrixB) |
Returns the product {A*B} of two matrices. More... | |
void | InitProduct (RotMatrixCR rotMatrixA, RotMatrixCR rotMatrixB, RotMatrixCR rotMatrixC) |
Returns the product of three matrices. More... | |
void | InitProduct (RotMatrixCR rotMatrixA, TransformCR transformB) |
Sets this instance to the product of matrix rotMatrixA times the matrix part of transform transformB. More... | |
void | InitProduct (TransformCR transformA, RotMatrixCR rotMatrixB) |
Returns to the product of the matrix part of transform transformA times matrix rotMatrixB. More... | |
void | InitProductRotMatrixTransposeRotMatrix (RotMatrixCR rotMatrixA, RotMatrixCR rotMatrixB) |
Returns the product of the transpose of rotMatrixA times rotMatrixB. More... | |
void | InitProductRotMatrixRotMatrixTranspose (RotMatrixCR rotMatrixA, RotMatrixCR rotMatrixB) |
Returns the product of rotMatrixA times the transpose of rotMatrixB. More... | |
void | TransposeOf (RotMatrixCR matrix) |
Initializes this instance as the transpose of a matrix. More... | |
void | Transpose () |
Transposes a matrix in place. More... | |
void | SumOf (RotMatrixCR matrix0, RotMatrixCR matrix1, double scale1, RotMatrixCR matrix2, double scale2) |
Returns {Matrix0 + Matrix1*s1+Matrix2*s2}, i.e. More... | |
void | Add (RotMatrixCR delta) |
Add a matrix (componentwise, in place). More... | |
void | Subtract (RotMatrixCR delta) |
Subtract a matrix (componentwise, in place). More... | |
bool | InverseOf (RotMatrixCR forward) |
Returns the inverse of the a matrix. More... | |
bool | Invert () |
Inverts this instance matrix in place. More... | |
void | Multiply (DPoint4dP result, DPoint4dCP point, int numPoint) const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point. More... | |
void | Multiply (DPoint2dP result, DPoint2dCP point, int numPoint) const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point. More... | |
void | Multiply (DRange3dR outRange, DRange3dCR inRange) const |
computes the 8 corner points of the range cube defined by the two points of pRange, multiplies matrix times each point, and computes the twopoint range limits (min max) of the resulting rotated box. More... | |
void | Multiply (DPoint3dR point) const |
Computes the product {M*P} where M is this instance matrix and P the input point. More... | |
void | Multiply (DPoint3dR result, DPoint3dCR point) const |
Returns the product of a matrix times a point. More... | |
void | MultiplyTranspose (DPoint3dR result, DPoint3dCR point) const |
Returns the product of a matrix transpose times a point. More... | |
void | MultiplyComponents (DPoint3dR result, double x, double y, double z) const |
Returns the product of a matrix times a point, with the point given as separate components. More... | |
void | MultiplyTranspose (DPoint3dR point) const |
Computes the product {P*M} where M is this instance matrix and P is the input point The result overwrites the previous coordinates in the point. More... | |
void | MultiplyTransposeComponents (DPoint3dR result, double x, double y, double z) const |
Returns the product P = [x,y,z]*M where M is the input matrix and P is the product point. More... | |
void | Multiply (DPoint3dP result, DPoint3dCP point, int numPoint) const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point. More... | |
void | MultiplyTranspose (DPoint3dP result, DPoint3dCP point, int numPoint) const |
Computes {P[i]*M} where M is this instance matrix and each P[i] is a point in the input array point, transposed into row form. More... | |
void | Multiply (bvector< DPoint3d > &outXYZ, bvector< DPoint3d > const &inXYZ) const |
Description Multiply points. (Matrix on left, point on right as column vector) More... | |
void | MultiplyTranspose (bvector< DPoint3d > &outXYZ, bvector< DPoint3d > const &inXYZ) const |
Multiply the transposed matrix times points. (Tranposed matrix on left, point on right as column vector. Or (equivalent) point on left as row vector, matrix on right) More... | |
void | Multiply (bvector< DPoint2d > &out, bvector< DPoint2d > const &in) const |
Description Multiply 2D points. (Matrix on left, point on right as column vector) More... | |
void | Multiply (bvector< DPoint4d > &xyzwOut, bvector< DPoint4d > const &xyzwIn) const |
Multiply xyzw, with matrix w row and column 0001. More... | |
bool | SolveArray (bvector< DPoint3d > &xyzOut, bvector< DPoint3d > const &xyzIn) const |
Solve M*xyzOut[i] = xyzIn[i] for array of points. More... | |
bool | Solve (DPoint3dR result, DPoint3dCR point) const |
Return the product of a matrix inverse and a point. More... | |
bool | SolveTranspose (DPoint3dR result, DPoint3dCR point) const |
Return the product of a matrix inverse transpose and a point. More... | |
bool | SolveArray (DPoint3dP result, DPoint3dCP point, int numPoints) const |
Solves the matrix equation AX=B, where A is this instance, B is the matrix of numPoints input points and X is the matrix of numPoints output points. More... | |
void | GetColumns (DVec3dR vectorU, DVec3dR vectorV, DVec3dR vectorW) const |
Copies from columns of this instance matrix to corresponding points. More... | |
void | GetRows (DVec3dR vectorU, DVec3dR vectorV, DVec3dR vectorW) const |
Copies from rows of this instance matrix to corresponding points. More... | |
void | GetColumn (DVec3dR vector, int col) const |
Returns a point taken from a column of a matrix. More... | |
void | GetRow (DVec3dR vector, int row) const |
Returns a vector taken from a column of a matrix. More... | |
void | SetColumn (DVec3dCR vector, int col) |
Set the components in a column. More... | |
void | SetRow (DVec3dCR vector, int row) |
Set the components in a row. More... | |
double | GetComponentByRowAndColumn (int row, int col) const |
Returns a value from a specified row and column of the matrix. More... | |
void | GetRowValues (double &x00, double &x01, double &x02, double &x10, double &x11, double &x12, double &x20, double &x21, double &x22) const |
Get all contents as individual doubles, moving along rows. More... | |
void | GetRowValuesXY (double data[4]) const |
Copies 4 doubles from xx,xy,yx,yy positions into an array. More... | |
double | Determinant () const |
Returns the determinant of the matrix. More... | |
double | ConditionNumber () const |
Computes an estimate of the condition of this instance matrix. More... | |
bool | IsIdentity () const |
Tests if a matrix is the identity matrix. More... | |
bool | IsDiagonal () const |
Tests if a matrix has small offdiagonal entries compared to diagonals. More... | |
bool | IsUniformScale (double &maxScale) const |
Tests if a matrix has (nearly) equal diagaonal entries and (nearly) zero off diagonals. More... | |
void | DiagonalSignedRange (double &minValue, double &maxValue) const |
Return the (signed) range of entries on the diagonal. More... | |
void | DiagonalAbsRange (double &minValue, double &maxValue) const |
Return the (absolute value) range of entries on the diagonal. More... | |
void | OffDiagonalSignedRange (double &minValue, double &maxValue) const |
Return the (signed) range of entries off the diagonal. More... | |
void | OffDiagonalAbsRange (double &minValue, double &maxValue) const |
Return the (absolute value) range of entries off the diagonal. More... | |
DRange1d | LowerTriangleAbsRange () |
return the range of absolute values strictly below the diagonal. More... | |
DRange1d | UpperTriangleAbsRange () |
return the range of absolute values strictly above the diagonal. More... | |
DRange1d | DiagonalAbsRange () |
return the range of absolute values on the diagonal. More... | |
double | LowerTriangleMaxAbs () |
return the largest absolute value in the lower triangle. More... | |
double | UpperTriangleMaxAbs () |
return the largest absolute value in the upper triangle. More... | |
double | DiagonalMaxAbs () |
return the largest absolute value on the diagonal More... | |
double | SumSquares () const |
Return the sum of squares of coefficients in a matrix. More... | |
double | MaxAbs () const |
Find the largest absolute value of entries in the matrix. More... | |
double | MaxDiff (RotMatrixCR matrix2) const |
Returns the largest absolute value difference between corresponding coefficients in Matrix1 and Matrix2. More... | |
double | SumDiagonalSquares () const |
Computes the sum of the squares of the diagonal entries of this instance matrix. More... | |
double | SumOffDiagonalSquares () const |
Computes the sum of the squares of the off-diagonal entries of this instance matrix. More... | |
bool | IsSignedPermutation () const |
Test if this instance matrix does nothing more than exchange and possibly negate principle axes. More... | |
bool | IsNearSignedPermutation (RotMatrixR result, double tolerance) const |
Test if this instance matrix does nothing more than exchange and possibly negate principle axes, within a tolerance. More... | |
bool | IsRigid () const |
Test if a matrix is a rigid body rotation, i.e. More... | |
bool | IsOrthogonal () const |
Test if this instance matrix is orthogonal, i.e. More... | |
bool | IsOrthonormal (RotMatrixR columns, DVec3dR axisScales, double &axisRatio) const |
Test if this instance matrix has orthonormal columns, i.e. More... | |
bool | IsRigidScale (RotMatrixR columns, double &scale) const |
Test if this instance matrix is composed of only rigid rotation and scaling. More... | |
bool | IsNearRigidScale (RotMatrixR dest, int primaryAxis=0, double tolerance=1.0e-6) const |
Determine if a matrix is close to a pure rotate and scale. More... | |
bool | IsPlanar (DVec3dCR normal) const |
Tests if this instance matrix has no effects perpendicular to any plane with the given normal. More... | |
bool | IsEqual (RotMatrixCR matrix2) const |
Tests for equality between two matrices "Equality" means relative error less than 1.0e-12, in the sense that each component-wise difference is less than 1.0e-12 times the largest absolute value of the components of one matrix. More... | |
bool | IsEqual (RotMatrixCR matrix2, double tolerance) const |
Tests for equality between two matrices. More... | |
int | FactorRotateScaleRotate (RotMatrixR rotation1, DPoint3dR scalePoint, RotMatrixR rotation2) const |
Factor as {rotation1 * scale * rotation2}. More... | |
bool | RotateAndSkewFactors (RotMatrixR rotation, RotMatrixR skewFactor, int primaryAxis, int secondaryAxis) const |
Factor as {rotation*skewFactor} where the rotation favors indicated primary and secondary axes. More... | |
bool | FactorOrthogonalColumns (RotMatrixR matrixB, RotMatrixR matrixV) const |
Factor the instance as a product B*V^ where B has mutually perpendicular columns and V is orthogonal. More... | |
void | InitFromQuaternion (DPoint4dCR quat) |
void | InitFromQuaternion (const double *pQuatAsDoubleArray) |
void | InitTransposedFromQuaternionWXYZ (const double *pQuatAsDoubleArray) |
Initialization, compatible with mdlRMatrix_fromQuat. More... | |
void | GetQuaternion (DPoint4dR quat, bool transpose) const |
void | GetQuaternion (double *pQuatAsDoubleArray, bool transpose) const |
double | GetRotationAngleAndVector (DVec3dR axis) const |
Returns the angle of rotation of this instance and sets axis to be the normalized vector about which this instance rotates. More... | |
double | ColumnXAngleXY () const |
Returns the (0 or positive) angle from (1,0) to the XY vector in the first column. More... | |
void | GivensRowOp (double c, double s, int i0, int i1) |
Apply a Givens "row operation", i.e. More... | |
void | GivensColumnOp (double c, double s, int i0, int i1) |
Apply a Givens "column operation", i.e. More... | |
void | HyperbolicRowOp (double secant, double tangent, int i0, int i1) |
Apply a hyperbolic "row operation", i.e. More... | |
void | HyperbolicColumnOp (double secant, double tangent, int i0, int i1) |
Apply a hyperbolic "column operation", i.e. More... | |
Static Public Member Functions | |
static RotMatrix | FromIdentity () |
Returns an identity matrix. More... | |
static RotMatrix | FromScale (double scale) |
Returns a uniform scaling matrix. More... | |
static RotMatrix | FromScaleFactors (double xscale, double yscale, double zscale) |
Returns a scaling matrix with respective x, y, and z scaling factors. More... | |
static RotMatrix | FromScaledOuterProduct (DVec3dCR vectorU, DVec3dCR vectorV, double scale) |
Returns a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e. More... | |
static RotMatrix | FromRowValues (double x00, double x01, double x02, double x10, double x11, double x12, double x20, double x21, double x22) |
Returns a matrix with the 9 specified coefficients given in "row major" order. More... | |
static RotMatrix | FromColumnVectors (DVec3dCR vectorU, DVec3dCR vectorV, DVec3dCR vectorW) |
Returns a matrix with 3 vectors copied to respective columns. More... | |
static RotMatrix | FromRowVectors (DVec3dCR vectorU, DVec3dCR vectorV, DVec3dCR vectorW) |
Returns a matrix with 3 vectors copied to respective rows. More... | |
static RotMatrix | FromVectorAndRotationAngle (DVec3dCR axis, double radians) |
Returns a matrix representing rotation around a vector. More... | |
static RotMatrix | FromVectorAndRotationAngle (DVec3dCR axis, double radians, RotMatrixR derivativeMatrix) |
Returns a matrix representing rotation around a vector. More... | |
static RotMatrix | FromAxisAndRotationAngle (int axis, double radians) |
Returns a matrix of rotation about the x,y, or z axis (indicated by axis = 0,1, or 2) by an angle in radians. More... | |
static RotMatrix | FromRotate90 (DVec3dCR axis) |
Return a matrix for retation of 90 degrees about a vector. More... | |
static RotMatrix | FromDirectionAndScale (DVec3dCR vector, double scale) |
Returns a matrix which scales along a vector direction. More... | |
static RotMatrix | FromPrincipleAxisRotations (RotMatrixCR inMatrix, double xrot, double yrot, double zrot) |
Returns the product {RX*RY*RZ*M} where RX, RY, and RZ are rotations (in radians) around X, Y, and Z axes, and M is the input matrix. More... | |
static RotMatrix | From1Vector (DVec3dCR dir, int axis, bool normalize) |
Initializes this instance matrix so that the indicated axis (axis = 0,1,or 2) is aligned with the vector dir. More... | |
static RotMatrix | From2Vectors (DVec3dCR xVector, DVec3dCR yVector) |
Returns a matrix copying vectors into the x and y columns of this instance matrix and sets the z column to their cross product. More... | |
static RotMatrix | RotationFromOriginXY (DPoint3dCR origin, DPoint3dCR xPoint, DPoint3dCR yPoint) |
Set this instance matrix to be an orthogonal (rotation) matrix with column 0 in the direction from the origin to the x point, column 1 in the plane of the 3 points, directed so the Y point on the positive side, and column 2 as their cross product. More... | |
static RotMatrix | From (TransformCR transform) |
Returns a matrix copying the matrix part of the trasnform. More... | |
static RotMatrix | FromTransposeOf (RotMatrixCR matrix) |
Return (as function value) the transpose of a matrix. More... | |
static RotMatrix | FromQuaternion (DPoint4dCR quat) |
static RotMatrix | FromQuaternion (const double *pQuatAsDoubleArray) |
Public Attributes | |
double | form3d [3][3] |
matrix coefficients. These are public, but direct use of the arrays is discouraged. More... | |
3x3 matrix commonly used for pure rotations, but in general may also have scales and non-perpendicular rows and columns.
void Add | ( | RotMatrixCR | delta | ) |
Add a matrix (componentwise, in place).
[in] | delta | The matrix to add |
Accumulates a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e.
as the matrix {s*U*V^T}
[in] | vectorU | The column vector U |
[in] | vectorV | The row vector V |
[in] | scale | The scale factor |
double ColumnXAngleXY | ( | ) | const |
Returns the (0 or positive) angle from (1,0) to the XY vector in the first column.
double ConditionNumber | ( | ) | const |
Computes an estimate of the condition of this instance matrix.
Values near 0 are bad.
void Copy | ( | RotMatrixCR | in | ) |
Sets this instance matrix by copying from the matrix parameter.
[in] | in | The source matrix |
double Determinant | ( | ) | const |
Returns the determinant of the matrix.
void DiagonalAbsRange | ( | double & | minValue, |
double & | maxValue | ||
) | const |
Return the (absolute value) range of entries on the diagonal.
[out] | minValue | smallest absolute value |
[out] | maxValue | largest absolute value |
DRange1d DiagonalAbsRange | ( | ) |
return the range of absolute values on the diagonal.
double DiagonalMaxAbs | ( | ) |
return the largest absolute value on the diagonal
void DiagonalSignedRange | ( | double & | minValue, |
double & | maxValue | ||
) | const |
Return the (signed) range of entries on the diagonal.
[out] | minValue | smallest signed value |
[out] | maxValue | largest signed value |
bool FactorOrthogonalColumns | ( | RotMatrixR | matrixB, |
RotMatrixR | matrixV | ||
) | const |
Factor the instance as a product B*V^ where B has mutually perpendicular columns and V is orthogonal.
[out] | matrixB | orthogonal columns |
[out] | matrixV | transpose of right factor. (I.e. B = A*V) |
int FactorRotateScaleRotate | ( | RotMatrixR | rotation1, |
DPoint3dR | scalePoint, | ||
RotMatrixR | rotation2 | ||
) | const |
Factor as {rotation1 * scale * rotation2}.
[out] | rotation1 | pure rotation |
[out] | scalePoint | scale factors, largest first. |
[out] | rotation2 | pure rotation |
|
static |
Returns a matrix copying the matrix part of the trasnform.
[in] | transform | The transformation whose matrix part is returned |
Initializes this instance matrix so that the indicated axis (axis = 0,1,or 2) is aligned with the vector dir.
The normalize flag selects between normalized axes (all matrix columns of unit length) and unnormalized axes (all matrix columns of same length as the dir vector).
[in] | dir | The fixed direction vector |
[in] | axis | The axis column to be aligned with direction |
[in] | normalize | true to have normalized columns |
Returns a matrix copying vectors into the x and y columns of this instance matrix and sets the z column to their cross product.
Use squareAndNormalizeColumns to force these (possibly skewed and scaled) coordinate axes to be perpendicular
[in] | xVector | The vector to place in column 0 |
[in] | yVector | The vector to place in column 1 |
|
static |
Returns a matrix of rotation about the x,y, or z axis (indicated by axis = 0,1, or 2) by an angle in radians.
[in] | axis | The axis index 0=x, 1=y, 2=z |
[in] | radians | The rotation angle in radians |
Returns a matrix with 3 vectors copied to respective columns.
[in] | vectorU | The vector to insert in column 0 |
[in] | vectorV | The vector to insert in column 1 |
[in] | vectorW | The vector to insert in column 2 |
Returns a matrix which scales along a vector direction.
[in] | vector | The scaling direction |
[in] | scale | The scale factor |
|
static |
Returns an identity matrix.
|
static |
Returns the product {RX*RY*RZ*M} where RX, RY, and RZ are rotations (in radians) around X, Y, and Z axes, and M is the input matrix.
[in] | inMatrix | The prior matrix |
[in] | xrot | The x axis rotation |
[in] | yrot | The y axis rotation |
[in] | zrot | The z axis rotation |
|
static |
[in] | quat | The quaternion, stored as (xyzw) |
|
static |
[in] | pQuatAsDoubleArray | The quaternion, stored as (w,x,y,z) in an array of doubles. |
Return a matrix for retation of 90 degrees about a vector.
|
static |
Returns a matrix with the 9 specified coefficients given in "row major" order.
[in] | x00 | The 00 entry |
[in] | x01 | The 01 entry |
[in] | x02 | The 02 entry |
[in] | x10 | The 10 entry |
[in] | x11 | The 11 entry |
[in] | x12 | The 12 entry |
[in] | x20 | The 20 entry |
[in] | x21 | The 21 entry |
[in] | x22 | The 22 entry |
Returns a matrix with 3 vectors copied to respective rows.
[in] | vectorU | The vector to insert in row 0 |
[in] | vectorV | The vector to insert in row 1 |
[in] | vectorW | The vector to insert in row 2 |
|
static |
Returns a uniform scaling matrix.
[in] | scale | The scale factor. |
Returns a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e.
as the matrix {s*U*V^T}
[in] | vectorU | The column vector U |
[in] | vectorV | The row vector V |
[in] | scale | The scale factor |
|
static |
Returns a scaling matrix with respective x, y, and z scaling factors.
[in] | xscale | The x direction scale factor (00 diagonal) |
[in] | yscale | The y direction scale factor (11 diagonal) |
[in] | zscale | The z direction scale factor (22 diagonal) |
|
static |
Return (as function value) the transpose of a matrix.
[in] | matrix | The input matrix |
Returns a matrix representing rotation around a vector.
[in] | axis | The axis of rotation |
[in] | radians | The rotation angle |
|
static |
Returns a matrix representing rotation around a vector.
Also returns its derivatives with respect to the angle.
[in] | axis | The axis of rotation |
[in] | radians | The rotation angle |
[out] | derivativeMatrix | derivative of returned matrix. |
void GetColumn | ( | DVec3dR | vector, |
int | col | ||
) | const |
Returns a point taken from a column of a matrix.
[out] | vector | filled vector |
[in] | col | The index of column to extract. Column indices are 0, 1, 2. |
Copies from columns of this instance matrix to corresponding points.
[out] | vectorU | first column |
[out] | vectorV | second column |
[out] | vectorW | third column |
double GetComponentByRowAndColumn | ( | int | row, |
int | col | ||
) | const |
Returns a value from a specified row and column of the matrix.
[in] | row | The index of row to read. Row indices are 0, 1, 2. |
[in] | col | The index of column to read. Column indices are 0, 1, 2. |
void GetQuaternion | ( | DPoint4dR | quat, |
bool | transpose | ||
) | const |
[out] | quat | quaternion, stored as xyzw |
[in] | transpose | true if matrix is stored transposed |
void GetQuaternion | ( | double * | pQuatAsDoubleArray, |
bool | transpose | ||
) | const |
[out] | pQuatAsDoubleArray | quaternion, stored as (w,x,y,z) in an array of doubles. |
[in] | transpose | true if matrix is stored transposed |
double GetRotationAngleAndVector | ( | DVec3dR | axis | ) | const |
Returns the angle of rotation of this instance and sets axis to be the normalized vector about which this instance rotates.
NOTE: this instance is assumed to be a (rigid body, i.e. orthogonal) rotation matrix. Since negating both angle and axis produces an identical rotation, calculations are simplified by assuming (and returning) the angle in [0,Pi].
[out] | axis | normalized axis of rotation |
void GetRow | ( | DVec3dR | vector, |
int | row | ||
) | const |
Returns a vector taken from a column of a matrix.
[out] | vector | filled vector |
[in] | row | The index of row to extract. Row indices are 0, 1, and 2. |
Copies from rows of this instance matrix to corresponding points.
[out] | vectorU | first row |
[out] | vectorV | second row |
[out] | vectorW | third row |
void GetRowValues | ( | double & | x00, |
double & | x01, | ||
double & | x02, | ||
double & | x10, | ||
double & | x11, | ||
double & | x12, | ||
double & | x20, | ||
double & | x21, | ||
double & | x22 | ||
) | const |
Get all contents as individual doubles, moving along rows.
void GetRowValuesXY | ( | double | data[4] | ) | const |
Copies 4 doubles from xx,xy,yx,yy positions into an array.
[out] | data | returned data – first 2 entries in row 0, then first 2 in row 1. |
void GivensColumnOp | ( | double | c, |
double | s, | ||
int | i0, | ||
int | i1 | ||
) |
Apply a Givens "column operation", i.e.
post-multiply by a Givens rotation matrix. The Givens matrix is an identity except for the 4 rotational entries, viz R(i0,i0)=R(i1,i1)=c R(i0,i1)=-s R(i1,i0)=s
[in] | c | The cosine of givens rotation. |
[in] | s | The sine of givens rotation. |
[in] | i0 | The index of the first affected row. |
[in] | i1 | The index of the second affected row. |
void GivensRowOp | ( | double | c, |
double | s, | ||
int | i0, | ||
int | i1 | ||
) |
Apply a Givens "row operation", i.e.
pre-multiply by a Givens rotation matrix. The Givens matrix is an identity except for the 4 rotational entries, viz R(i0,i0)=R(i1,i1)=c R(i0,i1)=s R(i1,i0)=-s
[in] | c | The cosine of givens rotation. |
[in] | s | The sine of givens rotation. |
[in] | i0 | The index of the first affected row. |
[in] | i1 | The index of the second affected row. |
void HyperbolicColumnOp | ( | double | secant, |
double | tangent, | ||
int | i0, | ||
int | i1 | ||
) |
Apply a hyperbolic "column operation", i.e.
pre-multiply by a hyperbolic reflection matrix The matrix is an identity except for the 4 entries R(i0,i0)=R(i1,i1)=secant R(i0,i1)=R(i1,i0)=tangent
[in] | secant | The cosine of reflection. |
[in] | tangent | The sine of reflection. |
[in] | i0 | The index of the first affected row. |
[in] | i1 | The index of the second affected row. |
void HyperbolicRowOp | ( | double | secant, |
double | tangent, | ||
int | i0, | ||
int | i1 | ||
) |
Apply a hyperbolic "row operation", i.e.
pre-multiply by a hyperbolic reflection matrix The matrix is an identity except for the 4 entries R(i0,i0)=R(i1,i1)=secant R(i0,i1)=R(i1,i0)=tangent
[in] | secant | The cosine of reflection. |
[in] | tangent | The sine of reflection. |
[in] | i0 | The index of the first affected row. |
[in] | i1 | The index of the second affected row. |
void InitFrom | ( | TransformCR | transform | ) |
Sets this instance matrix by copying the matrix part of the trasnform.
[in] | transform | The transformation whose matrix part is returned |
bool InitFrom1Vector | ( | DVec3dCR | dir, |
int | axis, | ||
bool | normalize | ||
) |
Initializes this instance matrix so that the indicated axis (axis = 0,1,or 2) is aligned with the vector dir.
The normalize flag selects between normalized axes (all matrix columns of unit length) and unnormalized axes (all matrix columns of same length as the dir vector).
[in] | dir | The fixed direction vector |
[in] | axis | The axis column to be aligned with direction |
[in] | normalize | true to have normalized columns |
Copies vectors into the x and y columns of this instance matrix and sets the z column to their cross product.
Use squareAndNormalizeColumns to force these (possibly skewed and scaled) coordinate axes to be perpendicular
[in] | xVector | The vector to place in column 0 |
[in] | yVector | The vector to place in column 1 |
void InitFromAxisAndRotationAngle | ( | int | axis, |
double | radians | ||
) |
Returns a matrix of rotation about the x,y, or z axis (indicated by axis = 0,1, or 2) by an angle in radians.
[in] | axis | The axis index 0=x, 1=y, 2=z |
[in] | radians | The rotation angle in radians |
Returns a matrix with 3 points copied to respective columns.
[in] | vectorU | The vector to insert in column 0 |
[in] | vectorV | The vector to insert in column 1 |
[in] | vectorW | The vector to insert in column 2 |
void InitFromDirectionAndScale | ( | DVec3dCR | vector, |
double | scale | ||
) |
Initializes a matrix which scales along a vector direction.
[in] | vector | The scaling direction |
[in] | scale | The scale factor |
void InitFromPrincipleAxisRotations | ( | RotMatrixCR | inMatrix, |
double | xrot, | ||
double | yrot, | ||
double | zrot | ||
) |
Returns the product {RX*RY*RZ*M} where RX, RY, and RZ are rotations (in radians) around X, Y, and Z axes, and M is the input matrix.
[in] | inMatrix | The prior matrix |
[in] | xrot | The x axis rotation |
[in] | yrot | The y axis rotation |
[in] | zrot | The z axis rotation |
void InitFromQuaternion | ( | DPoint4dCR | quat | ) |
[in] | quat | The quaternion, stored as (xyzw) |
void InitFromQuaternion | ( | const double * | pQuatAsDoubleArray | ) |
[in] | pQuatAsDoubleArray | The quaternion, stored as (w,x,y,z) in an array of doubles. |
void InitFromRowValues | ( | double | x00, |
double | x01, | ||
double | x02, | ||
double | x10, | ||
double | x11, | ||
double | x12, | ||
double | x20, | ||
double | x21, | ||
double | x22 | ||
) |
Initializes a matrix with the 9 specified coefficients given in "row major" order.
[in] | x00 | The 00 entry |
[in] | x01 | The 01 entry |
[in] | x02 | The 02 entry |
[in] | x10 | The 10 entry |
[in] | x11 | The 11 entry |
[in] | x12 | The 12 entry |
[in] | x20 | The 20 entry |
[in] | x21 | The 21 entry |
[in] | x22 | The 22 entry |
void InitFromRowValuesXY | ( | double | x00, |
double | x01, | ||
double | x10, | ||
double | x11 | ||
) |
Initializes a matrix with the 4 specified coefficients in xx,xy,yx,yy positions, and 1 in zz in "row major" order.
[in] | x00 | The 00 entry |
[in] | x01 | The 01 entry |
[in] | x10 | The 10 entry |
[in] | x11 | The 11 entry |
void InitFromRowValuesXY | ( | double const | data[4] | ) |
Initializes a matrix with 4 coefficients in xx,xy,yx,yy positions, and 1 in zz in "row major" order.
[in] | data | matrix entries in order xx,xy,yx,yy |
Initializes a matrix with 3 points copied to respective rows.
[in] | vectorU | The vector to insert in row 0 |
[in] | vectorV | The vector to insert in row 1 |
[in] | vectorW | The vector to insert in row 2 |
void InitFromScale | ( | double | scale | ) |
Initializes a uniform scaling matrix.
[in] | scale | The scale factor. |
Returns a 'rank one' matrix defined as a scale factor times the 'vector outer product' of two vectors, i.e.
as the matrix {s*U*V^T}
[in] | vectorU | The column vector U |
[in] | vectorV | The row vector V |
[in] | scale | The scale factor |
void InitFromScaleFactors | ( | double | xscale, |
double | yscale, | ||
double | zscale | ||
) |
Returns a scaling matrix with respective x, y, and z scaling factors.
[in] | xscale | The x direction scale factor |
[in] | yscale | The y direction scale factor |
[in] | zscale | The z direction scale factor |
void InitFromVectorAndRotationAngle | ( | DVec3dCR | axis, |
double | radians | ||
) |
Initializes a matrix representing rotation around a vector.
[in] | axis | The axis of rotation |
[in] | radians | The rotation angle |
void InitIdentity | ( | ) |
Initialize an identity matrix.
void InitProduct | ( | RotMatrixCR | rotMatrixA, |
RotMatrixCR | rotMatrixB | ||
) |
Returns the product {A*B} of two matrices.
[in] | rotMatrixA | The first factor |
[in] | rotMatrixB | The second factor |
void InitProduct | ( | RotMatrixCR | rotMatrixA, |
RotMatrixCR | rotMatrixB, | ||
RotMatrixCR | rotMatrixC | ||
) |
Returns the product of three matrices.
[in] | rotMatrixA | The first factor |
[in] | rotMatrixB | The second factor |
[in] | rotMatrixC | The third factor |
void InitProduct | ( | RotMatrixCR | rotMatrixA, |
TransformCR | transformB | ||
) |
Sets this instance to the product of matrix rotMatrixA times the matrix part of transform transformB.
In this 'post multiplication' the matrix part of transformB multiplies rotMatrixA ON THE RIGHT and the translation part of transformB is ignored.
[in] | rotMatrixA | The first factor (matrix) |
[in] | transformB | The second factor (transform) |
void InitProduct | ( | TransformCR | transformA, |
RotMatrixCR | rotMatrixB | ||
) |
Returns to the product of the matrix part of transform transformA times matrix rotMatrixB.
In this 'pre multiplication' the matrix part of transformA multiplies rotMatrixB ON THE LEFT and the translation part of transformA is ignored.
[in] | transformA | The first factor (transform) |
[in] | rotMatrixB | The second factor (matrix) |
void InitProductRotMatrixRotMatrixTranspose | ( | RotMatrixCR | rotMatrixA, |
RotMatrixCR | rotMatrixB | ||
) |
Returns the product of rotMatrixA times the transpose of rotMatrixB.
[in] | rotMatrixA | The first factor |
[in] | rotMatrixB | The second factor (to be transposed) |
void InitProductRotMatrixTransposeRotMatrix | ( | RotMatrixCR | rotMatrixA, |
RotMatrixCR | rotMatrixB | ||
) |
Returns the product of the transpose of rotMatrixA times rotMatrixB.
[in] | rotMatrixA | The first factor (to be transposed) |
[in] | rotMatrixB | The second factor |
bool InitRotationFromOriginXY | ( | DPoint3dCR | origin, |
DPoint3dCR | xPoint, | ||
DPoint3dCR | yPoint | ||
) |
Set this instance matrix to be an orthogonal (rotation) matrix with column 0 in the direction from the origin to the x point, column 1 in the plane of the 3 points, directed so the Y point on the positive side, and column 2 as their cross product.
[in] | origin | The reference point |
[in] | xPoint | The x axis target point |
[in] | yPoint | The 3rd point defining xy plane. |
(conditionally) initialize the instance as the (smallest) rotation that moves startVector so it is in the direction of endVector.
In the normal case where the vectors are not parallel or antiparallel, this is a rotation around their cross product.
[in] | startVector | starting vector |
[in] | endVector | ending vector. |
void InitTransposedFromQuaternionWXYZ | ( | const double * | pQuatAsDoubleArray | ) |
Initialization, compatible with mdlRMatrix_fromQuat.
[in] | pQuatAsDoubleArray | The quaternion, stored as (w,x,y,z) in an array of doubles. |
bool InverseOf | ( | RotMatrixCR | forward | ) |
Returns the inverse of the a matrix.
[in] | forward | The input matrix |
bool Invert | ( | ) |
Inverts this instance matrix in place.
bool IsDiagonal | ( | ) | const |
Tests if a matrix has small offdiagonal entries compared to diagonals.
The specific test condition is that the largest off diagonal absolute value is less than a tight tolerance fraction times the largest diagonal entry.
bool IsEqual | ( | RotMatrixCR | matrix2 | ) | const |
Tests for equality between two matrices "Equality" means relative error less than 1.0e-12, in the sense that each component-wise difference is less than 1.0e-12 times the largest absolute value of the components of one matrix.
[in] | matrix2 | The second matrix |
bool IsEqual | ( | RotMatrixCR | matrix2, |
double | tolerance | ||
) | const |
Tests for equality between two matrices.
[in] | matrix2 | The second matrix |
[in] | tolerance | The relative error tolerance. Absolute tolerance is this (relative) tolerance times the largest absolute value in Matrix1. |
bool IsIdentity | ( | ) | const |
Tests if a matrix is the identity matrix.
bool IsNearRigidScale | ( | RotMatrixR | dest, |
int | primaryAxis = 0 , |
||
double | tolerance = 1.0e-6 |
||
) | const |
Determine if a matrix is close to a pure rotate and scale.
If source is not near rigid, return false and copy to the output. If near an identity return identity. If nearly perpendicular with scales other than 1, clean preserving the length and direction of the primary axis. This is intended to be used with a crude (e.g. 1.0e-6) reltol to identify old DGN file matrices that are "dirty" by modern standards but were meant to be identity, rotation, or scaled rotations in the UOR era.
[in] | dest | result matrix |
[in] | primaryAxis | axis whose orientation and direction is preserved. |
[in] | tolerance | relative tolerance for recognizing near-perpendicular conditions. |
bool IsNearSignedPermutation | ( | RotMatrixR | result, |
double | tolerance | ||
) | const |
Test if this instance matrix does nothing more than exchange and possibly negate principle axes, within a tolerance.
[out] | result | the nearby permutation, or the orignal matrix if none near. |
[in] | tolerance | tolerance for comparison to the permutation |
bool IsOrthogonal | ( | ) | const |
Test if this instance matrix is orthogonal, i.e.
its transpose is its inverse. This class of matrices includes both rigid body rotations and reflections.
bool IsOrthonormal | ( | RotMatrixR | columns, |
DVec3dR | axisScales, | ||
double & | axisRatio | ||
) | const |
Test if this instance matrix has orthonormal columns, i.e.
its columns are all perpendicular to one another.
[out] | columns | matrix containing the unit vectors along the columns. |
[out] | axisScales | point whose x, y, and z components are the magnitudes of the original columns. |
[out] | axisRatio | smallest axis length divided by largest. |
bool IsPlanar | ( | DVec3dCR | normal | ) | const |
Tests if this instance matrix has no effects perpendicular to any plane with the given normal.
This will be true if the matrix represents a combination of (a) scaling perpencicular to the normal and (b) rotation around the normal.
[in] | normal | The plane normal |
bool IsRigid | ( | ) | const |
Test if a matrix is a rigid body rotation, i.e.
its transpose is its inverse and it has a positive determinant.
bool IsRigidScale | ( | RotMatrixR | columns, |
double & | scale | ||
) | const |
Test if this instance matrix is composed of only rigid rotation and scaling.
[out] | columns | matrix containing the unit vectors along the columns. |
[out] | scale | largest axis scale factor. If function value is true, the min scale is the same. Use areColumnsOrthonormal to get separate column scales. |
bool IsSignedPermutation | ( | ) | const |
Test if this instance matrix does nothing more than exchange and possibly negate principle axes.
bool IsUniformScale | ( | double & | maxScale | ) | const |
Tests if a matrix has (nearly) equal diagaonal entries and (nearly) zero off diagonals.
Tests use a tight relative tolerance.
[out] | maxScale | the largest diagaonal entry |
DRange1d LowerTriangleAbsRange | ( | ) |
return the range of absolute values strictly below the diagonal.
double LowerTriangleMaxAbs | ( | ) |
return the largest absolute value in the lower triangle.
double MaxAbs | ( | ) | const |
Find the largest absolute value of entries in the matrix.
double MaxDiff | ( | RotMatrixCR | matrix2 | ) | const |
Returns the largest absolute value difference between corresponding coefficients in Matrix1 and Matrix2.
[in] | matrix2 | The matrix to compare to |
void Multiply | ( | DPoint4dP | result, |
DPoint4dCP | point, | ||
int | numPoint | ||
) | const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point.
Each result is placed in the corresponding entry in the output array result. The same array may be named for the input and output arrays.
[out] | result | output points |
[in] | point | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DPoint2dP | result, |
DPoint2dCP | point, | ||
int | numPoint | ||
) | const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point.
Each result is placed in the corresponding entry in the output array result. The same array may be named for the input and output arrays.
[out] | result | output points |
[in] | point | The input points |
[in] | numPoint | The number of points |
void Multiply | ( | DRange3dR | outRange, |
DRange3dCR | inRange | ||
) | const |
computes the 8 corner points of the range cube defined by the two points of pRange, multiplies matrix times each point, and computes the twopoint range limits (min max) of the resulting rotated box.
Note that the volume of the rotated box is generally larger than that of the input because the postrotation minmax operation expands the box. Ranges that are null as defined by inRange->isNull are left unchanged.
[out] | outRange | range of transformed cube |
[in] | inRange | Any two corners of original cube |
void Multiply | ( | DPoint3dR | point | ) | const |
Computes the product {M*P} where M is this instance matrix and P the input point.
The result overwrites the previous coordinates in point.
[in,out] | point | The point to be updated |
void Multiply | ( | DPoint3dR | result, |
DPoint3dCR | point | ||
) | const |
Returns the product of a matrix times a point.
[out] | result | result of the multiplication. |
[in] | point | The known point. |
void Multiply | ( | DPoint3dP | result, |
DPoint3dCP | point, | ||
int | numPoint | ||
) | const |
Computes {M*P[i]} where M is this instance matrix and each P[i] is a point in the input array point.
Each result is placed in the corresponding entry in the output array result. The same array may be named for the input and output arrays.
[out] | result | output points |
[in] | point | The input points |
[in] | numPoint | The number of points |
Description Multiply points. (Matrix on left, point on right as column vector)
[in] | outXYZ | transformed coordinates. |
[in] | inXYZ | input coordinates |
Description Multiply 2D points. (Matrix on left, point on right as column vector)
[in] | out | transformed coordinates. z row of matrix ignored. |
[in] | in | input coordinates. z=0 implied for multiplication. |
Multiply xyzw, with matrix w row and column 0001.
[in] | xyzwOut | transformed coordinates. |
[in] | xyzwIn | input coordinates. |
void MultiplyComponents | ( | DPoint3dR | result, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
Returns the product of a matrix times a point, with the point given as separate components.
[out] | result | result of multiplication |
[in] | x | The x component of input point |
[in] | y | The y component of input point |
[in] | z | The z component of input point |
void MultiplyTranspose | ( | DPoint3dR | result, |
DPoint3dCR | point | ||
) | const |
Returns the product of a matrix transpose times a point.
[out] | result | result of the multiplication. |
[in] | point | The known point. |
void MultiplyTranspose | ( | DPoint3dR | point | ) | const |
Computes the product {P*M} where M is this instance matrix and P is the input point The result overwrites the previous coordinates in the point.
[in,out] | point | The point to be multiplied |
void MultiplyTranspose | ( | DPoint3dP | result, |
DPoint3dCP | point, | ||
int | numPoint | ||
) | const |
Computes {P[i]*M} where M is this instance matrix and each P[i] is a point in the input array point, transposed into row form.
(Equivalently, multiply M^*p[i], where M^ indicates transpose.) Each result is placed in the corresponding entry in the output array result. The same array may be named for the input and output arrays.
[out] | result | output points |
[in] | point | The input points |
[in] | numPoint | The number of points |
Multiply the transposed matrix times points. (Tranposed matrix on left, point on right as column vector. Or (equivalent) point on left as row vector, matrix on right)
[in] | outXYZ | transformed coordinates. |
[in] | inXYZ | input coordinates |
void MultiplyTransposeComponents | ( | DPoint3dR | result, |
double | x, | ||
double | y, | ||
double | z | ||
) | const |
Returns the product P = [x,y,z]*M where M is the input matrix and P is the product point.
[out] | result | product point |
[in] | x | The x component |
[in] | y | The y component |
[in] | z | The z component |
void NormalizeColumnsOf | ( | RotMatrixCR | inMatrix, |
DVec3dR | scaleVector | ||
) |
Returns a matrix whose rows are unit vectors in the same drection as corresponding columns of the input matrix.
Also (optionally) stores the original column magnitudes as components of the point.
[in] | inMatrix | The input matrix |
[out] | scaleVector | length of original columns |
void NormalizeRowsOf | ( | RotMatrixCR | inMatrix, |
DVec3dR | scaleVector | ||
) |
Returns a matrix whose rows are unit vectors in the same drection as corresponding rows of the input matrix.
Also (optionally) stores the original row magnitudes as components of the point.
[in] | inMatrix | The input matrix |
[out] | scaleVector | length of original rows |
void OffDiagonalAbsRange | ( | double & | minValue, |
double & | maxValue | ||
) | const |
Return the (absolute value) range of entries off the diagonal.
[out] | minValue | smallest absolute value |
[out] | maxValue | largest absolute value |
void OffDiagonalSignedRange | ( | double & | minValue, |
double & | maxValue | ||
) | const |
Return the (signed) range of entries off the diagonal.
[out] | minValue | smallest signed value |
[out] | maxValue | largest signed value |
bool RotateAndSkewFactors | ( | RotMatrixR | rotation, |
RotMatrixR | skewFactor, | ||
int | primaryAxis, | ||
int | secondaryAxis | ||
) | const |
Factor as {rotation*skewFactor} where the rotation favors indicated primary and secondary axes.
[out] | rotation | the (orthogonal, right handed) rotation. |
[out] | skewFactor | the scale and skew parts. |
[in] | primaryAxis | selects column whose direction is preserved. |
[in] | secondaryAxis | selects columns that defines plane (with primaryAxis) |
|
static |
Set this instance matrix to be an orthogonal (rotation) matrix with column 0 in the direction from the origin to the x point, column 1 in the plane of the 3 points, directed so the Y point on the positive side, and column 2 as their cross product.
[in] | origin | The reference point |
[in] | xPoint | The x axis target point |
[in] | yPoint | The 3rd point defining xy plane. |
void Scale | ( | RotMatrixCR | leftMatrix, |
double | xs, | ||
double | ys, | ||
double | zs, | ||
RotMatrixCR | rightMatrix | ||
) |
Returns a matrix formed from a scaling matrix which is multiplied on the left and/or right with other matrices.
That is, form LeftMatrix * ScaleMatrix * RightMatrix where the ScaleMatrix is constructed from the given scale factors.
[in] | leftMatrix | The matrix on left of product |
[in] | xs | The x scale factor |
[in] | ys | The y scale factor |
[in] | zs | The z scale factor |
[in] | rightMatrix | The matrix on right of product |
void ScaleColumns | ( | RotMatrixCR | in, |
double | xs, | ||
double | ys, | ||
double | zs | ||
) |
Applies scale factors to corresponding columns of the input matrix, and places the result in this instance matrix.
[in] | in | The initial matrix |
[in] | xs | The scale factor for column 0 |
[in] | ys | The scale factor for column 1 |
[in] | zs | The scale factor for column 2 |
void ScaleColumns | ( | double | xs, |
double | ys, | ||
double | zs | ||
) |
Applies scale factors to corresponding columns.
[in] | xs | The scale factor for column 0 |
[in] | ys | The scale factor for column 1 |
[in] | zs | The scale factor for column 2 |
void ScaleRows | ( | RotMatrixCR | inMatrix, |
double | xScale, | ||
double | yScale, | ||
double | zScale | ||
) |
Applies scale factors to corresponding rows of the input matrix, and places the result in this instance matrix.
[in] | inMatrix | The initial matrix |
[in] | xScale | The scale factor for row 0 |
[in] | yScale | The scale factor for row 1 |
[in] | zScale | The scale factor for row 2 |
void SetColumn | ( | DVec3dCR | vector, |
int | col | ||
) |
Set the components in a column.
[in] | vector | new values |
[in] | col | The index of column to change. Column indices are 0, 1, 2. |
void SetRow | ( | DVec3dCR | vector, |
int | row | ||
) |
Set the components in a row.
[in] | vector | new values |
[in] | row | The index of row to change. Row indices are 0, 1, 2. |
void ShuffleColumnsOf | ( | RotMatrixCR | inMatrix, |
int | i0, | ||
int | i1, | ||
int | i2 | ||
) |
Moves columns 0, 1, 2 of the input matrix into columns i0, i1, i2 of the instance.
[in] | inMatrix | The input matrix |
[in] | i0 | The column to receive input column 0 |
[in] | i1 | The column to receive input column 1 |
[in] | i2 | The column to receive input column 2 |
bool Solve | ( | DPoint3dR | result, |
DPoint3dCR | point | ||
) | const |
Return the product of a matrix inverse and a point.
[out] | result | the unknown point |
[in] | point | The The known point |
Solve M*xyzOut[i] = xyzIn[i] for array of points.
(Equivalent to multiplying by the matrix inverse)
[in] | xyzOut | solution coordinates |
[in] | xyzIn | input coordinates. |
bool SolveArray | ( | DPoint3dP | result, |
DPoint3dCP | point, | ||
int | numPoints | ||
) | const |
Solves the matrix equation AX=B, where A is this instance, B is the matrix of numPoints input points and X is the matrix of numPoints output points.
point and result may have identical addresses.
[out] | result | column points of solution matrix to system |
[in] | point | The column points of constant matrix of system |
[in] | numPoints | The number of input/output points |
bool SolveTranspose | ( | DPoint3dR | result, |
DPoint3dCR | point | ||
) | const |
Return the product of a matrix inverse transpose and a point.
[out] | result | result of the multiplication |
[in] | point | The known point multipled by the matrix inverse. |
bool SquareAndNormalizeColumns | ( | RotMatrixCR | inMatrix, |
int | primaryAxis, | ||
int | secondaryAxis | ||
) |
Adjust the direction and length of columns of the input matrix to produce an instance matrix which has perpendicular, unit length columns.
The column whose index is primaryAxis (i.e. 0,1,2 for x,y,z axis of coordinate frame) is normalized to unit length in its current direction. The column whose index is secondaryAxis is unit length and perpendicular to the primaryAxis column, and lies in the same plane as that defined by the original primary and secondary columns. To preserve X axis and XY plane, call with axis id's 0 and 1. To preserve Z axis and ZX plane, call with axis id's 2 and 0. inMatrix and pMatrix may be the same address.
[in] | inMatrix | The input matrix |
[in] | primaryAxis | The axis id (0, 1, 2) which is to be normalized but left in its current direction |
[in] | secondaryAxis | The axis id (0, 1, 2) which is to be kept within the plane of the primary and secondary axis. |
bool SquareAndNormalizeColumns | ( | RotMatrixCR | inMatrix, |
int | primaryAxis, | ||
int | secondaryAxis, | ||
int | preferredOrientation | ||
) |
bool SquareAndNormalizeColumnsAnyOrder | ( | RotMatrixCR | inMatrix, |
int | preferredOrientation | ||
) |
Returns an orthogonal matrix that preserves aligns with the columns of inMatrix.
This is done by trying various combinations of primary and secondary axes until one succeeds in squareAndNormalizeColumns.
[in] | inMatrix | The input matrix |
[in] | preferredOrientation |
|
bool SquareAndNormalizeColumnsAnyOrder | ( | RotMatrixCR | inMatrix | ) |
Returns an orthogonal matrix that preserves aligns with the columns of inMatrix.
This is done by trying various combinations of primary and secondary axes until one succeeds in squareAndNormalizeColumns.
[in] | inMatrix | The input matrix |
void Subtract | ( | RotMatrixCR | delta | ) |
Subtract a matrix (componentwise, in place).
[in] | delta | The matrix to subtract |
double SumDiagonalSquares | ( | ) | const |
Computes the sum of the squares of the diagonal entries of this instance matrix.
void SumOf | ( | RotMatrixCR | matrix0, |
RotMatrixCR | matrix1, | ||
double | scale1, | ||
RotMatrixCR | matrix2, | ||
double | scale2 | ||
) |
Returns {Matrix0 + Matrix1*s1+Matrix2*s2}, i.e.
the sum of matrix M0, matrix M1 multiplied by scale s1, and matrix M2 multiplied by scale s2. Any combination of the matrix pointers may have identical addresses.
[in] | matrix0 | The matrix0 of formula |
[in] | matrix1 | The matrix1 of formula |
[in] | scale1 | The scale factor to apply to Matrix1 |
[in] | matrix2 | The matrix2 of formula |
[in] | scale2 | The scale factor to apply to Matrix2 |
double SumOffDiagonalSquares | ( | ) | const |
Computes the sum of the squares of the off-diagonal entries of this instance matrix.
double SumSquares | ( | ) | const |
Return the sum of squares of coefficients in a matrix.
void Transpose | ( | ) |
Transposes a matrix in place.
void TransposeOf | ( | RotMatrixCR | matrix | ) |
Initializes this instance as the transpose of a matrix.
[in] | matrix | The input matrix |
DRange1d UpperTriangleAbsRange | ( | ) |
return the range of absolute values strictly above the diagonal.
double UpperTriangleMaxAbs | ( | ) |
return the largest absolute value in the upper triangle.
void Zero | ( | ) |
returns a zero matrix.
double form3d[3][3] |
matrix coefficients. These are public, but direct use of the arrays is discouraged.