• Home
  • Raw
  • Download

Lines Matching full:transform

3 The Transform class implements various transformation matrix operations,
6 Transform instances are effectively immutable: all methods that operate on the
8 interesting side effect that Transform instances are hashable, ie. they can be
13 Transform
16 Transform instance set to the identity transformation
27 >>> t = Transform(2, 0, 0, 3, 0, 0)
60 __all__ = ["Transform", "Identity", "Offset", "Scale", "DecomposedTransform"]
78 class Transform(NamedTuple): class
79 """2x2 transformation matrix plus offset, a.k.a. Affine transform.
80 Transform instances are immutable: all transforming methods, eg.
81 rotate(), return a new Transform instance.
85 >>> t = Transform()
87 <Transform [1 0 0 1 0 0]>
89 <Transform [2 0 0 2 0 0]>
91 <Transform [2.5 0 0 5.5 0 0]>
96 Transform's constructor takes six arguments, all of which are
99 >>> Transform(12)
100 <Transform [12 0 0 1 0 0]>
101 >>> Transform(dx=12)
102 <Transform [1 0 0 1 12 0]>
103 >>> Transform(yx=12)
104 <Transform [1 0 12 1 0 0]>
106 Transform instances also behave like sequences of length 6::
115 Transform instances are comparable::
127 <Transform [0.2 0 0 0.3 0.08 0.18]>
129 <Transform [0.2 0 0 0.3 0.08 0.18]>
133 Transform instances are hashable, meaning you can use them as
138 {<Transform [12 0 0 13 0 0]>: None}
145 <Transform [0.2 0 0 0.3 0.08 0.18]>
147 <Transform [0.2 0 0 0.3 0.08 0.18]>
150 {<Transform [0.2 0 0 0.3 0.08 0.18]>: None}
154 KeyError: <Transform [0.2 0 0 0.3 0.08 0.18]>
165 """Transform a point.
169 >>> t = Transform()
179 """Transform a list of points.
192 """Transform an (dx, dy) vector, treating translation as zero.
196 >>> t = Transform(2, 0, 0, 2, 10, 20)
206 """Transform a list of (dx, dy) vector, treating translation as zero.
209 >>> t = Transform(2, 0, 0, 2, 10, 20)
221 >>> t = Transform()
223 <Transform [1 0 0 1 20 30]>
226 return self.transform((1, 0, 0, 1, x, y))
233 >>> t = Transform()
235 <Transform [5 0 0 5 0 0]>
237 <Transform [5 0 0 6 0 0]>
242 return self.transform((x, 0, 0, y, 0, 0))
249 >>> t = Transform()
251 <Transform [0 1 -1 0 0 0]>
258 return self.transform((c, s, -s, c, 0, 0))
265 >>> t = Transform()
267 <Transform [1 0 1 1 0 0]>
272 return self.transform((1, math.tan(y), math.tan(x), 1, 0, 0))
274 def transform(self, other): member in Transform
279 >>> t = Transform(2, 0, 0, 3, 1, 6)
280 >>> t.transform((4, 3, 2, 1, 5, 6))
281 <Transform [8 9 4 3 11 24]>
298 other.transform(self).
301 >>> t = Transform(2, 0, 0, 3, 1, 6)
303 <Transform [8 6 6 3 21 15]>
304 >>> Transform(4, 3, 2, 1, 5, 6).transform((2, 0, 0, 3, 1, 6))
305 <Transform [8 6 6 3 21 15]>
356 """Returns True if transform is not identity, False otherwise.
362 >>> bool(Transform())
381 Identity = Transform()
389 <Transform [1 0 0 1 2 3]>
392 return Transform(1, 0, 0, 1, x, y)
401 <Transform [2 0 0 3 0 0]>
406 return Transform(x, 0, 0, y, 0, 0)
426 def fromTransform(self, transform): argument
429 a, b, c, d, x, y = transform
472 """Return the Transform() equivalent of this transformation.
476 <Transform [2 0 0 2 0 0]>
479 t = Transform()