The trafo class represents a general linear
transformation, which is defined for a vector
as
Multiple trafo instances can be multiplied, corresponding to a
consecutive application of the respective transformation. Note that
trafo1*trafo2 means that trafo1 is applied after
trafo2, i.e. the new transformation is given
by
and
. Use the trafo
methods described below, if you prefer thinking the other way round.
The inverse of a transformation can be obtained via the trafo
method inverse(), defined by the inverse
of
the transformation matrix and the translation vector
.
The methods of the trafo class are summarized in the following
table.
| =.8 trafo method | =1.2function |
| =.8
__init__(matrix=((1,0),(0,1)),
vector=(0,0)): |
=1.2create new trafo instance with transformation matrix and vector. |
| =.8 apply(x, y) | =1.2apply trafo to point vector
|
| =.8 inverse() | =1.2returns inverse transformation of trafo. |
| =.8 mirrored(angle) | =1.2returns trafo followed by mirroring
at line through |
| =.8
rotated(angle, x=None, y=None) |
=1.2
returns trafo followed by rotation by angle degrees
around point
|
| =.8
scaled(sx, sy=None,
x=None, y=None) |
=1.2
returns trafo followed by
scaling with scaling factor sx in |
| =.8 translated(x, y) | =1.2returns trafo followed by
translation by vector
|
| =.8 slanted(a, angle=0, x=None, y=None) | =1.2returns trafo followed by XXX |