pub struct TransformAndBounds<F, T = F> {
pub transform: Transform2<F, T>,
pub bounds: (f64, f64),
}Expand description
Pax’s canonical representation of position, size, and transform, encoded as a transform (translation, rotation, scale, skew) and a separate width/height (bounds) value. Bounds are expressed as the (x1, y1) values of the axis-aligned pre-transform bounding box, where (x0, y0) are the origin.
In this model, position is a derived property, calculated by applying the transform to the bounding box.
Fields§
§transform: Transform2<F, T>§bounds: (f64, f64)Implementations§
Source§impl<F: Space, T: Space> TransformAndBounds<F, T>
impl<F: Space, T: Space> TransformAndBounds<F, T>
Sourcepub fn corners(&self) -> [Point2<T>; 4]
pub fn corners(&self) -> [Point2<T>; 4]
Corners of this transformed box, starting at origin and proceeding around the rectangle.
Sourcepub fn contains_point(&self, point: Point2<T>) -> bool
pub fn contains_point(&self, point: Point2<T>) -> bool
Test whether a point falls inside this transformed box.
Sourcepub fn as_pure_size(self) -> Self
pub fn as_pure_size(self) -> Self
Move scale from the transform into the bounds field.
Sourcepub fn as_pure_scale(self) -> Self
pub fn as_pure_scale(self) -> Self
Move bounds into the transform as scale, leaving unit bounds.
Sourcepub fn cast_spaces<A: Space, B: Space>(self) -> TransformAndBounds<A, B>
pub fn cast_spaces<A: Space, B: Space>(self) -> TransformAndBounds<A, B>
Retype coordinate-space markers without changing numeric values.
Sourcepub fn as_transform(&self) -> Transform2<F, T>
pub fn as_transform(&self) -> Transform2<F, T>
Convert this split representation into a single affine transform.
Source§impl<F: Space, T: Space> TransformAndBounds<F, T>
impl<F: Space, T: Space> TransformAndBounds<F, T>
Sourcepub fn inverse(&self) -> TransformAndBounds<T, F>
pub fn inverse(&self) -> TransformAndBounds<T, F>
Invert the transform-and-bounds mapping.
Sourcepub fn intersects(&self, other: &Self) -> bool
pub fn intersects(&self, other: &Self) -> bool
Test transformed-box intersection using the separating axis theorem.
Trait Implementations§
Source§impl<F, T> Clone for TransformAndBounds<F, T>
impl<F, T> Clone for TransformAndBounds<F, T>
impl<F, T> Copy for TransformAndBounds<F, T>
Source§impl<F: Space, T: Space> Interpolatable for TransformAndBounds<F, T>
impl<F: Space, T: Space> Interpolatable for TransformAndBounds<F, T>
Source§fn interpolate(&self, other: &Self, t: f64) -> Self
fn interpolate(&self, other: &Self, t: f64) -> Self
Source§impl<W1: Space, W2: Space, W3: Space> Mul<TransformAndBounds<W1, W2>> for TransformAndBounds<W2, W3>
impl<W1: Space, W2: Space, W3: Space> Mul<TransformAndBounds<W1, W2>> for TransformAndBounds<W2, W3>
Source§type Output = TransformAndBounds<W1, W3>
type Output = TransformAndBounds<W1, W3>
* operator.