[−][src]Trait vector2math::Transform
Trait for defining vector transformations
Transforms should be able to be chained without allocating extra space. The standard way to do this is with a matrix. For transforming 2D vectors, a 2×3 matrix can be used.
Associated Types
type Scalar: FloatingScalar
The scalar type
Required methods
fn new() -> Self
Create a new identity transform
fn then(self, next: Self) -> Self
Chain this transform with another
fn apply<V>(self, vector: V) -> V where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Apply this transform to a vector
fn new_translate<V>(offset: V) -> Self where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Create a translation from an offset vector
fn new_rotate(radians: Self::Scalar) -> Self
Create a rotation from a radian angle
fn new_scale<V>(ratio: V) -> Self where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Create a scaling from a ratio vector
Provided methods
fn translate<V>(self, offset: V) -> Self where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Translate the transform
fn rotate(self, radians: Self::Scalar) -> Self
Rotate the transform
fn scale<V>(self, ratio: V) -> Self where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Scale the transform
fn zoom(self, ratio: Self::Scalar) -> Self
Uniformly scale the transform
fn rotate_about<V>(self, radians: Self::Scalar, pivot: V) -> Self where
V: Vector2<Scalar = Self::Scalar>,
V: Vector2<Scalar = Self::Scalar>,
Rotate the transform about a pivot
Implementors
impl<M, C> Transform for M where
M: Pair<Item = C>,
C: Trio + Copy,
C::Item: FloatingScalar, [src]
M: Pair<Item = C>,
C: Trio + Copy,
C::Item: FloatingScalar,
type Scalar = C::Item
fn new() -> Self[src]
fn then(self, next: Self) -> Self[src]
fn apply<V>(self, vector: V) -> V where
V: Vector2<Scalar = Self::Scalar>, [src]
V: Vector2<Scalar = Self::Scalar>,
fn new_translate<V>(v: V) -> Self where
V: Vector2<Scalar = Self::Scalar>, [src]
V: Vector2<Scalar = Self::Scalar>,
fn new_rotate(radians: Self::Scalar) -> Self[src]
fn new_scale<V>(ratio: V) -> Self where
V: Vector2<Scalar = Self::Scalar>, [src]
V: Vector2<Scalar = Self::Scalar>,