[−][src]Struct footile::Transform
An affine transform can translate, scale, rotate and skew 2D points.
A series of transforms can be combined into a single Transform struct. This can be used by a Plotter to alter subsequent points.
Example
use footile::Transform; const PI: f32 = std::f32::consts::PI; let t = Transform::new_translate(-50.0, -50.0) .rotate(PI) .translate(50.0, 50.0) .scale(2.0, 2.0);
Methods
impl Transform
[src]
pub fn new() -> Self
[src]
Create a new identity transform.
pub fn new_translate(tx: f32, ty: f32) -> Self
[src]
Create a new translation transform.
tx
Amount to translate X.ty
Amount to translate Y.
pub fn new_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 new_rotate(th: f32) -> Self
[src]
Create a new rotation transform.
th
Angle to rotate coordinates (radians).
pub fn new_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 Copy for Transform
[src]
impl PartialEq<Transform> for Transform
[src]
impl Clone for Transform
[src]
fn clone(&self) -> Transform
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Transform
[src]
impl Mul<Transform> for Transform
[src]
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, other: Self) -> Self
[src]
impl MulAssign<Transform> for Transform
[src]
fn mul_assign(&mut self, other: Self)
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,