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

Forward and inverse 4x4 matrices of an invertible perspective transformation. More...

#include <dmap4d.h>

Public Member Functions

void InitIdentity ()
 Initialize and identity mapping. More...
 
void InitFrom (DMatrix4dCR forwardMatrix, DMatrix4dCR inverseMatrix)
 Direct initialization from matrices. More...
 
bool InitFromRanges (DPoint3dCR loAP, DPoint3dCR hiAP, DPoint3dCR loBP, DPoint3dCR hiBP)
 Initialize a transform which translates and scales along principle axes so box loAP..hiAP maps to box loBP..hiBP. More...
 
void InitFromRotation (double c, double s, double vx, double vy, double vz)
 Initialize a rotation about axis vx,vy,vz by angle whose cosine and sine are (proportional to) c and s. More...
 
void InitFromQuadrantRotation (int multiple, double vx, double vy, double vz)
 Rotate about vx,yv,vz by an integer multiple of 90 degrees. More...
 
void InitFromRotation (double radians, double vx, double vy, double vz)
 Initialize a rotation by angle in radians about axis vx,vy,vz. More...
 
void InitFromScale (double ax, double ay, double az)
 Initialize a pure scaling transformation. More...
 
void InitFromPrincipleProjection (double height, int axis)
 Initialize a transform that is a (noninvertible) projection to a principle plane. More...
 
void InitFromScale (double a)
 Initialize a uniform scaling transformation. More...
 
void InitFromTranslation (double tx, double ty, double tz)
 Initialize a translation transform. More...
 
bool InitFromTaper (double taper)
 Initialize a transform with perspective entries for a (nonzero) taper in the z direction. More...
 
bool InitFromTransform (TransformCR transform, bool invert)
 
bool InitFromSkewBox (DPoint4dCR point0001, DPoint4dCR point1001, DPoint4dCR point0101, DPoint4dCR point0010)
 Fill a mapping between a unit prism and homogeneous skew space. More...
 
void ZFrustum (double z0, double zetaHalf)
 
void InverseOf (DMap4dCR B)
 Sets pA to the inverse of B. More...
 
void SandwichOf (DMap4dCR A, DMap4dCR B, DMap4dCR C)
 Form the product C * Binv * A * B * Cinv. More...
 
void SandwichOfBABinverse (DMap4dCR A, DMap4dCR B)
 Form the product B * A * BInv A NULL for B or C skips that part. More...
 
void SandwichOfBinverseAB (DMap4dCR A, DMap4dCR B)
 Form the product Binv * A * B. More...
 
void InitProduct (DMap4dCR A, DMap4dCR B)
 Multiply transforms. More...
 
void InitProduct (DMap4dCR A, bool invertA, DMap4dCR B, bool invertB)
 Multiply transforms, selecting optional forward or inverse for each. More...
 
bool IsIndependent (int xChange, int yChange, int zChange)
 Checks if the mapping is strictly a scale/translate in specified directions. More...
 
bool IsSingular () const
 Test if a transform is singular. More...
 
bool IsAffine () const
 Test if a transform is affiine. More...
 
bool IsPerspective () const
 Test if a transform is perspective. More...
 
void Explode (RotMatrixR matrix, DPoint3dR translation, DPoint4dR perspective, bool inverse) const
 Copy various parts of the 4x4 matrix to separate data structures. More...
 
bool IsIdentity () const
 

Static Public Member Functions

static DMap4d FromIdentity ()
 Initialize and identity mapping. More...
 
static DMap4d From (DMatrix4dCR forwardMatrix, DMatrix4dCR inverseMatrix)
 Direct initialization from matrices. More...
 
static DMap4d FromRotation (double c, double s, double vx, double vy, double vz)
 Initialize a rotation about axis vx,vy,vz by angle whose cosine and sine are (proportional to) c and s. More...
 
static DMap4d FromQuadrantRotation (int multiple, double vx, double vy, double vz)
 Rotate about vx,yv,vz by an integer multiple of 90 degrees. More...
 
static DMap4d FromRotation (double radians, double vx, double vy, double vz)
 Initialize a rotation by angle in radians about axis vx,vy,vz. More...
 
static DMap4d FromScale (double ax, double ay, double az)
 Initialize a pure scaling transformation. More...
 
static DMap4d FromPrincipleProjection (double height, int axis)
 Initialize a transform that is a (noninvertible) projection to a principle plane. More...
 
static DMap4d FromScale (double a)
 Initialize a uniform scaling transformation. More...
 
static DMap4d FromTranslation (double tx, double ty, double tz)
 Initialize a translation transform. More...
 

Public Attributes

DMatrix4d M0
 Forward transformation. More...
 
