pub struct Affine(_);
Expand description
A 2D affine transform.
Implementations§
source§impl Affine
impl Affine
sourcepub fn new(c: [f64; 6]) -> Affine
pub fn new(c: [f64; 6]) -> Affine
Construct an affine transform from coefficients.
If the coefficients are (a, b, c, d, e, f)
, then the resulting
transformation represents this augmented matrix:
| a c e |
| b d f |
| 0 0 1 |
Note that this convention is transposed from PostScript and
Direct2D, but is consistent with the
Wikipedia
formulation of affine transformation as augmented matrix. The
idea is that (A * B) * v == A * (B * v)
, where *
is the
Mul
trait.
sourcepub fn rotate(th: f64) -> Affine
pub fn rotate(th: f64) -> Affine
An affine transform representing rotation.
The convention for rotation is that a positive angle rotates a positive X direction into positive Y. Thus, in a Y-down coordinate system (as is common for graphics), it is a clockwise rotation, and in Y-up (traditional for math), it is anti-clockwise.
Trait Implementations§
source§impl MulAssign<Affine> for Affine
impl MulAssign<Affine> for Affine
source§fn mul_assign(&mut self, other: Affine)
fn mul_assign(&mut self, other: Affine)
Performs the
*=
operation. Read more