# Class cocos.rect.Rect

Known Subclasses:
  tiles.RectCell

Define a rectangular area.

Many convenience handles and other properties are also defined - all of which may be assigned to which will result in altering the position and sometimes dimensions of the Rect:

> - top -- y pixel extent
> - bottom -- y pixel extent
> - left -- x pixel extent
> - right -- x pixel extent
> - position -- (x, y) of bottom-left corner pixel
> - origin -- (x, y) of bottom-left corner pixel
> - center -- (x, y) of center pixel
> - topleft -- (x, y) of top-left corner pixel
> - topright -- (x, y) of top-right corner pixel
> - bottomleft -- (x, y) of bottom-left corner pixel
> - bottomright -- (x, y) of bottom-right corner pixel
> - midtop -- (x, y) of middle of top side pixel
> - midbottom -- (x, y) of middle of bottom side pixel
> - midleft -- (x, y) of middle of left side pixel
> - midright -- (x, y) of middle of right side pixel
> - size -- (width, height) of rect

The Rect area includes the bottom and left borders but not the top and right borders.

## Methods

| __init__(self, x, y, width, height) Create a Rect with the bottom-left corner at (x, y) and dimensions (width, height).
| __nonzero__(self)
| __repr__(self)
| __eq__(self, other) Compare the two rects.
| __ne__(self, other) Compare the two rects.
| copy(self)
| set_x(self, value)
| set_y(self, value)
| set_width(self, value)
| set_height(self, value)
| contains(self, x, y) Return boolean whether the point defined by x, y is inside the rect area.
| intersects(self, other) Return boolean whether the "other" rect (an object with .x, .y, .width and .height attributes) overlaps this Rect in any way.
| clippedBy(self, other) Determine whether this rect is clipped by the other rect.
| intersect(self, other) Find the intersection of two Rects.
| set_position(self, value)
| set_size(self, value)
| get_origin(self)
| set_origin(self, origin)
| get_top(self)
| set_top(self, y)
| get_bottom(self)
| set_bottom(self, y)
| get_left(self)
| set_left(self, x)
| get_right(self)
| set_right(self, x)
| get_center(self)
| set_center(self, center)
| get_midtop(self)
| set_midtop(self, midtop)
| get_midbottom(self)
| set_midbottom(self, midbottom)
| get_midleft(self)
| set_midleft(self, midleft)
| get_midright(self)
| set_midright(self, midright)
| get_topleft(self)
| set_topleft(self, position)
| get_topright(self)
| set_topright(self, position)
| get_bottomright(self)
| set_bottomright(self, position)
| get_bottomleft(self)
| set_bottomleft(self, position)

## Properties

| x
| y
| width
| height
| position
| size
| origin
| top
| bottom
| left
| right
| center
| midtop
| midbottom
| midleft
| midright
| topleft
| topright
| bottomright
| bottomleft

## Property Details

### x

### y

### width

### height

### position

### size

### origin

### top

### bottom

### left

### right

### center

### midtop

### midbottom

### midleft

### midright

### topleft

### topright

### bottomright

### bottomleft