Public Member Functions | Static Public Member Functions | Public Attributes | List of all members

4x4 matrix used for perspective (homogeneous coordinate) calculations. More...

#include <dmatrix4d.h>

Public Member Functions

void InitFromRowValues (double x00, double x01, double x02, double x03, double x10, double x11, double x12, double x13, double x20, double x21, double x22, double x23, double x30, double x31, double x32, double x33)
 Copies the double values directly into the rows of this instance. More...
 
void TransposeOf (DMatrix4dCR B)
 Transpose a 4x4 matrix. More...
 
void Multiply (DPoint4dP outPoint, DPoint4dCP inPoint, int n) const
 Matrix multiplication, using all components of both the matrix and the points. More...
 
DPoint4d Multiply (DPoint3dCR xyz, double w)
 Matrix times point multiplication. More...
 
void SymmetricEigenvectors (DMatrix4dR Q, DPoint4dR D) const
 Compute eigenvectors, assuming A is symmetric. More...
 
void Multiply (GraphicsPointP outPoint, GraphicsPointCP inPoint, size_t n) const
 Multiply a matrix times points. More...
 
bool EvaluateImageGrid (DPoint2dP grid, double x00, double y00, int m, int n, double tol) const
 Evaluate pA*X for m*n points X arranged in a grid. More...
 
void MultiplyAndRenormalize (DPoint3dP outPoint, DPoint3dCP inPoint, int n) const
 Multiply an array of points by a matrix, using all components of both the matrix and the points. More...
 
void MultiplyAndRenormalize (DPoint3dR outPoint, DPoint3dCR inPoint) const
 Multiply a single point and return renormalized. More...
 
void MultiplyAndNormalize (DPoint3dP outPoint, DPoint4dCP inPoint, size_t n) const
 Multiply an array of points by a matrix, using all components of both the matrix and the points. More...
 
void MultiplyAffine (DPoint4dP outPoint, DPoint4dCP inPoint, int n) const
 Matrix*point multiplication, using full 4d points but assuming the matrix is affine, i.e. More...
 
void MultiplyScaleAndTranslate (DPoint4dP outPoint, DPoint4dCP inPoint, int n) const
 Matrix*point multiplication, using full 4d points but assuming the matrix is has 3D only scaling and translation. More...
 
void MultiplyAffine (DPoint3dP outPoint, DPoint3dCP inPoint, int n) const
 Matrix times vector multiplication, assume 0001 4th row. More...
 
void MultiplyAffineVectors (DPoint3dP out, DPoint3dCP in, int n) const
 Matrix times vector multiplication, assume 0001 4th row and padding 3d data with 0 weight. More...
 
void MultiplyScaleAndTranslate (DPoint3dP outPoint, DPoint3dCP inPoint, int n) const
 Matrix*point multiplication, using only scale and translate entries from the matrix. More...
 
void Multiply (DPoint4dP hPoint, DPoint3dCP point, const double *pWeight, int n) const
 Matrix*point multiplication, with input points represented by separate DPoint3d and weight arrays. More...
 
void Multiply (DPoint4dR outPoint, DPoint4dCR inPoint) const
 Multiply a matrix times a single homogeneous point. More...
 
void MultiplyTranspose (DPoint4dP outPoint, DPoint4dCP inPoint, int n) const
 Multiply the transformed matrix times points. More...
 
void SetRow (int i, double c0, double c1, double c2, double c3)
 Install c0, c1, c2, c3 in an indicated row of an DMatrix4d. More...
 
void SetRow (int i, DPoint4dCR data)
 Install c0, c1, c2, c3 in an indicated row of an DMatrix4d. More...
 
void SetColumn (int i, double r0, double r1, double r2, double r3)
 Install r0, r1, r2, r3 in an indicated column of an DMatrix4d. More...
 
void SetColumn (int i, DPoint4dCR point)
 Install a DPoint4d in an indicated column of an DMatrix4d. More...
 
void SwapColumns (int i, int j)
 Install a DPoint4d in an indicated column of an DMatrix4d. More...
 
void SwapRows (int i, int j)
 Install a DPoint4d in an indicated column of an DMatrix4d. More...
 
void GetColumn (DPoint4dR vec, int i) const
 Copy data from a matrix column to a DPoint4d structure. More...
 
void GetRow (DPoint4dR vec, int i) const
 Copy data from a matrix row to a DPoint4d structure. More...
 
