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, T> TransformAndBounds<F, T>
impl<F, T> 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) -> TransformAndBounds<F, T>
pub fn as_pure_size(self) -> TransformAndBounds<F, T>
Move scale from the transform into the bounds field.
Sourcepub fn as_pure_scale(self) -> TransformAndBounds<F, T>
pub fn as_pure_scale(self) -> TransformAndBounds<F, T>
Move bounds into the transform as scale, leaving unit bounds.
Sourcepub fn cast_spaces<A, B>(self) -> TransformAndBounds<A, B>
pub fn cast_spaces<A, B>(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, T> TransformAndBounds<F, T>
impl<F, T> 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: &TransformAndBounds<F, T>) -> bool
pub fn intersects(&self, other: &TransformAndBounds<F, T>) -> 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>
Source§fn clone(&self) -> TransformAndBounds<F, T>
fn clone(&self) -> TransformAndBounds<F, T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl<F, T> Copy for TransformAndBounds<F, T>
Source§impl<F, T> Debug for TransformAndBounds<F, T>
impl<F, T> Debug for TransformAndBounds<F, T>
Source§impl<F, T> Default for TransformAndBounds<F, T>
impl<F, T> Default for TransformAndBounds<F, T>
Source§fn default() -> TransformAndBounds<F, T>
fn default() -> TransformAndBounds<F, T>
Source§impl<F, T> Interpolatable for TransformAndBounds<F, T>
impl<F, T> Interpolatable for TransformAndBounds<F, T>
Source§fn interpolate(
&self,
other: &TransformAndBounds<F, T>,
t: f64,
) -> TransformAndBounds<F, T>
fn interpolate( &self, other: &TransformAndBounds<F, T>, t: f64, ) -> TransformAndBounds<F, T>
Source§impl<W1, W2, W3> Mul<TransformAndBounds<W1, W2>> for TransformAndBounds<W2, W3>
impl<W1, W2, W3> Mul<TransformAndBounds<W1, W2>> for TransformAndBounds<W2, W3>
Source§type Output = TransformAndBounds<W1, W3>
type Output = TransformAndBounds<W1, W3>
* operator.Source§fn mul(
self,
rhs: TransformAndBounds<W1, W2>,
) -> <TransformAndBounds<W2, W3> as Mul<TransformAndBounds<W1, W2>>>::Output
fn mul( self, rhs: TransformAndBounds<W1, W2>, ) -> <TransformAndBounds<W2, W3> as Mul<TransformAndBounds<W1, W2>>>::Output
* operation. Read more