[][src]Trait pane::math::Rectangle

pub trait Rectangle: Copy {
    type Scalar: Scalar;
    type Vector: Vector2<Scalar = Self::Scalar>;
    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 { ... } }

A trait for manipulating rectangles

Associated Types

type Scalar: Scalar

The scalar type

type Vector: Vector2<Scalar = Self::Scalar>

The vector type

Loading content...

Required methods

fn new(top_left: Self::Vector, size: Self::Vector) -> Self

Create a new rectangle from a top-left corner position and a size

fn top_left(&self) -> Self::Vector

Get the top-left corner position

fn size(&self) -> Self::Vector

Get the size

Loading content...

Provided methods

fn map<R>(&self) -> R where
    R: Rectangle,
    R::Scalar: From<Self::Scalar>, 

Map this rectangle to a rectangle of another type

fn top_right(&self) -> Self::Vector

Get the top-right corner position

fn bottom_left(&self) -> Self::Vector

Get the bottom-left corner position

fn bottom_right(&self) -> Self::Vector

Get the bottom-right corner position

fn top(&self) -> Self::Scalar

Get the top y

fn bottom(&self) -> Self::Scalar

Get the bottom y

fn left(&self) -> Self::Scalar

Get the left x

fn right(&self) -> Self::Scalar

Get the right x

fn width(&self) -> Self::Scalar

Get the width

fn height(&self) -> Self::Scalar

Get the height

fn center(&self) -> Self::Vector

Get the position of the center

fn with_top_left(self, top_left: Self::Vector) -> Self

Transform the rectangle into one with a different top-left corner position

fn with_size(self, size: Self::Vector) -> Self

Transform the rectangle into one with a different size

Loading content...

Implementors

impl<P> Rectangle for P where
    P: Pair + Copy,
    P::Item: Vector2
[src]

type Scalar = <P::Item as Vector2>::Scalar

type Vector = P::Item

Loading content...