void GetRows (DPoint4dR row0, DPoint4dR row1, DPoint4dR row2, DPoint4dR row3) const
 Copy data from a matrix rows to DPoint4d structures. More...
 
void InitIdentity ()
 initialize an identity matrix. More...
 
void InitFromScaleAndTranslation (DPoint3dCR scale, DPoint3dCR translation)
 Fill the scale and translate entries in an otherwise identity matrix. More...
 
void InitFromColumnVectors (DVec3dCR col0, DVec3dCR col1, DVec3dCR col2, DPoint3dCR translation)
 Fill the affine part using xyz vectors for each column of the basis part and an xyz vector for the translation. More...
 
void InitFrom (RotMatrixCR B)
 Copy a RotMatrix into corresponding parts of a 4x4 matrix with 4th row and column both 0001. More...
 
void InitFrom (TransformCR transfrom)
 Copy a DTransform3d into corresponding parts of a 4x4 matrix with 4th row 0001. More...
 
void InitFromTranslation (double tx, double ty, double tz)
 Fill a 4x4 matrix with a given translation vector and otherwise an identity. More...
 
void InitFromPerspective (double px, double py, double pz)
 Fill a matrix with entries in the perspective row, otherwise an identity matrix. More...
 
void PreMultiplyByTranslateAndScale (double tx, double ty, double tz, double sx, double sy, double sz, DMatrix4dCR matrixA)
 Premultiply matirx A by a matrix with sx,sy,sz,1 on diagonal, tx,ty,tz,1 in last column. More...
 
void InitProduct (DMatrix4dCR A, DMatrix4dCR B)
 Form the product of two 4x4 matrices. More...
 
void InitProduct (DMatrix4dCR A, DMatrix4dCR B, DMatrix4dCR C)
 Form the product of three 4x4 matrices. More...
 
void DifferenceOf (DMatrix4dCR A, DMatrix4dCR B)
 Subtract two 4x4 matrices. More...
 
void Add (DMatrix4dCR delta)
 Add a matrix (componentwise) to the instance. More...
 
void Add (DMatrix4dCR delta, double scaleFactor)
 Add a matrix (componentwise) to the instance. More...
 
void Scale (double scaleFactor)
 Scale in place. More...
 
void AddSymmetricScaledOuterProduct (DPoint3d xyz, double scale)
 Add [xx xy xz x; xy yy yz y; xz yz zz 1; x y z 1] * scale. More...
 
void AddSymmetricScaledOuterProduct (DPoint4dCR xyzw, double scale)
 Add [xx xy xz wx; xy yy yz wy; xz yz zz wz; wx wy wz ww] * scale. More...
 
void AddSymmetricScaledOuterProduct (DPoint4dCR U, DPoint4dCR V, double scale)
 Add scale * (U*V^ + V*U^) to the instance. More...
 
void CopyUpperTriangleToLower ()
 Copy all 6 values from the upper triangle to mirrored positions in the lower triangle. More...
 
void Subtract (DMatrix4dCR delta)
 Subtract a matrix (componentwise) from the instance. More...
 
void InitSymmetricProduct (DPoint4dCR sigma, DMatrix4dCR B)
 Compute A = Bt * D * B where B is a matrix and D is a diagonal matrix given as a vector. More...
 
bool ConvertInertiaProductsToPrincipalMoments (double &volume, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const
 Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}. More...
 
bool ConvertInertiaProductsToPrincipalMoments (TransformCR localToWorld, double &volume, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const
 Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}. More...
 
bool ConvertInertiaProductsToPrincipalAreaMoments (TransformCR localToWorld, double &area, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const
 Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}. More...
 
bool ConvertInertiaProductsToPrincipalWireMoments (TransformCR localToWorld, double &length, DVec3dR centroid, RotMatrixR axes, DVec3dR momentTensorDiagonal) const
 Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}. More...
 
void GetBlocks (RotMatrixR products, DVec3dR row, DVec3dR column, double &scalar) const
 Return matrix, final row, final column, and scalar parts. More...
 
double MaxAbs () const
 Search the matrix for the entry with the largest absolute value. More...
 
double MaxAbsDiff (DMatrix4dCR other, double &matrixDiff, double &colDiff, double &rowDiff, double &weightDiff) const
 Compute max absolute difference between various parts of matrices. More...
 
