NextPrevUpTopContentsIndex

3.5.4 CLIM Transformation Functions

compose-transformations [Generic Function]

Arguments: transformation1 transformation2

Summary: Returns a transformation that is the mathematical composition of its arguments. Composition is in right-to-left order; that is, the resulting transformation represents the effects of applying the transformation transformation2 followed by the transformation transformation1 .

invert-transformation [Generic Function]

Arguments: transformation

Summary: Returns a transformation that is the inverse of the transformation transformation . The result of composing a transformation with its inverse is equal to the identity transformation.

If transformation is singular, invert-transformation will signal the singulartransformation error, with a named restart that is invoked with a transformation and makes invert-transformation return that transformation. This is to allow a drawing application, for example, to use a generalized inverse to transform a region through a singular transformation.

Note that with finite-precision arithmetic there are several low-level conditions that might occur during the attempt to invert a singular or "almost singular" transformation. (These include computation of a zero determinant, floating-point underflow during computation of the determinant, or floating-point overflow during subsequent multiplication.) invert-transformation signals the singular-transformation error for all of these cases.

compose-translation-with-transformation [Function]	

Arguments: transformation dx dy

compose-scaling-with-transformation [Function]	

Arguments: transformation sx sy &optional origin

compose-rotation-with-transformation [Function]	

Arguments: transformation angle &optional origin

Summary: These functions create a new transformation by composing the transformation transformation with a given translation, scaling, or rotation, respectively. The order of composition is that the translation, scaling, or rotation "transformation" is first, followed by transformation .

dx and dy are as for make-translation-transformation . sx and sy are as for make-scaling-transformation . angle and origin are as for make-rotationtransformation .

Note that these functions could be implemented by using the various constructors. They are provided because it is common to build up a transformation as a series of simple transformations.

compose-transformation-with-translation [Function]	

Arguments: transformation dx dy

compose-transformation-with-scaling [Function]	

Arguments: transformation sx sy &optional origin

compose-transformation-with-rotation [Function]	

Arguments: transformation angle &optional origin

Summary: These functions create a new transformation by composing a given translation, scaling, or rotation, respectively, with the transformation transformation . The order of composition is transformation first, followed by the translation, scaling, or rotation "transformation."

dx and dy are as for make-translation-transformation . sx and sy are as for make-scaling-transformation . angle and origin are as for make-rotationtransformation .

Note that these functions could be implemented by using the various constructors and compose-transformations . They are provided because it is common to build up a transformation as a series of simple transformations.

The following three functions are no different than using with-drawing-options with the :transformation keyword argument supplied. However, they are sufficiently useful that they are provided as a convenience to programmers.

In order to preserve referential transparency, these three forms apply the translation, rotation, or scaling transformation first, then the rest of the transformation from (medium-transformation medium ) . That is, the following two forms would return the same transformation (assuming that the medium's transformation in the second example is the identity transformation):

(compose-transformations
 (make-translation-transformation dx
 dy
) 
 (make-rotation-transformation angle
)) 
 
(with-translation (medium
 dx
 dy
) 
                  (with-rotation (medium
 angle
)
                                 (medium-transformation medium
))) 
with-translation [Macro]	

Arguments: (medium dx dy) &body body

Summary: Establishes a translation on the medium medium that translates by dx in the x direction and dy in the y direction, and then executes body with that transformation in effect.

dx and dy are as for make-translation-transformation .

The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard-output* is used. body may have zero or more declarations as its first forms.

with-scaling [Macro]	

Arguments: (medium sx &optional sy origin) &body body

Summary: Establishes a scaling transformation on the medium medium that scales by sx in the x direction and sy in the y direction, and then executes body with that transformation in effect. If sy is not supplied, it defaults to sx . If origin is supplied, the scaling is about that point; if it is not supplied, it defaults to (0, 0).

sx and sy are as for make-scaling-transformation .

The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard-output* is used. body may have zero or more declarations as its first forms.

with-rotation [Macro]	

Arguments: (medium angle &optional origin) &body body

Summary: Establishes a rotation on the medium medium that rotates by angle , and then executes body with that transformation in effect. If origin is supplied, the rotation is about that point; if it is not supplied, it defaults to (0, 0).

angle and origin are as for make-rotation-transformation .

The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard-output* is used. body may have zero or more declarations as its first forms.

These two functions also compose a transformation into the current transformation of a stream, but have more complex behavior.

with-local-coordinates [Macro]	

Arguments: (medium &optional x y) &body body

Summary: Binds the dynamic environment to establish a local coordinate system on the medium medium with the origin of the new coordinate system at the position (x, y) . The "directionality" of the coordinate system is otherwise unchanged. x and y are real numbers, and both default to 0.

The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard-output* is used. body may have zero or more declarations as its first forms.

with-first-quadrant-coordinates [Macro]	

Arguments: (medium &optional x y) &body body

Summary: Binds the dynamic environment to establish a local coordinate system on the medium medium with the positive x axis extending to the right and the positive y axis extending upward, with the origin of the new coordinate system at the position (x, y) . x and y are real numbers, and both default to 0.

The medium argument is not evaluated, and must be a symbol that is bound to a sheet or medium. If medium is t , *standard-output* is used. body may have zero or more declarations as its first forms.


CommonLisp Interface Manager 2.0 User's Guide - 18 Mar 2005

NextPrevUpTopContentsIndex