Module fig :: Class Rect

Class Rect




This is a simple, half-internal helper class for handling Rectangles (e.g. used for bounding boxes). If you are looking for a rectangular figure object, PolyBox is your friend.

A Rect object has the properties x1, x2, y1, y2 carrying the coordinates, and accessor functions width(), height(), upperLeft(), lowerRight(), center(), size(). (The latter return pairs of coordinates.)

A special facility is the __call__ operator for adding points/rects (sort of a UNION operation).

Finally, it is possible to do:

x1, y1, x2, y2 = someRect


Instance Methods
 
__init__(self, *args)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
 
__call__(self, other)
 
contains(self, other)
Return True iff other is a Rect or point that is entirely within this Rect.
 
width(self)
 
height(self)
 
upperLeft(self)
 
lowerRight(self)
 
center(self)
 
size(self)
 
empty(self)
 
__mul__(self, factor)
 
__repr__(self)
repr(x)
 
__str__(self)
str(x)
 
__eq__(self, other)
 
__ne__(self, other)
 
__iter__(self)
Make Rect objects assignable like:: x1, y1, x2, y2 = someRect

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__

Properties
  x1
  x2
  y1
  y2

Inherited from object: __class__

Method Details

__init__(self, *args)
(Constructor)

 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

contains(self, other)

 
Return True iff other is a Rect or point that is entirely within this Rect. (Points on the border are considered to be contained.)

__repr__(self)
(Representation operator)

 
repr(x)
Overrides: object.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

 
str(x)
Overrides: object.__str__
(inherited documentation)