6.1 Polygon

A polygon is the most general case of a box. It is an instance of the class polygon. The constructor takes a list of points (which are (x, y) tuples) in the keyword argument corners and optionally another (x, y) tuple as the keyword argument center. The corners have to be ordered counterclockwise. In the following list some methods of this polygon class are explained:

path(centerradius=None, bezierradius=None, beziersoftness=1):
returns a path of the box; the center might be marked by a small circle of radius centerradius; the corners might be rounded using the parameters bezierradius and beziersoftness. For each corner of the box there may be one value for beziersoftness and two bezierradii. For convenience, it is not necessary to specify the whole list (for beziersoftness) and the whole list of lists (bezierradius) here. You may give a single value and/or a 2-tuple instead.
transform(*trafos):
performs a list of transformations to the box
reltransform(*trafos):
performs a list of transformations to the box relative to the box center

Figure 6.1: circle and line alignment examples (equal direction and distance)
\includegraphics{boxalign}

circlealignvector(a, dx, dy):
returns a vector (a tuple (x, y)) to align the box at a circle with radius a in the direction (dx, dy); see figure 6.1
linealignvector(a, dx, dy):
as above, but align at a line with distance a
circlealign(a, dx, dy):
as circlealignvector, but perform the alignment instead of returning the vector
linealign(a, dx, dy):
as linealignvector, but perform the alignment instead of returning the vector
extent(dx, dy):
extent of the box in the direction (dx, dy)
pointdistance(x, y):
distance of the point (x, y) to the box; the point must be outside of the box
boxdistance(other):
distance of the box to the box other; when the boxes are overlapping, BoxCrossError is raised
bbox():
returns a bounding box instance appropriate to the box