[][src]Struct quicksilver::geom::Rectangle

pub struct Rectangle {
    pub pos: Vector,
    pub size: Vector,
}

A rectangle with a top-left position and a size

Fields

pos: Vector

The top-left coordinate of the rectangle

size: Vector

The width and height of the rectangle

Methods

impl Rectangle[src]

pub fn new(pos: impl Into<Vector>, size: impl Into<Vector>) -> Rectangle[src]

Create a rectangle from a top-left vector and a size vector

pub fn new_sized(size: impl Into<Vector>) -> Rectangle[src]

Create a rectangle at the origin with the given size

pub fn from_cuboid(center: impl Into<Vector>, cuboid: &Cuboid<f32>) -> Rectangle[src]

Create a rectangle with a given center and Cuboid from ncollide

pub fn into_cuboid(self) -> Cuboid<f32>[src]

Convert this rect into an ncollide Cuboid2

pub fn into_aabb(self) -> AABB<f32>[src]

Convert this rect into an ncollide AABB2

pub fn top_left(&self) -> Vector[src]

Get the top left coordinate of the Rectangle

pub fn x(&self) -> f32[src]

Get the x-coordinate of the Rectangle (The origin of a Rectangle is at the top left)

pub fn y(&self) -> f32[src]

Get the y-coordinate of the Rectangle (The origin of a Rectangle is at the top left)

pub fn size(&self) -> Vector[src]

Get the size of the Rectangle

pub fn height(&self) -> f32[src]

Get the height of the Rectangle

pub fn width(&self) -> f32[src]

Get the width of the Rectangle

Trait Implementations

impl Shape for Rectangle[src]

#[must_use]
fn constrain(&self, outer: &Rectangle) -> Self where
    Self: Sized
[src]

Create a copy of the shape that is contained within the bound

#[must_use]
fn with_center(&self, center: impl Into<Vector>) -> Self where
    Self: Sized
[src]

Create a copy of the shape with an offset center

impl Drawable for Rectangle[src]

impl Eq for Rectangle[src]

impl PartialEq<Rectangle> for Rectangle[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Copy for Rectangle[src]

impl Clone for Rectangle[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl From<AABB<f32>> for Rectangle[src]

impl Default for Rectangle[src]

impl Debug for Rectangle[src]

impl Serialize for Rectangle[src]

impl<'de> Deserialize<'de> for Rectangle[src]

Auto Trait Implementations

impl Send for Rectangle

impl Sync for Rectangle

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SetParameter for T

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 

Sets value as a parameter of self.

impl<T> Erased for T

impl<T> Scalar for T where
    T: Copy + PartialEq<T> + Any + Debug
[src]

fn is<T>() -> bool where
    T: Scalar
[src]

Tests if Self the same as the type T Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]