remove some TODO items which have been implemented/rejected
[PyX/mjg.git] / manual / bbox.tex
blob44abae70257b6735067eea1b3f3d5ae1fd783af4
1 \chapter{Module bbox}
3 \label{bbox}
5 The \texttt{bbox} module contains the definition of the \texttt{bbox}
6 class representing bounding boxes of graphical elements like paths,
7 canvases, etc.\ used in \PyX. Usually, you obtain \texttt{bbox}
8 instances as return values of the corresponding \texttt{bbox())}
9 method, but you may also construct a bounding box by yourself.
11 \section{bbox constructor}
13 The \texttt{bbox} constructor accepts the following keyword arguments
15 \medskip
16 \begin{tabularx}{\linewidth}{l>{\raggedright\arraybackslash}X}
17 keyword & description\\
18 \hline
19 \texttt{llx}&\texttt{None} (default) for $-\infty$ or $x$-position of
20 the lower left corner of the bbox (in user units)\\
21 \texttt{lly}&\texttt{None} (default) for $-\infty$ or $y$-position of
22 the lower left corner of the bbox (in user units)\\
23 \texttt{urx}&\texttt{None} (default) for $\infty$ or $x$-position of
24 the upper right corner of the bbox (in user units)\\
25 \texttt{ury}&\texttt{None} (default) for $\infty$ or $y$-position of
26 the upper right corner of the bbox (in user units)
27 \end{tabularx}
29 \section{bbox methods}
31 %Instances of the \texttt{bbox} class offer the following methods:
32 %\medskip
34 \begin{tabularx}
35 {\linewidth}
36 {>{\hsize=.85\hsize}X>{\raggedright\arraybackslash\hsize=1.15\hsize}X}
37 \texttt{bbox} method & function \\
38 \hline
39 \texttt{intersects(other)} & returns \texttt{1} if the \texttt{bbox} instance
40 and \texttt{other} intersect with each other.\\
41 \texttt{transformed(self, trafo)}& returns \texttt{self} transformed
42 by transformation \texttt{trafo}.\\
43 \texttt{enlarged(all=0, bottom=None,
44 \newline\phantom{enlarged(}left=None, top=None,
45 \newline\phantom{enlarged(}right=None)} &
46 return the bounding box enlarged by the given amount (in visual
47 units). \texttt{all} is the default for all other directions, which
48 is used whenever \texttt{None} is given for the corresponding
49 direction.\\
50 \texttt{path()} or \texttt{rect()} & return the \texttt{path} corresponding to the
51 bounding box rectangle.\\
52 \texttt{height()} & returns the height of the bounding box (in \PyX{}
53 lengths).\\
54 \texttt{width()} & returns the width of the bounding box (in \PyX{}
55 lengths).\\
56 \texttt{top()} & returns the $y$-position of the top of the bounding
57 box (in \PyX{} lengths).\\
58 \texttt{bottom()} & returns the $y$-position of the bottom of the
59 bounding box (in \PyX{} lengths).\\
60 \texttt{left()} & returns the $x$-position of the left side of the
61 bounding box (in \PyX{} lengths).\\
62 \texttt{right()} & returns the $x$-position of the right side of the
63 bounding box (in \PyX{} lengths).\\
64 \end{tabularx}
65 \medskip
67 Furthermore, two bounding boxes can be added (giving the bounding box
68 enclosing both) and multiplied (giving the intersection of both
69 bounding boxes).
71 %%% Local Variables:
72 %%% mode: latex
73 %%% TeX-master: "manual.tex"
74 %%% End: