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:
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:
You can describe affine and perspective transformations. You can even easily describe shear transformations.
![]()