### The Transformation Matrix

IGrafMatrix defines a 2D transformation matrix. A 2D transformation matrix is an array of numbers with three rows and three columns for performing algebraic operations on a set of homogeneous coordinate points (regular points, rational points, or vectors) that define a 2D graphic.

IGrafMatrix transforms points in homogeneous space using rational points represented by the IGRPoint class. In homogeneous space, the third IGRPoint coordinate (fW) allows translation, rotation around an arbitrary point, scaling around an arbitrary point, perspective transformations, and shear transformations in addition to rotating and scaling around the origin through matrix multiplication. IGPoints have an implied fW of 1.0. Scaling a homogeneous matrix by a scalar does not change how it transforms an IGPoint; however, scaling a homogenous matrix by a scalar does change how it transforms an IGRPoint because an IGRPoint exists in homogeneous space.

IGrafMatrix implements the full set of 2-D linear affine transformations (translate, rotate, and scale) and supports concatenation (multiplying one matrix by another matrix). You can derive from IGrafMatrix to define your own transformation matrix implementation. The following table lists the IGrafMatrix member functions. All functions have default implementations that you do not need to override. Refer to the online Class and Member Function descriptions for information on the IGrafMatrix functions.

#### Constructors

IGrafMatrix functions can be called directly. The default constructor creates an identity matrix. The other constructors create rotate, translate, and scale matrices. In most cases, you can avoid having to specify or know about the numbers in the matrix. One of the constructors takes a specified array of numbers; and the matrix, element, and setElement functions provide access to the matrix.

### IGrafMatrix Inquiry Functions

The following table describes the IGrafMatrix inquiry functions:

### Member function | ### Action
--- | ---
matrix | Fills in a 9-element array of GCoordinates.
rotate | Returns true iff (if and only if) the matrix is a rotation matrix. If the matrix is a rotation matrix, rotate fills in the angle between 0 and 360 degrees, and the center of rotation.
type | Returns if the matrix is identity, translate, scale around a point, rotate around a point, affine, or perspective.
isIdentity | Returns true iff the matrix is identity.
isTranslate | Returns true iff the matrix only translates points.
isAffine | Returns true iff perspectiveX==0, perspectiveY==0 and homogeneous==1. A rectangle passed through an affine matrix becomes a parallelogram.
isRectilinear | Returns true iff a rectangle passed through the matrix is still a rectangle.

### IGrafMatrix Mathematical Operations

The following table describes the IGrafMatrix mathematical operations:

### Member function | ### Action
--- | ---
invert | Allows a matrix to reverse the effect it has on points. For example, if a transform moves a point from (0,0) to (1,1), the inverse transformation will move a point from (1,1) back to (0,0). If the transform cannot be inverted, throws an exception and does not change the destination.
untransformPoint | Is a shortcut method to invert on the fly
determinant | Gets the determinant. If the determinant is 0, a matrix is not invertible.
makeAdjoint | Converts the matrix to its "Classical Adjoint."
transpose | Swaps the rows and columns of a matrix.
normalize | Divides the matrix by the homogeneous value. Normalize raises an eUndefinedTransform ITransformException if the homogeneous value is 0.0.

Matrix Transformations