Struct quicksilver::geom::Rectangle [−][src]
A rectangle with a top-left position and a size
Fields
x: f32
The top-left x coordinate of the rectangle
y: f32
The top-left y coordinate of the rectangle
width: f32
The width of the rectangle
height: f32
The height of the rectangle
Methods
impl Rectangle
[src]
impl Rectangle
pub fn new<T: Scalar>(x: T, y: T, width: T, height: T) -> Rectangle
[src]
pub fn new<T: Scalar>(x: T, y: T, width: T, height: T) -> Rectangle
Create a positioned rectangle with dimensions
pub fn newv(pos: Vector, size: Vector) -> Rectangle
[src]
pub fn newv(pos: Vector, size: Vector) -> Rectangle
Create a rectangle from a top-left vector and a size vector
pub fn new_sized<T: Scalar>(width: T, height: T) -> Rectangle
[src]
pub fn new_sized<T: Scalar>(width: T, height: T) -> Rectangle
Create a rectangle at the origin with the given size
pub fn newv_sized(size: Vector) -> Rectangle
[src]
pub fn newv_sized(size: Vector) -> Rectangle
Create a rectangle at the origin with a size given by a Vector
pub fn from_cuboid(center: Vector, cuboid: &Cuboid<f32>) -> Rectangle
[src]
pub fn from_cuboid(center: Vector, cuboid: &Cuboid<f32>) -> Rectangle
Create a rectangle with a given center and Cuboid from ncollide
pub fn into_cuboid(self) -> Cuboid<f32>
[src]
pub fn into_cuboid(self) -> Cuboid<f32>
Convert this rect into an ncollide Cuboid2
pub fn into_aabb(self) -> AABB<f32>
[src]
pub fn into_aabb(self) -> AABB<f32>
Convert this rect into an ncollide AABB2
pub fn top_left(self) -> Vector
[src]
pub fn top_left(self) -> Vector
Get the top left coordinate of the Rectangle
pub fn size(self) -> Vector
[src]
pub fn size(self) -> Vector
Get the size of the Rectangle
pub fn contains(self, v: Vector) -> bool
[src]
pub fn contains(self, v: Vector) -> bool
Checks if a point falls within the rectangle
pub fn overlaps_rect(self, b: Rectangle) -> bool
[src]
pub fn overlaps_rect(self, b: Rectangle) -> bool
Check if any of the area bounded by this rectangle is bounded by another
pub fn overlaps_circ(self, c: Circle) -> bool
[src]
pub fn overlaps_circ(self, c: Circle) -> bool
Check if any of the area bounded by this rectangle is bounded by a circle
pub fn constrain(self, outer: Rectangle) -> Rectangle
[src]
pub fn constrain(self, outer: Rectangle) -> Rectangle
Move the rectangle so it is entirely contained with another
pub fn translate(self, v: Vector) -> Rectangle
[src]
pub fn translate(self, v: Vector) -> Rectangle
Translate the rectangle by a given vector
pub fn with_center(self, v: Vector) -> Rectangle
[src]
pub fn with_center(self, v: Vector) -> Rectangle
Create a rectangle with the same size at a given center
Trait Implementations
impl Clone for Rectangle
[src]
impl Clone for Rectangle
fn clone(&self) -> Rectangle
[src]
fn clone(&self) -> Rectangle
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Rectangle
[src]
impl Copy for Rectangle
impl Default for Rectangle
[src]
impl Default for Rectangle
impl Debug for Rectangle
[src]
impl Debug for Rectangle
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl PartialEq for Rectangle
[src]
impl PartialEq for Rectangle
fn eq(&self, other: &Rectangle) -> bool
[src]
fn eq(&self, other: &Rectangle) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Rectangle
[src]
impl Eq for Rectangle
impl Positioned for Rectangle
[src]
impl Positioned for Rectangle
fn center(&self) -> Vector
[src]
fn center(&self) -> Vector
Its center as a vector
fn bounding_box(&self) -> Rectangle
[src]
fn bounding_box(&self) -> Rectangle
The smallest possible rectangle that fully contains the shape
impl From<AABB<f32>> for Rectangle
[src]
impl From<AABB<f32>> for Rectangle