matrix.h File Reference

#include "user.h"

Go to the source code of this file.

Data Structures

struct  MATRIX

Defines

#define GetM11(x)   MatrixGetValue(x,MatrixM11)
 Gets the scaling X factor of the matrix.
#define GetM12(x)   MatrixGetValue(x,MatrixM12)
 Gets the shearing X factor of the matrix.
#define GetM21(x)   MatrixGetValue(x,MatrixM21)
 Gets the shearing Y factor of the matrix.
#define GetM22(x)   MatrixGetValue(x,MatrixM22)
 Gets the scaling Y factor of the matrix.
#define GetDx(x)   MatrixGetValue(x,MatrixDx)
 Gets the X offset of the matrix.
#define GetDy(x)   MatrixGetValue(x,MatrixDy)
 Gets the Y offset of the matrix.
#define MatrixDoAppend(dst, src)   MatrixMultiply(dst,dst,src)
 Appends another matrix to this matrix.
#define MatrixDoPrepend(dst, src)   MatrixMultiply(dst,src,dst)
 Prepends another matrix to this matrix.

Enumerations

enum  MATRIXMODE { MatrixSet = 0, MatrixAppend = 1, MatrixPrepend = 2 }
 Specifies how a matrix is combined with another matrix. More...
enum  MATRIXELEMENT {
  MatrixM11, MatrixM12, MatrixM21, MatrixM22,
  MatrixDx, MatrixDy
}
 Specifies an element of the matrix. More...

Functions

double MatrixDeterminant (MATRIX *mat)
 Gets the determinant of the matrix, or the ratio by which an object transformed by this matrix changes in size.
BOOL MatrixInvert (MATRIX *matDst, MATRIX *matSrc)
 Inverts _matSrc_ and stores the result in _matDst_.
BOOL MatrixIsInvertible (MATRIX *mat)
 Determines whether the matrix can be inverted.
BOOL MatrixIsIdentity (MATRIX *mat)
 Determines whether the matrix equals the identity matrix.
void MatrixSetIdentity (MATRIX *mat)
 Sets this matrix to the identity matrix.
BOOL MatrixEquals (MATRIX *mat, MATRIX *mat2)
 Determines whether the matrix equals another matrix.
BOOL MatrixAreClose (MATRIX *mat, MATRIX *mat2)
 Determines whether the matrix is close to another matrix.
void MatrixTransformVectors (MATRIX *mat, double *pts, DWORD numpts)
 Transforms an array of distance vectors using the specified matrix, ignoring the translation components of the matrix.
void MatrixTransformPoints (MATRIX *mat, double *pts, DWORD numpts)
 Transforms an array of points using the specified matrix.
double MatrixGetValue (MATRIX *mat, MATRIXELEMENT elem)
 Gets a matrix element from the matrix.
BOOL MatrixSetValue (MATRIX *mat, MATRIXELEMENT elem, double value)
 Sets a matrix element in the matrix to _value_.
BOOL MatrixGetValueArray (MATRIX *mat, double *values)
 Gets the elements in the matrix.
BOOL MatrixSetValueArray (MATRIX *mat, double *values)
 Sets all elements in the matrix at once.
void MatrixSetValues (MATRIX *mat, double m11, double m12, double m21, double m22, double dx, double dy)
 Sets all elements in the matrix at once.
void MatrixMultiply (MATRIX *matResult, MATRIX *matLeft, MATRIX *matRight)
 Multiplies two matrices (matLeft and matRight) and stores the result in matResult.
void MatrixTranslate (MATRIX *mat, double x, double y, MATRIXMODE mode)
 Adds a translation transform to the matrix.
void MatrixScale (MATRIX *mat, double x, double y, MATRIXMODE mode)
 Adds a scaling transform to this matrix.
void MatrixRotate (MATRIX *mat, double degrees, MATRIXMODE mode)
 Adds a rotation to this matrix.
void MatrixParallelogram (MATRIX *mat, double *rect, double *points, MATRIXMODE mode)
 Adds a transform to this matrix based on the conversion of a rectangle to a parallelogram.
void MatrixRotateAt (MATRIX *mat, double degrees, double x, double y, MATRIXMODE mode)
 Adds a rotation to this matrix with the specified origin.
void MatrixScaleAt (MATRIX *mat, double x, double y, double centerX, double centerY, MATRIXMODE mode)
 Adds a scaling transform to this matrix with the specified origin.
void MatrixShear (MATRIX *mat, double shearX, double shearY, MATRIXMODE mode)
 Adds a shear transform to the matrix.
