Initial commit
This commit is contained in:
commit
6e1613f73f
48 files changed
+13682
No files matched your search
+39
@@ -0,0 +1,39 @@
|
||||
pub use euclid::Box2D as Rect;
|
||||
pub use euclid::Point2D as Point;
|
||||
pub use euclid::Size2D as Size;
|
||||
pub use euclid::Vector2D as Vector;
|
||||
pub use quad::Quad;
|
||||
|
||||
mod quad;
|
||||
|
||||
pub trait Corners<T, U> {
|
||||
fn top_left(&self) -> Point<T, U>;
|
||||
fn top_right(&self) -> Point<T, U>;
|
||||
fn bottom_left(&self) -> Point<T, U>;
|
||||
fn bottom_right(&self) -> Point<T, U>;
|
||||
}
|
||||
|
||||
impl<T, U> Corners<T, U> for Rect<T, U>
|
||||
where
|
||||
T: Copy,
|
||||
{
|
||||
#[inline]
|
||||
fn top_left(&self) -> Point<T, U> {
|
||||
self.min
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn top_right(&self) -> Point<T, U> {
|
||||
Point::new(self.max.x, self.min.y)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn bottom_left(&self) -> Point<T, U> {
|
||||
Point::new(self.min.x, self.max.y)
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn bottom_right(&self) -> Point<T, U> {
|
||||
self.max
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user