[][src]Struct pointy::Transform32

pub struct Transform32 { /* fields omitted */ }

An affine transform for Pt32 values.

A series of translate, rotate, scale and skew transformations can be combined into a single Transform32.

Example

use pointy::{Pt32, Transform32};

let t = Transform32::with_translate(-50.0, -50.0)
    .rotate(std::f32::consts::PI)
    .translate(50.0, 50.0)
    .scale(2.0, 2.0);
let pt = Pt32(13.0, 5.5) * t;
let pt2 = (8.2, 4.7) * t;
let pt3 = t * (3.8, 9.6);

Implementations

impl Transform32[src]

pub const fn with_translate(tx: f32, ty: f32) -> Self[src]

Create a new translation transform.

  • tx Amount to translate X.
  • ty Amount to translate Y.

pub const fn with_scale(sx: f32, sy: f32) -> Self[src]

Create a new scale transform.

  • sx Scale factor for X dimension.
  • sy Scale factor for Y dimension.

pub fn with_rotate(th: f32) -> Self[src]

Create a new rotation transform.

  • th Angle to rotate coordinates (radians).

pub fn with_skew(ax: f32, ay: f32) -> Self[src]

Create a new skew transform.

  • ax Angle to skew X-axis (radians).
  • ay Angle to skew Y-axis (radians).

pub fn translate(self, tx: f32, ty: f32) -> Self[src]

Apply translation to a transform.

  • tx Amount to translate X.
  • ty Amount to translate Y.

pub fn scale(self, sx: f32, sy: f32) -> Self[src]

Apply scaling to a transform.

  • sx Scale factor for X dimension.
  • sy Scale factor for Y dimension.

pub fn rotate(self, th: f32) -> Self[src]

Apply rotation to a transform.

  • th Angle to rotate coordinates (radians).

pub fn skew(self, ax: f32, ay: f32) -> Self[src]

Apply skew to a transform.

  • ax Angle to skew X-axis (radians).
  • ay Angle to skew Y-axis (radians).

Trait Implementations

impl Clone for Transform32[src]

impl Copy for Transform32[src]

impl Debug for Transform32[src]

impl Default for Transform32[src]

fn default() -> Self[src]

Create a new identity transform.

impl Mul<(f32, f32)> for Transform32[src]

type Output = Pt32

The resulting type after applying the * operator.

impl Mul<Pt32> for Transform32[src]

type Output = Pt32

The resulting type after applying the * operator.

impl Mul<Transform32> for Transform32[src]

type Output = Self

The resulting type after applying the * operator.

impl Mul<Transform32> for Pt32[src]

type Output = Pt32

The resulting type after applying the * operator.

impl Mul<Transform32> for (f32, f32)[src]

type Output = Pt32

The resulting type after applying the * operator.

impl MulAssign<Transform32> for Transform32[src]

impl PartialEq<Transform32> for Transform32[src]

impl StructuralPartialEq for Transform32[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.