void MatrixSkew (MATRIX *mat, double angleX, double angleY, MATRIXMODE mode)
 Adds a skew transform to the matrix.


Define Documentation

#define GetDx  )     MatrixGetValue(x,MatrixDx)
 

Gets the X offset of the matrix.

Definition at line 50 of file matrix.h.

#define GetDy  )     MatrixGetValue(x,MatrixDy)
 

Gets the Y offset of the matrix.

Definition at line 52 of file matrix.h.

#define GetM11  )     MatrixGetValue(x,MatrixM11)
 

Gets the scaling X factor of the matrix.

Definition at line 42 of file matrix.h.

#define GetM12  )     MatrixGetValue(x,MatrixM12)
 

Gets the shearing X factor of the matrix.

Definition at line 44 of file matrix.h.

#define GetM21  )     MatrixGetValue(x,MatrixM21)
 

Gets the shearing Y factor of the matrix.

Definition at line 46 of file matrix.h.

#define GetM22  )     MatrixGetValue(x,MatrixM22)
 

Gets the scaling Y factor of the matrix.

Definition at line 48 of file matrix.h.

#define MatrixDoAppend dst,
src   )     MatrixMultiply(dst,dst,src)
 

Appends another matrix to this matrix.

This operation is similar to Java's _preConcatenate_ method.

Definition at line 57 of file matrix.h.

#define MatrixDoPrepend dst,
src   )     MatrixMultiply(dst,src,dst)
 

Prepends another matrix to this matrix.

This operation is similar to Java's _concatenate_ method.

Definition at line 61 of file matrix.h.


Enumeration Type Documentation

enum MATRIXELEMENT
 

Specifies an element of the matrix.

Enumerator:
MatrixM11  X scaling factor.
MatrixM12  Y shearing factor.
MatrixM21  X shearing factor.
MatrixM22  Y scaling factor.
MatrixDx  X offset.
MatrixDy  Y offset.

Definition at line 22 of file matrix.h.

enum MATRIXMODE
 

Specifies how a matrix is combined with another matrix.

Enumerator:
MatrixSet  Copies the matrix without combining it.
MatrixAppend  Appends the matrix to the existing matrix.
MatrixPrepend  Prepends the matrix onto the existing matrix.

Definition at line 12 of file matrix.h.


Function Documentation

BOOL MatrixAreClose MATRIX mat,
MATRIX mat2
 

Determines whether the matrix is close to another matrix.

Definition at line 72 of file matrix.c.

double MatrixDeterminant MATRIX mat  ) 
 

Gets the determinant of the matrix, or the ratio by which an object transformed by this matrix changes in size.

If this value equals 0, then the matrix is one that maps coordinates to a single point or line and can't be inverted.

Definition at line 133 of file matrix.c.

BOOL MatrixEquals MATRIX mat,
MATRIX mat2
 

Determines whether the matrix equals another matrix.

Definition at line 58 of file matrix.c.

double MatrixGetValue MATRIX mat,
MATRIXELEMENT  elem
 

Gets a matrix element from the matrix.

Definition at line 161 of file matrix.c.

BOOL MatrixGetValueArray MATRIX mat,
double *  values
 

Gets the elements in the matrix.

Parameters:
mat A matrix structure.
pts An array of six double values.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 175 of file matrix.c.

BOOL MatrixInvert MATRIX matDst,
MATRIX matSrc
 

Inverts _matSrc_ and stores the result in _matDst_.

The inverted matrix, when combined with the source matrix, results in the identity matrix.

Parameters:
matDst The matrix to store the result.
matSrc The input matrix.
Returns:
TRUE if the matrix was inverted, FALSE if matDst or matSrc is NULL or matSrc is not invertible.

Definition at line 206 of file matrix.c.

BOOL MatrixIsIdentity MATRIX mat  ) 
 

Determines whether the matrix equals the identity matrix.

Definition at line 233 of file matrix.c.

BOOL MatrixIsInvertible MATRIX mat  ) 
 

Determines whether the matrix can be inverted.

A matrix is invertible if its determinant is not equal to 0.

Definition at line 200 of file matrix.c.

void MatrixMultiply MATRIX matResult,
MATRIX matLeft,
MATRIX matRight
 

Multiplies two matrices (matLeft and matRight) and stores the result in matResult.

Definition at line 270 of file matrix.c.

void MatrixParallelogram MATRIX mat,
double *  rect,
double *  points,
MATRIXMODE  mode
 

Adds a transform to this matrix based on the conversion of a rectangle to a parallelogram.

