Struct kurbo::Affine [−][src]
A 2D affine transform.
Implementations
impl Affine
[src]
pub const IDENTITY: Affine
[src]
The identity transform.
pub const FLIP_Y: Affine
[src]
A transform that is flipped on the y-axis. Useful for converting between y-up and y-down spaces.
pub const FLIP_X: Affine
[src]
A transform that is flipped on the x-axis.
pub const fn new(c: [f64; 6]) -> Affine
[src]
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.
pub const fn scale(s: f64) -> Affine
[src]
An affine transform representing uniform scaling.
pub const fn scale_non_uniform(s_x: f64, s_y: f64) -> Affine
[src]
An affine transform representing non-uniform scaling with different scale values for x and y
pub fn rotate(th: f64) -> Affine
[src]
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.
The angle, th
, is expressed in radians.
pub fn translate<V: Into<Vec2>>(p: V) -> Affine
[src]
An affine transform representing translation.
pub fn map_unit_square(rect: Rect) -> Affine
[src]
Creates an affine transformation that takes the unit square to the given rectangle.
Useful when you want to draw into the unit square but have your output fill any rectangle.
In this case push the Affine
onto the transform stack.
pub fn as_coeffs(self) -> [f64; 6]
[src]
Get the coefficients of the transform.
pub fn determinant(self) -> f64
[src]
Compute the determinant of this transform.
pub fn inverse(self) -> Affine
[src]
Compute the inverse transform.
Produces NaN values when the determinant is zero.
pub fn transform_rect_bbox(self, rect: Rect) -> Rect
[src]
Compute the bounding box of a transformed rectangle.
Returns the minimal Rect
that encloses the given Rect
after affine transformation.
If the transform is axis-aligned, then this bounding box is “tight”, in other words the
returned Rect
is the transformed rectangle.
The returned rectangle always has non-negative width and height.
pub fn is_finite(&self) -> bool
[src]
Is this map finite?
pub fn is_nan(&self) -> bool
[src]
Is this map NaN?
Trait Implementations
impl Clone for Affine
[src]
impl Copy for Affine
[src]
impl Debug for Affine
[src]
impl Default for Affine
[src]
impl<'de> Deserialize<'de> for Affine
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl From<ColumnMatrix2x3<f64>> for Affine
[src]
fn from(m: ColumnMatrix2x3<f64>) -> Affine
[src]
impl From<TranslateScale> for Affine
[src]
fn from(ts: TranslateScale) -> Affine
[src]
impl<'a> Mul<&'a BezPath> for Affine
[src]
type Output = BezPath
The resulting type after applying the *
operator.
fn mul(self, other: &BezPath) -> BezPath
[src]
impl Mul<Affine> for Affine
[src]
type Output = Affine
The resulting type after applying the *
operator.
fn mul(self, other: Affine) -> Affine
[src]
impl Mul<BezPath> for Affine
[src]
type Output = BezPath
The resulting type after applying the *
operator.
fn mul(self, other: BezPath) -> BezPath
[src]
impl Mul<Circle> for Affine
[src]
type Output = Ellipse
The resulting type after applying the *
operator.
fn mul(self, other: Circle) -> Self::Output
[src]
impl Mul<CubicBez> for Affine
[src]
type Output = CubicBez
The resulting type after applying the *
operator.
fn mul(self, c: CubicBez) -> CubicBez
[src]
impl Mul<Ellipse> for Affine
[src]
type Output = Ellipse
The resulting type after applying the *
operator.
fn mul(self, other: Ellipse) -> Self::Output
[src]
impl Mul<Line> for Affine
[src]
type Output = Line
The resulting type after applying the *
operator.
fn mul(self, other: Line) -> Line
[src]
impl Mul<PathEl> for Affine
[src]
type Output = PathEl
The resulting type after applying the *
operator.
fn mul(self, other: PathEl) -> PathEl
[src]
impl Mul<PathSeg> for Affine
[src]
type Output = PathSeg
The resulting type after applying the *
operator.
fn mul(self, other: PathSeg) -> PathSeg
[src]
impl Mul<Point> for Affine
[src]
type Output = Point
The resulting type after applying the *
operator.
fn mul(self, other: Point) -> Point
[src]
impl Mul<QuadBez> for Affine
[src]
type Output = QuadBez
The resulting type after applying the *
operator.
fn mul(self, other: QuadBez) -> QuadBez
[src]
impl MulAssign<Affine> for Affine
[src]
fn mul_assign(&mut self, other: Affine)
[src]
impl PartialEq<Affine> for Affine
[src]
impl Serialize for Affine
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for Affine
[src]
Auto Trait Implementations
impl RefUnwindSafe for Affine
impl Send for Affine
impl Sync for Affine
impl Unpin for Affine
impl UnwindSafe for Affine
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,