10 The :mod:`bbox`` module contains the definition of the :class:`bbox` class representing
11 bounding boxes of graphical elements like paths, canvases, etc. used in PyX.
12 Usually, you obtain ``bbox`` instances as return values of the corresponding
13 ``bbox())`` method, but you may also construct a bounding box by yourself.
16 :class:`bbox` constructor
17 =========================
19 The ``bbox`` constructor accepts the following keyword arguments
21 +---------+-----------------------------------------------+
22 | keyword | description |
23 +=========+===============================================+
24 | ``llx`` | ``None`` (default) for :math:`-\infty` or |
25 | | :math:`x`\ -position of the lower left corner |
26 | | of the bbox (in user units) |
27 +---------+-----------------------------------------------+
28 | ``lly`` | ``None`` (default) for :math:`-\infty` or |
29 | | :math:`y`\ -position of the lower left corner |
30 | | of the bbox (in user units) |
31 +---------+-----------------------------------------------+
32 | ``urx`` | ``None`` (default) for :math:`\infty` or |
33 | | :math:`x`\ -position of the upper right |
34 | | corner of the bbox (in user units) |
35 +---------+-----------------------------------------------+
36 | ``ury`` | ``None`` (default) for :math:`\infty` or |
37 | | :math:`y`\ -position of the upper right |
38 | | corner of the bbox (in user units) |
39 +---------+-----------------------------------------------+
45 +-------------------------------------------+-----------------------------------------------+
46 | ``bbox`` method | function |
47 +===========================================+===============================================+
48 | ``intersects(other)`` | returns ``1`` if the ``bbox`` instance and |
49 | | ``other`` intersect with each other. |
50 +-------------------------------------------+-----------------------------------------------+
51 | ``transformed(self, trafo)`` | returns ``self`` transformed by |
52 | | transformation ``trafo``. |
53 +-------------------------------------------+-----------------------------------------------+
54 | ``enlarged(all=0, bottom=None, left=None, | return the bounding box enlarged by the given |
55 | top=None, right=None)`` | amount (in visual units). ``all`` is the |
56 | | default for all other directions, which is |
57 | | used whenever ``None`` is given for the |
58 | | corresponding direction. |
59 +-------------------------------------------+-----------------------------------------------+
60 | ``path()`` or ``rect()`` | return the ``path`` corresponding to the |
61 | | bounding box rectangle. |
62 +-------------------------------------------+-----------------------------------------------+
63 | ``height()`` | returns the height of the bounding box (in |
65 +-------------------------------------------+-----------------------------------------------+
66 | ``width()`` | returns the width of the bounding box (in PyX |
68 +-------------------------------------------+-----------------------------------------------+
69 | ``top()`` | returns the :math:`y`\ -position of the top |
70 | | of the bounding box (in PyX lengths). |
71 +-------------------------------------------+-----------------------------------------------+
72 | ``bottom()`` | returns the :math:`y`\ -position of the |
73 | | bottom of the bounding box (in PyX lengths). |
74 +-------------------------------------------+-----------------------------------------------+
75 | ``left()`` | returns the :math:`x`\ -position of the left |
76 | | side of the bounding box (in PyX lengths). |
77 +-------------------------------------------+-----------------------------------------------+
78 | ``right()`` | returns the :math:`x`\ -position of the right |
79 | | side of the bounding box (in PyX lengths). |
80 +-------------------------------------------+-----------------------------------------------+
82 Furthermore, two bounding boxes can be added (giving the bounding box enclosing
83 both) and multiplied (giving the intersection of both bounding boxes).