| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
Rectangle
A rectangle identified by two points.
The rectangle stores left, top, right, and bottom values.
Coordinates are based on screen coordinates.
origin top
+-----> x increases |
| left -+- right
v |
y increases bottom
Instance methods:
- `copy`: Make a shallow copy
- `contains`: Is a vector inside?
- `overlaps`: Does a rectangle overlap?
- `inflate`: grow (or shrink)
- `move_to`: move entire rectangle to a spot
- `move_by`: move entire rectangle by an amount
Instance properties:
- `bounds`: Read-write, all rectangle coordinates
- `center`: Read-write, center of the rectangle
- `width`: Read-write, width of the rectangle
- `height`: Read-write, height of the rectangle
- `size`: Read-write, size of the rectangle
- `left`: Read-write, left edge of rectangle
- `top`: Read-write, top edge of rectangle
- `right`: Read-write, right edge of rectangle
- `bottom`: Read-write, bottom edge of rectangle
- `top_left`: Read-write, top-left corner
- `top_right`: Read-write, top-right corner
- `bottom_left`: Read-write, bottom-left corner
- `bottom_right`: Read-write, bottom-right corner
Operators:
str(s)
repr(s)
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
Inherited from |
|||
|
|||
|
bounds Read-write, all rectangle coordinates |
|||
| __center_x | |||
| __center_y | |||
|
center Read-write, center of the rectangle :: bound Vector |
|||
|
width Read-write, width of the rectangle :: float | int |
|||
|
height Read-write, height of the rectangle :: float | int |
|||
|
size Read-write, size of the rectangle :: bound Vector |
|||
|
left Read-write, left edge of rectangle :: float | int |
|||
|
top Read-write, top edge of rectangle :: float | int |
|||
|
right Read-write, right edge of rectangle :: float | int |
|||
|
bottom Read-write, bottom edge of rectangle :: float | int |
|||
|
top_left Read-write, top-left corner :: bound Vector |
|||
|
top_right Read-write, top-right corner :: bound Vector |
|||
|
bottom_left Read-write, bottom-left corner :: bound Vector |
|||
|
bottom_right Read-write, bottom-right corner :: bound Vector |
|||
|
Inherited from |
|||
|
|||
Construct a rectangle.
Overloaded, parameters:
:a:
`left` :: float | int
`top` :: float | int
`right` :: float | int
`bottom` :: float | int
:b:
`top_left` :: Vector
`bottom_right` :: Vector
|
Returns `True` if `v` is inside the rectangle.
Parameters:
`v` :: Vector
|
Returns `True` if `rect` overlaps with this rectangle.
Parameters:
`rect` :: Rectangle
|
Inflate the rectangle
Overloaded, parameters:
:a:
n :: number
Extend all sides by n points
:b:
v :: Vector
extend left and right sides by v.x and top and bottom sides by
v.y
|
Move the top_left corner to `v`, without changing size
Parameters:
`v` :: Vector
the spot to move to
|
Move the top_left corner by `v`, without changing size
Parameters:
`v` :: Vector
the amount to move by
|
str(x)
|
repr(x)
|
|
|||
bounds
Read-write, all rectangle coordinates
Returns (left, top, right, bottom)
Overloaded, set parameters:
:a:
`left` :: float | int
`top` :: float | int
`right` :: float | int
`bottom` :: float | int
:b:
`top_left` :: Vector
`bottom_right` :: Vector
|
__center_x
|
__center_y
|
centerRead-write, center of the rectangle :: bound Vector Changing the center does not change the size.
|
widthRead-write, width of the rectangle :: float | int
|
heightRead-write, height of the rectangle :: float | int
|
sizeRead-write, size of the rectangle :: bound Vector
|
leftRead-write, left edge of rectangle :: float | int
|
topRead-write, top edge of rectangle :: float | int
|
rightRead-write, right edge of rectangle :: float | int
|
bottomRead-write, bottom edge of rectangle :: float | int
|
top_leftRead-write, top-left corner :: bound Vector
|
top_rightRead-write, top-right corner :: bound Vector
|
bottom_leftRead-write, bottom-left corner :: bound Vector
|
bottom_rightRead-write, bottom-right corner :: bound Vector
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0 on Mon Jul 19 11:49:30 2010 | http://epydoc.sourceforge.net |