# [−][src]Trait quicksilver::geom::Shape

```pub trait Shape {
#[must_use]
fn contains(&self, point: impl Into<Vector>) -> bool;
#[must_use]
fn overlaps(&self, other: &impl Shape) -> bool;
#[must_use]
fn center(&self) -> Vector;
#[must_use]
fn bounding_box(&self) -> Rectangle;
#[must_use]
fn translate(&self, amount: impl Into<Vector>) -> Self    where        Self: Sized;

#[must_use]
fn intersects(&self, line: &Line) -> bool { ... }
#[must_use]
fn overlaps_circle(&self, circle: &Circle) -> bool { ... }
#[must_use]
fn overlaps_rectangle(&self, rectangle: &Rectangle) -> bool { ... }
#[must_use]
fn transformed_bounding_box(&self, transform: Transform) -> Rectangle { ... }
#[must_use]
fn constrain(&self, outer: &Rectangle) -> Self    where        Self: Sized,
{ ... }
#[must_use]
fn with_center(&self, center: impl Into<Vector>) -> Self    where        Self: Sized,
{ ... }
}```

The collision and positional attributes of shapes

## Required methods

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

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

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

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: impl Into<Vector>) -> Self where    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```

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, ```

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, ```

Create a copy of the shape with an offset center