### Perspective Map Transformations

You can define a transformation matrix by specifying what a convex quadrilateral (four-sided polygon) looks like before and after the transformation. This technique utilizes a perspective map. A perspective map defines a linear transformation from a source convex quadrilateral to a destination quadrilateral.

You can:

- Use the IGrafMatrix::setToPerspectiveMap function to create a perspective map to define all of the standard transformations
- Define a translation matrix by specifying a source polygon and a destination polygon that is the same as the source, but in a different (x, y) position
- Define a scaling matrix by making the destination polygon larger or smaller than the source
- Define a rotation matrix by rotating the destination polygon.

Function setToPerspectiveMap sets the matrix to a perspective mapping from a source polygon to a destination polygon. The source and destination polygons must be convex, and they must have four vertices (quadrilateral). It creates the following perspective mapping:

fromQuadrilateral [0] --> toQuadrilateral [0]
fromQuadrilateral [1] --> toQuadrilateral [1]
fromQuadrilateral [2] --> toQuadrilateral [2]
fromQuadrilateral [3] --> toQuadrilateral [3]

You can use a perspective map to define all of the standard transformations:

- Moving the quadrilateral defines translation.
- Making the quadrilateral larger or smaller defines scale.
- Rotating the quadrilateral defines rotation.

You can describe affine and perspective transformations. You can even easily describe shear transformations.

The Transformation Matrix