DMatrix4d M1
 Inverse transformation. More...
 
int mask
 Internal state data. More...
 

Detailed Description

Forward and inverse 4x4 matrices of an invertible perspective transformation.

Member Function Documentation

void Explode ( RotMatrixR  matrix,
DPoint3dR  translation,
DPoint4dR  perspective,
bool  inverse 
) const

Copy various parts of the 4x4 matrix to separate data structures.

Parameters
[out]matrixupper 3x3
[out]translationlast column (above diagonal)
[out]perspectivelast row (including diagonal)
[in]inversefalse for forward part, true for inverse
Remarks
The separate pieces do not "mean" much if there is perspective.
static DMap4d From ( DMatrix4dCR  forwardMatrix,
DMatrix4dCR  inverseMatrix 
)
static

Direct initialization from matrices.

Caller is responsible for correct inverse relationship.

Parameters
[in]forwardMatrix"forward" matrix.
[in]inverseMatrix"inverse" matrix.
static DMap4d FromIdentity ( )
static

Initialize and identity mapping.

static DMap4d FromPrincipleProjection ( double  height,
int  axis 
)
static

Initialize a transform that is a (noninvertible) projection to a principle plane.

Parameters
[in]heightdistance of plane from origin
[in]axis0,1,2 for x,y,z normal
static DMap4d FromQuadrantRotation ( int  multiple,
double  vx,
double  vy,
double  vz 
)
static

Rotate about vx,yv,vz by an integer multiple of 90 degrees.

Providing the angle as an integer allows exact table lookup without approximation of pi.

Parameters
[in]multiplerotation angle is multiple * 90 degrees
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
static DMap4d FromRotation ( double  c,
double  s,
double  vx,
double  vy,
double  vz 
)
static

Initialize a rotation about axis vx,vy,vz by angle whose cosine and sine are (proportional to) c and s.

Parameters
[in]ccosine of angle
[in]ssine of angle
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
static DMap4d FromRotation ( double  radians,
double  vx,
double  vy,
double  vz 
)
static

Initialize a rotation by angle in radians about axis vx,vy,vz.

Parameters
[in]radiansangle in degrees
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
static DMap4d FromScale ( double  ax,
double  ay,
double  az 
)
static

Initialize a pure scaling transformation.

If any scale factor is zero, the corresponding inverse entry is also zero.

Parameters
[in]axx scale factor
[in]ayy scale factor
[in]azz scale factor
static DMap4d FromScale ( double  a)
static

Initialize a uniform scaling transformation.

Parameters
[in]ascale factor
static DMap4d FromTranslation ( double  tx,
double  ty,
double  tz 
)
static

Initialize a translation transform.

Parameters
[in]txx component of translation
[in]tyy component of translation
[in]tzz component of translation
void InitFrom ( DMatrix4dCR  forwardMatrix,
DMatrix4dCR  inverseMatrix 
)

Direct initialization from matrices.

Caller is responsible for correct inverse relationship.

Parameters
[in]forwardMatrix"forward" matrix.
[in]inverseMatrix"inverse" matrix.
void InitFromPrincipleProjection ( double  height,
int  axis 
)

Initialize a transform that is a (noninvertible) projection to a principle plane.

Parameters
[in]heightdistance of plane from origin
[in]axis0,1,2 for x,y,z normal
void InitFromQuadrantRotation ( int  multiple,
double  vx,
double  vy,
double  vz 
)

Rotate about vx,yv,vz by an integer multiple of 90 degrees.

Providing the angle as an integer allows exact table lookup without approximation of pi.

Parameters
[in]multiplerotation angle is multiple * 90 degrees
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
bool InitFromRanges ( DPoint3dCR  loAP,
DPoint3dCR  hiAP,
DPoint3dCR  loBP,
DPoint3dCR  hiBP 
)

Initialize a transform which translates and scales along principle axes so box loAP..hiAP maps to box loBP..hiBP.

Parameters
[in]loAPcorner of box A
[in]hiAPdiagonally opposite corner of box A
[in]loBPcorner of box B
[in]hiBPdiagonally opposite corner of box B
Returns
int
void InitFromRotation ( double  c,
double  s,
double  vx,
double  vy,
double  vz 
)

Initialize a rotation about axis vx,vy,vz by angle whose cosine and sine are (proportional to) c and s.

Parameters
[in]ccosine of angle
[in]ssine of angle
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
void InitFromRotation ( double  radians,
double  vx,
double  vy,
double  vz 
)

Initialize a rotation by angle in radians about axis vx,vy,vz.

Parameters
[in]radiansangle in degrees
[in]vxx component of rotation axis
[in]vyy component of rotation axis
[in]vzz component of rotation axis
void InitFromScale ( double  ax,
double  ay,
double  az 
)

