35
37
:math:`\mathsf{A}^{-1}` of the transformation matrix and the translation vector
36
38
:math:`-\mathsf{A}^{-1}\vec{b}`.
38
The methods of the ``trafo`` class are summarized in the following table.
40
+-----------------------------------------+----------------------------------------------+
41
| ``trafo`` method | function |
42
+=========================================+==============================================+
43
| ``__init__(matrix=((1,0),(0,1)), | create new ``trafo`` instance with |
44
| vector=(0,0)):`` | transformation ``matrix`` and ``vector``. |
45
+-----------------------------------------+----------------------------------------------+
46
| ``apply(x, y)`` | apply ``trafo`` to point vector |
47
| | :math:`(\mathtt{x}, \mathtt{y})`. |
48
+-----------------------------------------+----------------------------------------------+
49
| ``inverse()`` | returns inverse transformation of ``trafo``. |
50
+-----------------------------------------+----------------------------------------------+
51
| ``mirrored(angle)`` | returns ``trafo`` followed by mirroring at |
52
| | line through :math:`(0,0)` with direction |
53
| | ``angle`` in degrees. |
54
+-----------------------------------------+----------------------------------------------+
55
| ``rotated(angle, x=None, y=None)`` | returns ``trafo`` followed by rotation by |
56
| | ``angle`` degrees around point |
57
| | :math:`(\mathtt{x}, \mathtt{y})`, or |
58
| | :math:`(0,0)`, if not given. |
59
+-----------------------------------------+----------------------------------------------+
60
| ``scaled(sx, sy=None, x=None, y=None)`` | returns ``trafo`` followed by scaling with |
61
| | scaling factor ``sx`` in :math:`x`\ |
62
| | -direction, ``sy`` in :math:`y`\ -direction |
63
| | (:math:`\mathtt{sy}=\mathtt{sx}`, if not |
64
| | given) with scaling center |
65
| | :math:`(\mathtt{x}, \mathtt{y})`, or |
66
| | :math:`(0,0)`, if not given. |
67
+-----------------------------------------+----------------------------------------------+
68
| ``translated(x, y)`` | returns ``trafo`` followed by translation by |
69
| | vector :math:`(\mathtt{x}, \mathtt{y})`. |
70
+-----------------------------------------+----------------------------------------------+
71
| ``slanted(a, angle=0, x=None, y=None)`` | returns ``trafo`` followed by XXX |
72
+-----------------------------------------+----------------------------------------------+
40
.. class:: trafo(matrix=((1,0),(0,1)), vector=(0,0))
42
create new ``trafo`` instance with transformation ``matrix`` and ``vector``
44
.. method:: apply(x, y)
46
apply ``trafo`` to point vector :math:`(\mathtt{x}, \mathtt{y})`.
50
returns inverse transformation of ``trafo``.
52
.. method:: mirrored(angle)
54
returns ``trafo`` followed by mirroring at line through :math:`(0,0)` with
55
direction ``angle`` in degrees.
57
.. method:: rotated(angle, x=None, y=None)
59
returns ``trafo`` followed by rotation by ``angle`` degrees around point
60
:math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not given.
62
.. method:: scaled(sx, sy=None, x=None, y=None)
64
returns ``trafo`` followed by scaling with scaling factor ``sx`` in
65
:math:`x`\ -direction, ``sy`` in :math:`y`\ -direction
66
(:math:`\mathtt{sy}=\mathtt{sx}`, if not given) with scaling center
67
:math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not given.
69
.. method:: slanted(a, angle=0, x=None, y=None)
71
returns ``trafo`` followed by slant by ``angle`` around point
72
:math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not given.
74
.. method:: translated(x, y)
76
returns ``trafo`` followed by translation by vector :math:`(\mathtt{x}, \mathtt{y})`.
79
Subclasses of :class:`trafo`
80
============================
78
82
The ``trafo`` module provides a number of subclasses of the ``trafo`` class,
79
each of which corresponds to one ``trafo`` method. They are listed in the
82
+----------------------------------------+----------------------------------------------+
83
| ``trafo`` subclass | function |
84
+========================================+==============================================+
85
| ``mirror(angle)`` | mirroring at line through :math:`(0,0)` with |
86
| | direction ``angle`` in degrees. |
87
+----------------------------------------+----------------------------------------------+
88
| ``rotate(angle, x=None, y=None)`` | rotation by ``angle`` degrees around point |
89
| | :math:`(\mathtt{x}, \mathtt{y})`, or |
90
| | :math:`(0,0)`, if not given. |
91
+----------------------------------------+----------------------------------------------+
92
| ``scale(sx, sy=None, x=None, y=None)`` | scaling with scaling factor ``sx`` in |
93
| | :math:`x`\ -direction, ``sy`` in :math:`y`\ |
94
| | -direction (:math:`\mathtt{sy}=\mathtt{sx}`, |
95
| | if not given) with scaling center |
96
| | :math:`(\mathtt{x}, \mathtt{y})`, or |
97
| | :math:`(0,0)`, if not given. |
98
+----------------------------------------+----------------------------------------------+
99
| ``translate(x, y)`` | translation by vector :math:`(\mathtt{x}, |
101
+----------------------------------------+----------------------------------------------+
102
| ``slant(a, angle=0, x=None, y=None)`` | XXX |
103
+----------------------------------------+----------------------------------------------+
83
each of which corresponds to one ``trafo`` method.
85
.. class:: mirror(angle)
87
mirroring at line through :math:`(0,0)` with direction ``angle`` in degrees.
89
.. class:: rotate(angle, x=None, y=None)
91
rotation by ``angle`` degrees around point :math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not given.
93
.. class:: scale(sx, sy=None, x=None, y=None)
95
scaling with scaling factor ``sx`` in :math:`x`\ -direction, ``sy`` in
96
:math:`y`\ -direction (:math:`\mathtt{sy}=\mathtt{sx}`, if not given) with
97
scaling center :math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not
100
.. class:: slant(a, angle=0, x=None, y=None)
102
slant by ``angle`` around point :math:`(\mathtt{x}, \mathtt{y})`, or :math:`(0,0)`, if not given.
104
.. class:: translate(x, y)
106
translation by vector :math:`(\mathtt{x}, \mathtt{y})`.