pub trait Rectangle: Clone {
type Scalar: Scalar;
type Vector: Vector2<Scalar = Self::Scalar>;
Show 16 methods
fn new(top_left: Self::Vector, size: Self::Vector) -> Self;
fn top_left(&self) -> Self::Vector;
fn size(&self) -> Self::Vector;
fn map<R>(&self) -> R
where
R: Rectangle,
R::Scalar: From<Self::Scalar>,
{ ... }
fn top_right(&self) -> Self::Vector { ... }
fn bottom_left(&self) -> Self::Vector { ... }
fn bottom_right(&self) -> Self::Vector { ... }
fn top(&self) -> Self::Scalar { ... }
fn bottom(&self) -> Self::Scalar { ... }
fn left(&self) -> Self::Scalar { ... }
fn right(&self) -> Self::Scalar { ... }
fn width(&self) -> Self::Scalar { ... }
fn height(&self) -> Self::Scalar { ... }
fn center(&self) -> Self::Vector { ... }
fn with_top_left(self, top_left: Self::Vector) -> Self { ... }
fn with_size(self, size: Self::Vector) -> Self { ... }
}
Expand description
A trait for manipulating rectangles
Required Associated Types
Required Methods
Provided Methods
sourcefn map<R>(&self) -> Rwhere
R: Rectangle,
R::Scalar: From<Self::Scalar>,
fn map<R>(&self) -> Rwhere
R: Rectangle,
R::Scalar: From<Self::Scalar>,
Map this rectangle to a rectangle of another type
sourcefn bottom_left(&self) -> Self::Vector
fn bottom_left(&self) -> Self::Vector
Get the bottom-left corner position
sourcefn bottom_right(&self) -> Self::Vector
fn bottom_right(&self) -> Self::Vector
Get the bottom-right corner position
sourcefn with_top_left(self, top_left: Self::Vector) -> Self
fn with_top_left(self, top_left: Self::Vector) -> Self
Transform the rectangle into one with a different top-left corner position