double MaxAbs (double &matrixMax, double &colMax, double &rowMax, double &weightAbs) const
 Compute max absolute value in various parts of matrix. More...
 
bool IsIdentity () const
 Tests if pInstance is an identity transform and returns the bool indicator. More...
 
bool IsAffine () const
 Tests if the instance has 0001 final row, within tolerance. More...
 
bool ApproximateNullVectorForUpperTriangle (DPoint4dR nullVector, double &residual) const
 Approximate solution of A*X=0, i.e. More...
 

Static Public Member Functions

static DMatrix4d FromRowValues (double x00, double x01, double x02, double x03, double x10, double x11, double x12, double x13, double x20, double x21, double x22, double x23, double x30, double x31, double x32, double x33)
 Copies the double values directly into the rows of this instance. More...
 
static DMatrix4d FromScaleAndTranslation (DPoint3dCR scale, DPoint3dCR translation)
 Fill the scale and translate entries in an otherwise identity matrix. More...
 
static DMatrix4d From101WeightedProduct (TransformCR transformA, RotMatrixCR matrixB, TransformCR transformC)
 Promote 3 inputs to 4x4 carrier matrices, with respective scale terms 1,0,1. More...
 
static DMatrix4d FromColumnVectors (DVec3dCR col0, DVec3dCR col1, DVec3dCR col2, DPoint3dCR translation)
 Fill the affine part using xyz vectors for each column of the basis part and an xyz vector for the translation. More...
 
static DMatrix4d From (RotMatrixCR B)
 Copy a RotMatrix into corresponding parts of a 4x4 matrix with 4th row and column both 0001. More...
 
static DMatrix4d From (TransformCR transfrom)
 Copy a Transform into corresponding parts of a 4x4 matrix with 4th row 0001. More...
 
static DMatrix4d FromTranslation (double tx, double ty, double tz)
 Fill a 4x4 matrix with a given translation vector and otherwise an identity. More...
 
static DMatrix4d FromPerspective (double px, double py, double pz)
 Fill a matrix with entries in the perspective row, otherwise an identity matrix. More...
 
static DMatrix4d FromZero ()
 Fill a matrix with zeros. More...
 
static DMatrix4d FromSandwichProduct (TransformCR transform, DMatrix4dCR momentMatrix, double scaleFactor)
 Return {A = T * B * Tt * s} where T is an affine transform (expanded to 4x4 with 0001 final row), B is a DMatrix4d, and s is a scale factor. More...
 
static DMatrix4d SweepMomentProducts (DMatrix4dCR baseProducts, DVec3d sweepVector)
 Return the product matrix resulting from sweeping geometry with given baseProducts;. More...
 

Public Attributes

double coff [4][4]
 Coefficients of 4x4 matrix. More...
 

Detailed Description

4x4 matrix used for perspective (homogeneous coordinate) calculations.

Member Function Documentation

void Add ( DMatrix4dCR  delta)

Add a matrix (componentwise) to the instance.

Parameters
[in]deltamatrix to add
void Add ( DMatrix4dCR  delta,
double  scaleFactor 
)

Add a matrix (componentwise) to the instance.

Parameters
[in]deltamatrix to add
[in]scaleFactorscale to apply to added matrix.
void AddSymmetricScaledOuterProduct ( DPoint3d  xyz,
double  scale 
)

Add [xx xy xz x; xy yy yz y; xz yz zz 1; x y z 1] * scale.

Parameters
[in]xyzx,y,z for products. Implicitly extened to DPoint4d [x,y,z,1] for products
[in]scalescale to apply to all terms.
void AddSymmetricScaledOuterProduct ( DPoint4dCR  xyzw,
double  scale 
)

Add [xx xy xz wx; xy yy yz wy; xz yz zz wz; wx wy wz ww] * scale.

Parameters
[in]xyzwx,y,z,w for products.
[in]scalescale to apply to all terms.
void AddSymmetricScaledOuterProduct ( DPoint4dCR  U,
DPoint4dCR  V,
double  scale 
)

Add scale * (U*V^ + V*U^) to the instance.

Parameters
[in]Ufirst operand
[in]Vsecond operand
[in]scalescale factor to apply to all terms.
bool ApproximateNullVectorForUpperTriangle ( DPoint4dR  nullVector,
double &  residual 
) const

Approximate solution of A*X=0, i.e.

