[−][src]Struct quicksilver::geom::Rectangle
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]
fn contains(&self, point: impl Into<Vector>) -> bool
[src]
fn overlaps_circle(&self, c: &Circle) -> bool
[src]
fn overlaps_rectangle(&self, b: &Rectangle) -> bool
[src]
fn intersects(&self, l: &Line) -> bool
[src]
fn overlaps(&self, shape: &impl Shape) -> bool
[src]
fn center(&self) -> Vector
[src]
fn bounding_box(&self) -> Rectangle
[src]
fn translate(&self, v: impl Into<Vector>) -> Self
[src]
#[must_use]
fn constrain(&self, outer: &Rectangle) -> Self where
Self: Sized,
[src]
Self: Sized,
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]
Self: Sized,
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]
fn eq(&self, other: &Rectangle) -> bool
[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(&self) -> 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]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl<'de> Deserialize<'de> for Rectangle
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
Auto Trait Implementations
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
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]
T: Copy + PartialEq<T> + Any + Debug,
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]
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
[src]
fn is_in_subset(&self) -> bool
[src]
unsafe fn to_subset_unchecked(&self) -> SS
[src]
fn from_subset(element: &SS) -> SP
[src]
impl<T> Downcast for T where
T: Any,
T: Any,
fn into_any(self: Box<T>) -> Box<dyn Any + 'static>
fn as_any(&self) -> &(dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> DeserializeOwned for T where
T: Deserialize<'de>,
[src]
T: Deserialize<'de>,