boxes.cartesian

Vect Class of two-dimensional vectors.
Rect(top, right, bottom, left) Holds the dimensions of a rectangle.
class boxes.cartesian.Vect(x, y)

Class of two-dimensional vectors.

This a named tuple (see collections.namedtuple() from the python standard library) with an x and a y attribute. Implements __add__() and __sub__().

class boxes.cartesian.Rect(top, right, bottom, left)

Holds the dimensions of a rectangle.

Objects of this class cannot be modified after creation

>>> from boxes.cartesian import Rect
>>> r = Rect(0, 1, 1, 0)
>>> r.right = 2
Traceback (most recent call last):
  ...
TypeError: 'Rect' objects are immutable
top

The y-coordinate of the top edge of the rectangle.

right

The x-coordinate of the right edge of the rectangle.

bottom

The y-coordinate of the bottom edge of the rectangle.

left

The x-coordinate of the left edge of the rectangle.

width

The width of the rectangle.

height

The height of the rectangle.

loc

The upper left corner of the rectangle (as a Vect).

size

The size of the rectangle (as a Vect).