find an approximate null vector; A is assumed upper triangular. Method: Find the smallest diagonal. Set that entry in X to 1. Backsolve the linear system with RHS 0 and the chosen X component fixed.

Parameters
[out]nullVectorapproximate null space vector.
[out]residualestimate of error in A*X. (Squared residual.)
bool ConvertInertiaProductsToPrincipalAreaMoments ( TransformCR  localToWorld,
double &  area,
DVec3dR  centroid,
RotMatrixR  axes,
DVec3dR  momentTensorDiagonal 
) const

Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}.

returned values are centroid, principal directions and 2nd moment tensor entries (yy+zz,xx+zz,xx+yy)

Parameters
[in]localToWorldtransformation from local coordinate system (where the products were computed) to world
[out]areaarea
[out]centroidcenter of mass
[out]axescolumns of this matrix are the principal x,y,z directions.
[out]momentTensorDiagonaltensor entries (inertias for rotation around each axis)
bool ConvertInertiaProductsToPrincipalMoments ( double &  volume,
DVec3dR  centroid,
RotMatrixR  axes,
DVec3dR  momentTensorDiagonal 
) const

Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}.

returned values are centroid, principal directions and 2nd moment tensor entries (yy+zz,xx+zz,xx+yy)

Parameters
[out]volumevolume
[out]centroidcenter of mass
[out]axescolumns of this matrix are the principal x,y,z directions.
[out]momentTensorDiagonaltensor entries (inertias for rotation around each axis)
bool ConvertInertiaProductsToPrincipalMoments ( TransformCR  localToWorld,
double &  volume,
DVec3dR  centroid,
RotMatrixR  axes,
DVec3dR  momentTensorDiagonal 
) const

Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}.

returned values are centroid, principal directions and 2nd moment tensor entries (yy+zz,xx+zz,xx+yy)

Parameters
[in]localToWorldtransformation from local coordinate system (where the products were computed) to world
[out]volumevolume
[out]centroidcenter of mass
[out]axescolumns of this matrix are the principal x,y,z directions.
[out]momentTensorDiagonaltensor entries (inertias for rotation around each axis)
bool ConvertInertiaProductsToPrincipalWireMoments ( TransformCR  localToWorld,
double &  length,
DVec3dR  centroid,
RotMatrixR  axes,
DVec3dR  momentTensorDiagonal 
) const

Input matrix contains products of inertia {[xx,xy,xz,x; xy yy yz y; xz yz zz z; x y z v]}.

returned values are centroid, principal directions and 2nd moment tensor entries (yy+zz,xx+zz,xx+yy)

Parameters
[in]localToWorldtransformation from local coordinate system (where the products were computed) to world
[out]lengthlength
[out]centroidcenter of mass
[out]axescolumns of this matrix are the principal x,y,z directions.
[out]momentTensorDiagonaltensor entries (inertias for rotation around each axis)
void CopyUpperTriangleToLower ( )

Copy all 6 values from the upper triangle to mirrored positions in the lower triangle.

void DifferenceOf ( DMatrix4dCR  A,
DMatrix4dCR  B 
)

Subtract two 4x4 matrices.

Parameters
[in]AA matrix of A - B
[in]BB matrix of A - B
bool EvaluateImageGrid ( DPoint2dP  grid,
double  x00,
double  y00,
int  m,
int  n,
double  tol 
) const

Evaluate pA*X for m*n points X arranged in a grid.

The homogeneous coordinates of the i,j point in the grid is (x0 + i, y0 + j, 0, 1) The returned point grid[i * m + j] is the xy components of the image of grid poitn ij AFTER normalization.

Parameters
[out]gridArray of mXn mapped, normalized points
[in]x00grid origin x
[in]y00grid origin y
[in]mnumber of grid points in x direction
[in]nnumber of grid points in y direction
[in]tolrelative tolerance for 0-weight tests. If 0, 1.0e-10 is used *
static DMatrix4d From ( RotMatrixCR  B)
static

Copy a RotMatrix into corresponding parts of a 4x4 matrix with 4th row and column both 0001.

Parameters
[in]B3x3 part to fill
static DMatrix4d From ( TransformCR  transfrom)
static

Copy a Transform into corresponding parts of a 4x4 matrix with 4th row 0001.

Parameters
[in]transfromtransform to copy
static DMatrix4d From101WeightedProduct ( TransformCR  transformA,
RotMatrixCR  matrixB,
TransformCR  transformC 
)
static

