[−][src]Trait quicksilver::geom::Shape
The collision and positional attributes of shapes
Required methods
#[must_use]fn contains(&self, point: Vector) -> bool
If the point lies on the shape's boundary or within it
#[must_use]fn overlaps(&self, other: &impl Shape) -> bool
Use another collision library like vek
instead; please comment on issue #552 for use-cases other libraries don't solve
If any area is bounded by both either shape
#[must_use]fn center(&self) -> Vector
The point all other points are equidistant to in the shape
#[must_use]fn bounding_box(&self) -> Rectangle
A Rectangle that contains the entire shape
#[must_use]fn translate(&self, amount: Vector) -> Self where
Self: Sized,
Self: Sized,
Create a copy of the shape with an offset center
Provided methods
#[must_use]fn intersects(&self, line: &Line) -> bool
If any area bounded by the shape falls on the line
#[must_use]fn overlaps_circle(&self, circle: &Circle) -> bool
If any area is bounded by both the shape and the circle
#[must_use]fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool
If any area is bounded by both the shape and the rectangle
#[must_use]fn transformed_bounding_box(&self, transform: Transform) -> Rectangle
Use another collision library like vek
instead; please comment on issue #552 for use-cases other libraries don't solve
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]fn constrain(&self, outer: &Rectangle) -> Self where
Self: Sized,
Self: Sized,
Create a copy of the shape that is contained within the bound
#[must_use]fn with_center(&self, center: Vector) -> Self where
Self: Sized,
Self: Sized,
Create a copy of the shape with an offset center