TranslateScale

from kurbopy import TranslateScale

t = TranslateScale(Vec2(100.0, 100.0), 2.0)
class kurbopy.TranslateScale

A transformation including scaling and translation.

If the translation is (x, y) and the scale is s, then this transformation represents this augmented matrix:

| s 0 x |
| 0 s y |
| 0 0 1 |

See [Affine] for more details about the equivalence with augmented matrices.

Various multiplication ops are defined, and these are all defined to be consistent with matrix multiplication. Therefore, TranslateScale * Point is defined but not the other way around.

Also note that multiplication is not commutative. Thus, TranslateScale.scale(2.0) * TranslateScale.translate(Vec2(1.0, 0.0)) has a translation of (2, 0), while TranslateScale.translate(Vec2(1.0, 0.0)) * TranslateScale.scale(2.0) has a translation of (1, 0). (Both have a scale of 2).

This transformation is less powerful than Affine, but can be applied to more primitives, especially including Rect.

as_tuple()

Decompose transformation into translation and scale.

inverse()

Compute the inverse transform.

Multiplying a transform with its inverse (either on the left or right) results in the identity transform (modulo floating point rounding errors).

Produces NaN values when scale is zero.

is_finite()

Is this translate/scale finite?

is_nan()

Is this translate/scale NaN?

scale(scale)

Create a new transformation with scale only.

translate(vec2)

Create a new transformation with translation only.