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.
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.
Trait Implementations
type Output = TranslateScale
type Output = TranslateScale
The resulting type after applying the +
operator.
Performs the +
operation. Read more
type Output = TranslateScale
type Output = TranslateScale
The resulting type after applying the +
operator.
Performs the +
operation. Read more
Performs the +=
operation. Read more
Returns the “default value” for a type. Read more
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
type Output = RoundedRect
type Output = RoundedRect
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = RoundedRectRadii
type Output = RoundedRectRadii
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = TranslateScale
type Output = TranslateScale
The resulting type after applying the *
operator.
Performs the *
operation. Read more
type Output = TranslateScale
type Output = TranslateScale
The resulting type after applying the *
operator.
Performs the *
operation. Read more
Performs the *=
operation. Read more
type Output = TranslateScale
type Output = TranslateScale
The resulting type after applying the -
operator.
Performs the -
operation. Read more
Performs the -=
operation. Read more
Auto Trait Implementations
impl RefUnwindSafe for TranslateScale
impl Send for TranslateScale
impl Sync for TranslateScale
impl Unpin for TranslateScale
impl UnwindSafe for TranslateScale
Blanket Implementations
Mutably borrows from an owned value. Read more