[][src]Trait paddle::quicksilver_compat::geom::Shape

pub trait Shape {
#[must_use]    pub fn contains(&self, point: impl Into<Vector>) -> bool;
#[must_use] pub fn overlaps(&self, other: &impl Shape) -> bool;
#[must_use] pub fn center(&self) -> Vector;
#[must_use] pub fn bounding_box(&self) -> Rectangle;
#[must_use] pub fn translate(&self, amount: impl Into<Vector>) -> Self
    where
        Self: Sized
; #[must_use] pub fn intersects(&self, line: &Line) -> bool { ... }
#[must_use] pub fn overlaps_circle(&self, circle: &Circle) -> bool { ... }
#[must_use] pub fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool { ... }
#[must_use] pub fn transformed_bounding_box(&self, transform: Transform) -> Rectangle { ... }
#[must_use] pub fn constrain(&self, outer: &Rectangle) -> Self
    where
        Self: Sized
, { ... }
#[must_use] pub fn with_center(&self, center: impl Into<Vector>) -> Self
    where
        Self: Sized
, { ... } }

The collision and positional attributes of shapes

Required methods

#[must_use]pub fn contains(&self, point: impl Into<Vector>) -> bool[src]

If the point lies on the shape's boundary or within it

#[must_use]pub fn overlaps(&self, other: &impl Shape) -> bool[src]

If any area is bounded by both either shape

#[must_use]pub fn center(&self) -> Vector[src]

The point all other points are equidistant to in the shape

#[must_use]pub fn bounding_box(&self) -> Rectangle[src]

A Rectangle that contains the entire shape

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

Create a copy of the shape with an offset center

Loading content...

Provided methods

#[must_use]pub fn intersects(&self, line: &Line) -> bool[src]

If any area bounded by the shape falls on the line

#[must_use]pub fn overlaps_circle(&self, circle: &Circle) -> bool[src]

If any area is bounded by both the shape and the circle

#[must_use]pub fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool[src]

If any area is bounded by both the shape and the rectangle

#[must_use]pub fn transformed_bounding_box(&self, transform: Transform) -> Rectangle[src]

Apply a transform to a shape then get the bounding box for the transformed shape

Note: if you want to get the collision of rotated shapes, you probably want to use ncollide

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

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

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

Create a copy of the shape with an offset center

Loading content...

Implementors

impl Shape for Circle[src]

impl Shape for Line[src]

impl Shape for Triangle[src]

impl Shape for Rectangle[src]

impl Shape for Vector[src]

Loading content...