Struct quicksilver::geom::Rectangle
[−]
[src]
pub struct Rectangle { pub x: f32, pub y: f32, pub width: f32, pub height: f32, }
A rectangle with a top-left position and a size
Fields
x: f32
y: f32
width: f32
height: f32
Methods
impl Rectangle
[src]
fn new(x: f32, y: f32, width: f32, height: f32) -> Rectangle
[src]
Create a positioned rectangle with dimensions
fn newv(pos: Vector, size: Vector) -> Rectangle
[src]
fn newi(x: i32, y: i32, width: i32, height: i32) -> Rectangle
[src]
fn new_sized(width: f32, height: f32) -> Rectangle
[src]
Create a rectangle at the origin with the given size
fn newi_sized(width: i32, height: i32) -> Rectangle
[src]
fn newv_sized(size: Vector) -> Rectangle
[src]
fn top_left(self) -> Vector
[src]
Get the top left coordinate of the Rectangle
fn size(self) -> Vector
[src]
Get the size of the Rectangle
fn center(self) -> Vector
[src]
Get the centerpoint on the rectangle
fn contains(self, v: Vector) -> bool
[src]
Checks if a point falls within the rectangle
fn overlaps_rect(self, b: Rectangle) -> bool
[src]
Check if any of the area bounded by this rectangle is bounded by another
fn overlaps_circ(self, c: Circle) -> bool
[src]
Check if any of the area bounded by this rectangle is bounded by a circle
fn constrain(self, outer: Rectangle) -> Rectangle
[src]
Move the rectangle so it is entirely contained with another
fn translate(self, v: Vector) -> Rectangle
[src]
Translate the rectangle by a given vector
fn with_center(self, v: Vector) -> Rectangle
[src]
Create a rectangle with the same size at a given center
fn top(self) -> Line
[src]
Get the top of the rectangle
fn left(self) -> Line
[src]
Get the left of the rectangle
fn bottom(self) -> Line
[src]
Get the bottom of the rectangle
fn right(self) -> Line
[src]
Get the right of the rectangle
fn intersects(self, l: Line) -> bool
[src]
Check if a line segment intersects a rectangle
Trait Implementations
impl Clone for Rectangle
[src]
fn clone(&self) -> Rectangle
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Copy for Rectangle
[src]
impl Default for Rectangle
[src]
impl Debug for Rectangle
[src]
impl PartialEq for Rectangle
[src]
fn eq(&self, other: &Rectangle) -> bool
[src]
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]
This method tests for !=
.