Add a skew in place. *xShear* and *yShear* are the shear angles along the *x*- and *y*-axes, respectively, in radians. Returns *self*, so this method can easily be chained with more calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate` and
(self, xShear, yShear)
| 2121 | return self |
| 2122 | |
| 2123 | def skew(self, xShear, yShear): |
| 2124 | """ |
| 2125 | Add a skew in place. |
| 2126 | |
| 2127 | *xShear* and *yShear* are the shear angles along the *x*- and |
| 2128 | *y*-axes, respectively, in radians. |
| 2129 | |
| 2130 | Returns *self*, so this method can easily be chained with more |
| 2131 | calls to :meth:`rotate`, :meth:`rotate_deg`, :meth:`translate` |
| 2132 | and :meth:`scale`. |
| 2133 | """ |
| 2134 | rx = math.tan(xShear) |
| 2135 | ry = math.tan(yShear) |
| 2136 | mtx = self._mtx |
| 2137 | # Operating and assigning one scalar at a time is much faster. |
| 2138 | (xx, xy, x0), (yx, yy, y0), _ = mtx.tolist() |
| 2139 | # mtx = [[1 rx 0], [ry 1 0], [0 0 1]] * mtx |
| 2140 | mtx[0, 0] += rx * yx |
| 2141 | mtx[0, 1] += rx * yy |
| 2142 | mtx[0, 2] += rx * y0 |
| 2143 | mtx[1, 0] += ry * xx |
| 2144 | mtx[1, 1] += ry * xy |
| 2145 | mtx[1, 2] += ry * x0 |
| 2146 | self.invalidate() |
| 2147 | return self |
| 2148 | |
| 2149 | def skew_deg(self, xShear, yShear): |
| 2150 | """ |