Promote 3 inputs to 4x4 carrier matrices, with respective scale terms 1,0,1.

Return the product of the carriers. (Huh? What is this for? If a transform is defined as A*F*C, and the derivative part of F is has nonzero derivative B only for its matrix part, A*B*C is the derivative 4x4 matrix.

Parameters
[in]transformAFirst term. Promoted to 4x4 with final row 0001.
[in]matrixBSecond term. Promoted to 4x4 with final row 0000.
[in]transformCThird term. Promoted to 4x4 with final row 0001.
static DMatrix4d FromColumnVectors ( DVec3dCR  col0,
DVec3dCR  col1,
DVec3dCR  col2,
DPoint3dCR  translation 
)
static

Fill the affine part using xyz vectors for each column of the basis part and an xyz vector for the translation.

Parameters
[in]col0data for column 0 of leading 3x3 submatrix
[in]col1data for column 1 of leading 3x3 submatrix
[in]col2data for column 2 of leading 3x3 submatrix
[in]translationdata for translation part of matrix
static DMatrix4d FromPerspective ( double  px,
double  py,
double  pz 
)
static

Fill a matrix with entries in the perspective row, otherwise an identity matrix.

Parameters
[in]pxx component
[in]pyy component
[in]pzz component
static DMatrix4d FromRowValues ( double  x00,
double  x01,
double  x02,
double  x03,
double  x10,
double  x11,
double  x12,
double  x13,
double  x20,
double  x21,
double  x22,
double  x23,
double  x30,
double  x31,
double  x32,
double  x33 
)
static

Copies the double values directly into the rows of this instance.

Parameters
[in]x00(0,0) entry of matrix (row, column)
[in]x01(0,1) entry
[in]x02(0,2) entry
[in]x03(0,3) entry
[in]x10(1,0) entry of matrix (row, column)
[in]x11(1,1) entry
[in]x12(1,2) entry
[in]x13(1,3) entry
[in]x20(2,0) entry of matrix (row, column)
[in]x21(2,1) entry
[in]x22(2,2) entry
[in]x23(2,3) entry
[in]x30(3,0) entry of matrix (row, column)
[in]x31(3,1) entry
[in]x32(3,2) entry
[in]x33(3,3) entry
static DMatrix4d FromSandwichProduct ( TransformCR  transform,
DMatrix4dCR  momentMatrix,
double  scaleFactor 
)
static

Return {A = T * B * Tt * s} where T is an affine transform (expanded to 4x4 with 0001 final row), B is a DMatrix4d, and s is a scale factor.

This is used to do change of basis when entries in B are xx,xy,xz,x moments etc, T is the (possibly non-uniform) transformation, and s is a scale factor for changing the integration domain. (If the integrations were volume integrals, s is the determinant of the orientation part of T. If the integrations were area integrals in a plane, s is the jacobian of the plane-to-plane transformation.)

Parameters
[in]transformtransform to apply
[in]momentMatrixmatrix {B}
[in]scaleFactor
static DMatrix4d FromScaleAndTranslation ( DPoint3dCR  scale,
DPoint3dCR  translation 
)
static

Fill the scale and translate entries in an otherwise identity matrix.

Parameters
[in]scalescale factor for each diagonal of leading 3x3 submatrix
[in]translationtranslation vector
static DMatrix4d FromTranslation ( double  tx,
double  ty,
double  tz 
)
static

Fill a 4x4 matrix with a given translation vector and otherwise an identity.

Parameters
[in]txx component
[in]tyy component
[in]tzz component
static DMatrix4d FromZero ( )
static

Fill a matrix with zeros.

void GetBlocks ( RotMatrixR  products,
DVec3dR  row,
DVec3dR  column,
double &  scalar 
) const

Return matrix, final row, final column, and scalar parts.

Parameters
[out]productsupper 3x3 part
[out]rowxyz parts of final row
[out]columnxyz parts of final column
[out]scalarww entry.
void GetColumn ( DPoint4dR  vec,
int  i 
) const

Copy data from a matrix column to a DPoint4d structure.

Parameters
[out]vecpoint copied from column
[in]iindex of column 0 <= i < 4 whose values are to be set
void GetRow ( DPoint4dR  vec,
int  i 
) const

Copy data from a matrix row to a DPoint4d structure.

Parameters
[out]vecpoint copied from row
[in]iindex of row 0 <= i < 4 whose values are to be set
void GetRows ( DPoint4dR  row0,
DPoint4dR  row1,
DPoint4dR  row2,
DPoint4dR  row3 
) const

Copy data from a matrix rows to DPoint4d structures.

Parameters
[out]row0row 0 data. May be NULL.
[out]row1row 1 data. May be NULL.
[out]row2row 2 data. May be NULL.
[out]row3row 3 data. May be NULL.
void InitFrom ( RotMatrixCR  B)

Copy a RotMatrix into corresponding parts of a 4x4 matrix with 4th row and column both 0001.

Parameters
[in]B3x3 part to fill
void InitFrom ( TransformCR  transfrom)

Copy a DTransform3d into corresponding parts of a 4x4 matrix with 4th row 0001.

Parameters
[in]transfromtransform to copy
void InitFromColumnVectors ( DVec3dCR  col0,
DVec3dCR  col1,
DVec3dCR  col2,
DPoint3dCR  translation 
)

Fill the affine part using xyz vectors for each column of the basis part and an xyz vector for the translation.

Parameters
[in]col0data for column 0 of leading 3x3 submatrix
[in]col1data for column 1 of leading 3x3 submatrix
[in]col2data for column 2 of leading 3x3 submatrix
[in]translationdata for translation part of matrix
void InitFromPerspective ( double  px,
double  py,
double  pz 
)

Fill a matrix with entries in the perspective row, otherwise an identity matrix.

Parameters
[in]pxx component
[in]pyy component
[in]pzz component
void InitFromRowValues ( double  x00,
double  x01,
double  x02,
double  x03,
double  x10,
double  x11,
double  x12,
double  x13,
double  x20,
double  x21,
double  x22,
double  x23,
double  x30,
double  x31,
double  x32,
double  x33 
)

Copies the double values directly into the rows of this instance.

Parameters
[in]x00(0,0) entry of matrix (row, column)
[in]x01(0,1) entry
[in]x02(0,2) entry
[in]x03(0,3) entry
[in]x10(1,0) entry of matrix (row, column)
[in]x11(1,1) entry
[in]x12(1,2) entry
[in]x13(1,3) entry
[in]x20(2,0) entry of matrix (row, column)
[in]x21(2,1) entry
[in]x22(2,2) entry
[in]x23(2,3) entry
[in]x30(3,0) entry of matrix (row, column)
[in]x31(3,1) entry
[in]x32(3,2) entry
[in]x33(3,3) entry
void InitFromScaleAndTranslation ( DPoint3dCR  scale,
DPoint3dCR  translation 
)

Fill the scale and translate entries in an otherwise identity matrix.

Parameters
[in]scalescale factor for each diagonal of leading 3x3 submatrix
[in]translationtranslation vector
void InitFromTranslation ( double  tx,
double  ty,
double  tz 
)

Fill a 4x4 matrix with a given translation vector and otherwise an identity.

Parameters
[in]txx component
[in]tyy component
[in]tzz component
void InitIdentity ( )

initialize an identity matrix.

void InitProduct ( DMatrix4dCR  A,
DMatrix4dCR  B 
)

Form the product of two 4x4 matrices.

Parameters
[in]Afirst matrix of product A*B
[in]Bsecond matrix of product A*B
void InitProduct ( DMatrix4dCR  A,
DMatrix4dCR  B,
DMatrix4dCR  C 
)

Form the product of three 4x4 matrices.

Parameters
[in]Afirst matrix of product A*B*C
[in]Bsecond matrix of product A*B*C
[in]Cthird matrix of product A*B*C
void InitSymmetricProduct ( DPoint4dCR  sigma,
DMatrix4dCR  B 
)

Compute A = Bt * D * B where B is a matrix and D is a diagonal matrix given as a vector.

REMARK: This is a Very Bad Thing for numerical purposes. Are you sure you can't get your result without forming this product?

Parameters
[in]sigmaentries of diagonal matrix D
[in]Bmatrix B
bool IsAffine ( ) const

Tests if the instance has 0001 final row, within tolerance.

Returns
true if matrix is approximately affine.
bool IsIdentity ( ) const

Tests if pInstance is an identity transform and returns the bool indicator.

The matrix is considered an identity if the sum of squared components after subtracting 1 from the diagonals is less than a small tolerance

Returns
true if matrix is approximately an identity.
double MaxAbs ( ) const

Search the matrix for the entry with the largest absolute value.

Returns
max absolute value entry in the matrix.
double MaxAbs ( double &  matrixMax,
double &  colMax,
double &  rowMax,
double &  weightAbs 
) const

Compute max absolute value in various parts of matrix.

Parameters
[out]matrixMaxdifference in matrix part.
[out]colMaxdifference in final column XYZ part
[out]rowMaxdifference in final row XYZ part
[out]weightAbsabsolute value of WW entry
Returns
max absolute value
double MaxAbsDiff ( DMatrix4dCR  other,
double &  matrixDiff,
double &  colDiff,
double &  rowDiff,
double &  weightDiff 
) const

Compute max absolute difference between various parts of matrices.

Parameters
[in]othermatrix to compare to.
[out]matrixDiffdifference in matrix part.
[out]colDiffdifference in final column XYZ part
[out]rowDiffdifference in final row XYZ part
[out]weightDiffdifference in final diagonal entry
Returns
max absolute difference
void Multiply ( DPoint4dP  outPoint,
DPoint4dCP  inPoint,
int  n 
) const

Matrix multiplication, using all components of both the matrix and the points.

Parameters
[out]outPointArray of homogeneous products A*inPoint[i]
[in]inPointArray of homogeneous points
[in]nnumber of points
DPoint4d Multiply ( DPoint3dCR  xyz,
double  w 
)

Matrix times point multiplication.

Parameters
[in]xyzxyz parts of point.
[in]wweight.
void Multiply ( GraphicsPointP  outPoint,
GraphicsPointCP  inPoint,
size_t  n 
) const

Multiply a matrix times points.

Parameters
[out]outPointArray of graphics points A*inPoint[i]
[in]inPointArray of graphics points
[in]nnumber of points
void Multiply ( DPoint4dP  hPoint,
DPoint3dCP  point,
const double *  pWeight,
int  n 
) const

Matrix*point multiplication, with input points represented by separate DPoint3d and weight arrays.

Parameters
[out]hPointArray of homogeneous products A*point[i]
[in]pointArray of xyz coordinates
[in]pWeightweight array. If NULL, unit weight is used
[in]nnumber of points
void Multiply ( DPoint4dR  outPoint,
DPoint4dCR  inPoint 
) const

Multiply a matrix times a single homogeneous point.

Parameters
[out]outPointproduct A*P, where P is a column vector
[in]inPointcolumn vector
void MultiplyAffine ( DPoint4dP  outPoint,
DPoint4dCP  inPoint,
int  n 
) const

Matrix*point multiplication, using full 4d points but assuming the matrix is affine, i.e.

assume 0001 4th row.

Parameters
[out]outPointArray of homogeneous products A*pPoint[i]
[in]inPointArray of homogeneous points
[in]nnumber of points
void MultiplyAffine ( DPoint3dP  outPoint,
DPoint3dCP  inPoint,
int  n 
) const

Matrix times vector multiplication, assume 0001 4th row.

Parameters
[out]outPointDestination array
[in]inPointSource array
[in]nnumber of vectors
void MultiplyAffineVectors ( DPoint3dP  out,
DPoint3dCP  in,
int  n 
) const

Matrix times vector multiplication, assume 0001 4th row and padding 3d data with 0 weight.

Parameters
[out]outDestination array
[in]inSource array
[in]nnumber of vectors
void MultiplyAndNormalize ( DPoint3dP  outPoint,
DPoint4dCP  inPoint,
size_t  n 
) const

Multiply an array of points by a matrix, using all components of both the matrix and the points.

Parameters
[out]outPointArray of products A*inPoint[i] normalized
[in]inPointArray of points points
[in]nnumber of points
void MultiplyAndRenormalize ( DPoint3dP  outPoint,
DPoint3dCP  inPoint,
int  n 
) const

Multiply an array of points by a matrix, using all components of both the matrix and the points.

Parameters
[out]outPointArray of products A*pPoint[i] renormalized
[in]inPointArray of points points
[in]nnumber of points
void MultiplyAndRenormalize ( DPoint3dR  outPoint,
DPoint3dCR  inPoint 
) const

Multiply a single point and return renormalized.

Parameters
[out]outPointproducts A*inPoint normalized
[in]inPointinput point
void MultiplyScaleAndTranslate ( DPoint4dP  outPoint,
DPoint4dCP  inPoint,
int  n 
) const

Matrix*point multiplication, using full 4d points but assuming the matrix is has 3D only scaling and translation.

Parameters
[out]outPointArray of homogeneous products A*pPoint[i]
[in]inPointArray of homogeneous points
[in]nnumber of points
void MultiplyScaleAndTranslate ( DPoint3dP  outPoint,
DPoint3dCP  inPoint,
int  n 
) const

Matrix*point multiplication, using only scale and translate entries from the matrix.

Parameters
[out]outPointArray of products A*pPoint[i]
[in]inPointArray of input points
[in]nnumber of points
void MultiplyTranspose ( DPoint4dP  outPoint,
DPoint4dCP  inPoint,
int  n 
) const

Multiply the transformed matrix times points.

(Equivalent to multiplying transposed points times the matrix.)

Parameters
[out]outPointArray of homogeneous products A^T *pPoint[i]
[in]inPointArray of homogeneous points
[in]nnumber of points
void PreMultiplyByTranslateAndScale ( double  tx,
double  ty,
double  tz,
double  sx,
double  sy,
double  sz,
DMatrix4dCR  matrixA 
)

Premultiply matirx A by a matrix with sx,sy,sz,1 on diagonal, tx,ty,tz,1 in last column.

Parameters
[in]tx03 entry (x translate) of mutliplier.
[in]ty13 entry (y translate) of multiplier.
[in]tz23 entry (z translate) of multiplier.
[in]sx00 entry (x scale) of multiplier.
[in]sy11 entry (y scale) of multiplier.
[in]sz22 entry (z scale) of multiplier.
[in]matrixAexisting matrix
void Scale ( double  scaleFactor)

Scale in place.

Parameters
[in]scaleFactorscale to apply
void SetColumn ( int  i,
double  r0,
double  r1,
double  r2,
double  r3 
)

Install r0, r1, r2, r3 in an indicated column of an DMatrix4d.

Parameters
[in]iindex of column 0 <= i < 4 whose values are to be set
[in]r0row 0 value
[in]r1row 1 value
[in]r2row 2 value
[in]r3row 3 value
void SetColumn ( int  i,
DPoint4dCR  point 
)

Install a DPoint4d in an indicated column of an DMatrix4d.

Parameters
[in]iindex of column 0 <= i < 4 whose values are to be set
[in]pointcolumn values
void SetRow ( int  i,
double  c0,
double  c1,
double  c2,
double  c3 
)

Install c0, c1, c2, c3 in an indicated row of an DMatrix4d.

Parameters
[in]iindex of row 0 <= i < 4 whose values are to be set
[in]c0column 0 value
[in]c1column 1 value
[in]c2column 2 value
[in]c3column 3 value
void SetRow ( int  i,
DPoint4dCR  data 
)

Install c0, c1, c2, c3 in an indicated row of an DMatrix4d.

Parameters
[in]iindex of row 0 <= i < 4 whose values are to be set
[in]datadata for row.
void Subtract ( DMatrix4dCR  delta)

Subtract a matrix (componentwise) from the instance.

Parameters
[in]deltamatrix to subtract
void SwapColumns ( int  i,
int  j 
)

Install a DPoint4d in an indicated column of an DMatrix4d.

Parameters
[in]ifirst column index
[in]jsecond column index
void SwapRows ( int  i,
int  j 
)

Install a DPoint4d in an indicated column of an DMatrix4d.

Parameters
[in]ifirst column index
[in]jsecond column index
static DMatrix4d SweepMomentProducts ( DMatrix4dCR  baseProducts,
DVec3d  sweepVector 
)
static

Return the product matrix resulting from sweeping geometry with given baseProducts;.

Parameters
[in]baseProductsproducts integrated on base curve or area.
[in]sweepVectorvector for sweep (extrusion)
Returns
products for integration over swept body.
void SymmetricEigenvectors ( DMatrix4dR  Q,
DPoint4dR  D 
) const

Compute eigenvectors, assuming A is symmetric.

Parameters
[out]Qorthogonal, unit eigenvectors.
[out]Dcorresponding eigenvalues.
void TransposeOf ( DMatrix4dCR  B)

Transpose a 4x4 matrix.

Parameters
[in]Boriginal matrix

Member Data Documentation

double coff[4][4]

Coefficients of 4x4 matrix.


The documentation for this struct was generated from the following file:

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.