Struct kurbo::TranslateScale[][src]

pub struct TranslateScale { /* fields omitted */ }
Expand description

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::new(1.0, 0.0)) has a translation of (2, 0), while TranslateScale::translate(Vec2::new(1.0, 0.0)) * TranslateScale::scale(2.0) has a translation of (1, 0). (Both have a scale of 2; also note that the first case can be written 2.0 * TranslateScale::translate(Vec2::new(1.0, 0.0)) as this case has an implicit conversion).

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

Implementations

Create a new transformation from translation and scale.

Create a new transformation with scale only.

Create a new transformation with translation only.

Decompose transformation into translation and scale.

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 this translate/scale finite?

Is this translate/scale NaN?

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Performs the += operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Performs the conversion.

The name of the generated JSON Schema. Read more

Generates a JSON Schema for this type. Read more

Whether JSON Schemas generated for this type should be re-used where possible using the $ref keyword. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

Performs the *= operation. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.