pub trait Transform2dExt<F>: Transform2d<F>
where F: Float,
{ // Provided methods fn transform(self, transform: mat3<F>) -> Self where Self: Sized { ... } fn align_bounding_box(self, alignment: vec2<F>) -> Self where Self: Sized { ... } fn rotate(self, angle: Angle<F>) -> Self where Self: Sized { ... } fn translate(self, delta: vec2<F>) -> Self where Self: Sized { ... } fn scale(self, factor: vec2<F>) -> Self where Self: Sized { ... } fn scale_uniform(self, factor: F) -> Self where Self: Sized { ... } fn transformed(&self) -> Transformed2d<'_, F, Self> { ... } fn bounding_box(&self) -> Aabb2<F> { ... } fn fit_into(self, target: impl FitTarget2d<F>) -> Self where Self: Sized { ... } }
Expand description

Extra methods for Transform2d types

Provided Methods§

fn transform(self, transform: mat3<F>) -> Self
where Self: Sized,

Apply transformation to the object, returning a modified value to allow chaining methods

fn align_bounding_box(self, alignment: vec2<F>) -> Self
where Self: Sized,

Align bounding box of this object, making its origin located at (0, 0)

§Examples
let quad = Quad::unit();
assert_eq!(quad.bounding_box(), Aabb2::from_corners(vec2(-1.0, -1.0), vec2(1.0, 1.0)));
let quad = quad.align_bounding_box(vec2(0.0, 1.0));
assert_eq!(quad.bounding_box(), Aabb2::from_corners(vec2(0.0, 0.0), vec2(2.0, -2.0)));

fn rotate(self, angle: Angle<F>) -> Self
where Self: Sized,

Rotate object around (0, 0) by given angle

fn translate(self, delta: vec2<F>) -> Self
where Self: Sized,

Translate object by given vector

fn scale(self, factor: vec2<F>) -> Self
where Self: Sized,

Scale object around (0, 0) by given factor

fn scale_uniform(self, factor: F) -> Self
where Self: Sized,

Scale object around (0, 0) by given factor uniformly along both axis

fn transformed(&self) -> Transformed2d<'_, F, Self>

Create a reference to this object with additional transformation applied

fn bounding_box(&self) -> Aabb2<F>

Calculate bounding box of this object, getting Aabb2 instead of a Quad

fn fit_into(self, target: impl FitTarget2d<F>) -> Self
where Self: Sized,

Make this object’s bounding Quad fit into given target

Object Safety§

This trait is not object safe.

Implementors§

§

impl<F, T> Transform2dExt<F> for T
where F: Float, T: Transform2d<F> + ?Sized,