Initialize a pure scaling transformation.

If any scale factor is zero, the corresponding inverse entry is also zero.

Parameters
[in]axx scale factor
[in]ayy scale factor
[in]azz scale factor
void InitFromScale ( double  a)

Initialize a uniform scaling transformation.

Parameters
[in]ascale factor
bool InitFromSkewBox ( DPoint4dCR  point0001,
DPoint4dCR  point1001,
DPoint4dCR  point0101,
DPoint4dCR  point0010 
)

Fill a mapping between a unit prism and homogeneous skew space.

Example use: We want to map a unit rectangle from font space to screen, under a full perspective mapping. That is, given font space point (x,y) we want A * (x,y,0,1)^T = the visible pixel. Also, given pixel (i,j) we want Ainverse * (i,j,0,1) to map back into font space. A long time ago, we were told points P0,P1,P2 which are the preperspective points that correspond to font space (0,0), (1,0), and (0,1). Since then, P00, P10, P01 have been through a homogeneous transformation. (For instance, there may be 'weight' of other than 1 on each one.) The transformed (homogeneous) points are Q00, Q10, Q01 In device space, we do a projection in the z direction. Hence we need a 4th point Qz=(0,0,1,0). Build this matrix by calling jmdlDMap4d_fillHomogeneousSkewFrame (pHMap, Q00, Q10,Q01,Qz)

Parameters
point00010001 in the unit space maps here
point10011001 in the unit space maps here
point01010100 in the unit space maps here
point00100010 in the unit space maps here
Returns
true if the 4 points are independent
bool InitFromTaper ( double  taper)

Initialize a transform with perspective entries for a (nonzero) taper in the z direction.

Parameters
[in]tapertaper fraction
Returns
true if an invertible map was constructed.
bool InitFromTransform ( TransformCR  transform,
bool  invert 
)
Parameters
[in]transformaffine transformation 3x4 matrix
[in]inverttrue to treat this matrix as the inverse of the mapping, false if forward.
Returns
true if the Transfrom was invertible.
void InitFromTranslation ( double  tx,
double  ty,
double  tz 
)

Initialize a translation transform.

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

Initialize and identity mapping.

void InitProduct ( DMap4dCR  A,
DMap4dCR  B 
)

Multiply transforms.

Parameters
[in]Atransform A
[in]Btransform B
void InitProduct ( DMap4dCR  A,
bool  invertA,
DMap4dCR  B,
bool  invertB 
)

Multiply transforms, selecting optional forward or inverse for each.

Parameters
[in]Atransform A
[in]invertAif true, use invese of A
[in]Btransform B
[in]invertBif true, use invese of B
void InverseOf ( DMap4dCR  B)

Sets pA to the inverse of B.

Parameters
[in]Boriginal mapping
bool IsAffine ( ) const

Test if a transform is affiine.

Returns
true if the mapping is affine.
bool IsIdentity ( ) const
Returns
true if the mapping is an identity
bool IsIndependent ( int  xChange,
int  yChange,
int  zChange 
)

Checks if the mapping is strictly a scale/translate in specified directions.

Parameters
[in]xChange1 if x may change, 0 if it must stay fixed
[in]yChange1 if y may change, 0 if it must stay fixed
[in]zChange1 if z may change, 0 if it must stay fixed
Returns
true if independence tests are satisfied.
bool IsPerspective ( ) const

Test if a transform is perspective.

Returns
true if the mapping contains perspective.
bool IsSingular ( ) const

Test if a transform is singular.

Returns
true if the mapping is singular
void SandwichOf ( DMap4dCR  A,
DMap4dCR  B,
DMap4dCR  C 
)

Form the product C * Binv * A * B * Cinv.

Parameters
[in]Ainside term of sandwich
[in]Bmiddle term of sandwich
[in]Couter term of sandwich
void SandwichOfBABinverse ( DMap4dCR  A,
DMap4dCR  B 
)

Form the product B * A * BInv A NULL for B or C skips that part.

Parameters
[in]Ainside term of sandwich
[in]Bouter term of sandwich
void SandwichOfBinverseAB ( DMap4dCR  A,
DMap4dCR  B 
)

Form the product Binv * A * B.

Parameters
[in]Ainside term of sandwich
[in]Bouter term of sandwich
void ZFrustum ( double  z0,
double  zetaHalf 
)
Parameters
[in]z0reference z. Normalized projective coordinate is 0 at this z
[in]zetaHalfcontrols rate of growth of normalized projective z. Projective z at z0/k is k-1*zetahalf, i.e. is zetahalf at z0/2

Member Data Documentation

Forward transformation.

Inverse transformation.

int mask

Internal state data.


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

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