NextPrevUpTopContentsIndex

12.4.1 Generalized points

An (x, y) coordinate pair can be transformed to another coordinate system by scaling, rotation and translation. The first two can be implemented using 2 x 2 matrices to hold the coefficients:

If the point P is (a, b) and it is transformed to the point Q (a', b')

P Q or (a, b) ? (a', b')

a' = pa + rb , b' = qa + sb .

 

Translation can be included in this if the points P and Q are regarded as 3-vectors instead of 2-vectors, with the 3rd element being unity:

 

The coefficients u and v specify the translation.

So, the six elements ( p , q , r , s , u , and v ) of the 3 x 3 matrix contain all the transformation information. These elements are stored in a list in the graphics state slot transform .

Transforms can be combined by matrix multiplication to effect successions of translation, scaling and rotation operations.

Functions are provided in Graphics Ports which apply translation, scaling and rotation to a transform, combine transforms by pre- or post-multiplication, invert a transform, and so on.


LispWorks CAPI User Guide (Unix version) - 17 Mar 2008

NextPrevUpTopContentsIndex