# Class cocos.collision_model.Cshape

Represents an abstract geometric shape in the 2D space, and can answer questions about proximity or intersection with other shapes.

Implementations are free to restrict the type of geometrical shapes that will accept, by example circles or axis aligned rectangles.

## Methods

bool | overlaps(self, other) Returns True if overlapping other, False otherwise
float | distance(self, other) Returns a float, distance from itself to other;
bool | near_than(self, other, near_distance) Returns a boolean, True if distance(self, other)<=near_distance
bool | touches_point(self, x, y) Returns True if the point (x,y) overlaps the shape, False otherwise
bool | fits_in_box(self, packed_box) Returns a boolean, True if the shape fully fits into the axis aligned rectangle defined by packed_box, False otherwise.
4-tuple of floats | minmax(self) Returns the smallest axis aligned rectangle that contains all shape points.
Cshape | copy(self) Returns a copy of itself

## Method Details

### distance

distance(self, other)

Returns a float, distance from itself to other;

Not necessarily euclidean distance. It is distances between boundaries.

Returns: float

### fits_in_box

fits_in_box(self, packed_box)
Returns a boolean, True if the shape fully fits into the axis aligned rectangle defined by packed_box, False otherwise.

Parameters:
  packed_box : 4-tuple floats
    An axis aligned rectangle expressed as (minx, maxx, miny, maxy)
Returns: bool

### minmax

minmax(self)

Returns the smallest axis aligned rectangle that contains all shape points.

The rectangle is expressed as a 4-tuple of floats (minx, maxx, miny, maxy) Such a rectangle is also know as the Axis Aligned Bounding Box for shape; AABB for short.

Returns: 4-tuple of floats