Parameters:
mat A matrix structure.
rect An array of four Double values specifying the X, Y, width, and height of a rectangle.
points An array of six Double values in three pairs that specify the upper-left, upper-right, and lower-left corners of a parallelogram.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 482 of file matrix.c.

void MatrixRotate MATRIX mat,
double  degrees,
MATRIXMODE  mode
 

Adds a rotation to this matrix.

Parameters:
mat A matrix structure.
degrees The angle of the rotation, in degrees.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 391 of file matrix.c.

void MatrixRotateAt MATRIX mat,
double  degrees,
double  x,
double  y,
MATRIXMODE  mode
 

Adds a rotation to this matrix with the specified origin.

Parameters:
mat A matrix structure.
degrees The angle of the rotation, in degrees.
x X coordinate for the rotation's center.
y Y coordinate for the rotation's center.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 409 of file matrix.c.

void MatrixScale MATRIX mat,
double  x,
double  y,
MATRIXMODE  mode
 

Adds a scaling transform to this matrix.

Parameters:
mat A matrix structure.
x X scaling factor.
y Y scaling factor.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 427 of file matrix.c.

void MatrixScaleAt MATRIX mat,
double  x,
double  y,
double  centerX,
double  centerY,
MATRIXMODE  mode
 

Adds a scaling transform to this matrix with the specified origin.

Parameters:
mat A matrix structure.
x X scaling factor.
y Y scaling factor.
centerX X coordinate for the scaling transform's center.
centerY Y coordinate for the scaling transform's center.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 440 of file matrix.c.

void MatrixSetIdentity MATRIX mat  ) 
 

Sets this matrix to the identity matrix.

Definition at line 243 of file matrix.c.

BOOL MatrixSetValue MATRIX mat,
MATRIXELEMENT  elem,
double  value
 

Sets a matrix element in the matrix to _value_.

Definition at line 167 of file matrix.c.

BOOL MatrixSetValueArray MATRIX mat,
double *  values
 

Sets all elements in the matrix at once.

Parameters:
mat A matrix structure.
pts An array of six double values.
Returns:
TRUE if successful, FALSE otherwise.

Definition at line 187 of file matrix.c.

void MatrixSetValues MATRIX mat,
double  m11,
double  m12,
double  m21,
double  m22,
double  dx,
double  dy
 

Sets all elements in the matrix at once.

Definition at line 255 of file matrix.c.

void MatrixShear MATRIX mat,
double  shearX,
double  shearY,
MATRIXMODE  mode
 

Adds a shear transform to the matrix.

Parameters:
mat A matrix structure.
shearX The shear factor along the X axis.
shearY The shear factor along the Y axis.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 468 of file matrix.c.

void MatrixSkew MATRIX mat,
double  angleX,
double  angleY,
MATRIXMODE  mode
 

Adds a skew transform to the matrix.

Parameters:
mat A matrix structure.
angleX The skew angle along the X axis. The X shearing factor will equal the tangent of this angle.
angleY The skew angle along the Y axis. The Y shearing factor will equal the tangent of this angle.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 453 of file matrix.c.

void MatrixTransformPoints MATRIX mat,
double *  pts,
DWORD  numpts
 

Transforms an array of points using the specified matrix.

See also MatrixTransformVectors().

Parameters:
mat A matrix for transforming the points.
pts An array of points. Each point is a pair of double values, where the first value is the X coordinate and the second is the Y coordinate.
numpts The number of points (pairs of _double_ floating point values) in the array.

Definition at line 86 of file matrix.c.

void MatrixTransformVectors MATRIX mat,
double *  pts,
DWORD  numpts
 

Transforms an array of distance vectors using the specified matrix, ignoring the translation components of the matrix.

See also MatrixTransformPoints().

Parameters:
mat A matrix for transforming the vectors. The translation coordinates (Dx and Dy) are ignored.
pts An array of vectors. Each vector is a pair of double values, where the first value is the X coordinate and the second is the Y coordinate.
numpts The number of vectors (pairs of _double_ floating point values) in the array.

Definition at line 113 of file matrix.c.

void MatrixTranslate MATRIX mat,
double  x,
double  y,
MATRIXMODE  mode
 

Adds a translation transform to the matrix.

Parameters:
mat A matrix structure.
x The X-offset of the translation.
y The Y-offset of the translation.
mode Specifies how the calculated matrix is combined with this matrix. See MATRIXMODE for details.

Definition at line 361 of file matrix.c.


Generated on Thu Mar 27 01:46:56 2008 for Item Arrays by  doxygen 1.4.6-NO