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... | |
Forward and inverse 4x4 matrices of an invertible perspective transformation.
void Explode | ( | RotMatrixR | matrix, |
DPoint3dR | translation, | ||
DPoint4dR | perspective, | ||
bool | inverse | ||
) | const |
Copy various parts of the 4x4 matrix to separate data structures.
[out] | matrix | upper 3x3 |
[out] | translation | last column (above diagonal) |
[out] | perspective | last row (including diagonal) |
[in] | inverse | false for forward part, true for inverse |
|
static |
Direct initialization from matrices.
Caller is responsible for correct inverse relationship.
[in] | forwardMatrix | "forward" matrix. |
[in] | inverseMatrix | "inverse" matrix. |
|
static |
Initialize and identity mapping.
|
static |
Initialize a transform that is a (noninvertible) projection to a principle plane.
[in] | height | distance of plane from origin |
[in] | axis | 0,1,2 for x,y,z normal |
|
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.
[in] | multiple | rotation angle is multiple * 90 degrees |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z component of rotation axis |
|
static |
Initialize a rotation about axis vx,vy,vz by angle whose cosine and sine are (proportional to) c and s.
[in] | c | cosine of angle |
[in] | s | sine of angle |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z component of rotation axis |
|
static |
Initialize a rotation by angle in radians about axis vx,vy,vz.
[in] | radians | angle in degrees |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z component of rotation axis |
|
static |
Initialize a pure scaling transformation.
If any scale factor is zero, the corresponding inverse entry is also zero.
[in] | ax | x scale factor |
[in] | ay | y scale factor |
[in] | az | z scale factor |
|
static |
Initialize a uniform scaling transformation.
[in] | a | scale factor |
|
static |
Initialize a translation transform.
[in] | tx | x component of translation |
[in] | ty | y component of translation |
[in] | tz | z component of translation |
void InitFrom | ( | DMatrix4dCR | forwardMatrix, |
DMatrix4dCR | inverseMatrix | ||
) |
Direct initialization from matrices.
Caller is responsible for correct inverse relationship.
[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.
[in] | height | distance of plane from origin |
[in] | axis | 0,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.
[in] | multiple | rotation angle is multiple * 90 degrees |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z 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.
[in] | loAP | corner of box A |
[in] | hiAP | diagonally opposite corner of box A |
[in] | loBP | corner of box B |
[in] | hiBP | diagonally opposite corner of box B |
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.
[in] | c | cosine of angle |
[in] | s | sine of angle |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z 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.
[in] | radians | angle in degrees |
[in] | vx | x component of rotation axis |
[in] | vy | y component of rotation axis |
[in] | vz | z 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.
[in] | ax | x scale factor |
[in] | ay | y scale factor |
[in] | az | z scale factor |
void InitFromScale | ( | double | a | ) |
Initialize a uniform scaling transformation.
[in] | a | scale 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)
point0001 | 0001 in the unit space maps here |
point1001 | 1001 in the unit space maps here |
point0101 | 0100 in the unit space maps here |
point0010 | 0010 in the unit space maps here |
bool InitFromTaper | ( | double | taper | ) |
Initialize a transform with perspective entries for a (nonzero) taper in the z direction.
[in] | taper | taper fraction |
bool InitFromTransform | ( | TransformCR | transform, |
bool | invert | ||
) |
[in] | transform | affine transformation 3x4 matrix |
[in] | invert | true to treat this matrix as the inverse of the mapping, false if forward. |
void InitFromTranslation | ( | double | tx, |
double | ty, | ||
double | tz | ||
) |
Initialize a translation transform.
[in] | tx | x component of translation |
[in] | ty | y component of translation |
[in] | tz | z component of translation |
void InitIdentity | ( | ) |
Initialize and identity mapping.
void InitProduct | ( | DMap4dCR | A, |
DMap4dCR | B | ||
) |
Multiply transforms.
[in] | A | transform A |
[in] | B | transform B |
void InitProduct | ( | DMap4dCR | A, |
bool | invertA, | ||
DMap4dCR | B, | ||
bool | invertB | ||
) |
Multiply transforms, selecting optional forward or inverse for each.
[in] | A | transform A |
[in] | invertA | if true, use invese of A |
[in] | B | transform B |
[in] | invertB | if true, use invese of B |
void InverseOf | ( | DMap4dCR | B | ) |
Sets pA to the inverse of B.
[in] | B | original mapping |
bool IsAffine | ( | ) | const |
Test if a transform is affiine.
bool IsIdentity | ( | ) | const |
bool IsIndependent | ( | int | xChange, |
int | yChange, | ||
int | zChange | ||
) |
Checks if the mapping is strictly a scale/translate in specified directions.
[in] | xChange | 1 if x may change, 0 if it must stay fixed |
[in] | yChange | 1 if y may change, 0 if it must stay fixed |
[in] | zChange | 1 if z may change, 0 if it must stay fixed |
bool IsPerspective | ( | ) | const |
Test if a transform is perspective.
bool IsSingular | ( | ) | const |
Test if a transform is singular.
void SandwichOf | ( | DMap4dCR | A, |
DMap4dCR | B, | ||
DMap4dCR | C | ||
) |
Form the product C * Binv * A * B * Cinv.
[in] | A | inside term of sandwich |
[in] | B | middle term of sandwich |
[in] | C | outer term of sandwich |
void SandwichOfBABinverse | ( | DMap4dCR | A, |
DMap4dCR | B | ||
) |
Form the product B * A * BInv A NULL for B or C skips that part.
[in] | A | inside term of sandwich |
[in] | B | outer term of sandwich |
void SandwichOfBinverseAB | ( | DMap4dCR | A, |
DMap4dCR | B | ||
) |
Form the product Binv * A * B.
[in] | A | inside term of sandwich |
[in] | B | outer term of sandwich |
void ZFrustum | ( | double | z0, |
double | zetaHalf | ||
) |
[in] | z0 | reference z. Normalized projective coordinate is 0 at this z |
[in] | zetaHalf | controls rate of growth of normalized projective z. Projective z at z0/k is k-1*zetahalf, i.e. is zetahalf at z0/2 |
DMatrix4d M0 |
Forward transformation.
DMatrix4d M1 |
Inverse transformation.
int mask |
Internal state data.