An axis-aligned box in is a Cartesian product of intervals.
An axis-aligned box can be described by two points and in , such that
In this representation, is called the minimum point, and is called the maximum point. Here we have used half-open intervals, however, the ends-points may or may not be part of the intervals.
In Pastel, an axis-aligned box is modeled with the AlignedBox
class
using the min-max representation.
Whether the end-points are part of the intervals can be controlled by changing the topology of the box. On each axis both the min and max point can be either included or excluded. The default is that the minimums are closed and the maximums are open.
The AlignedBox
class template has a dual role in Pastel. First, it
is used to represent integer boxes. This is reflected by the PastelSys
providing the implementation of the AlignedBox. Second, it is
used to represent real boxes, i.e. more geometric objects, a view which is
emphasized by PastelGeometry. It makes sense to implement both by the
same implementation, since some algorithms, for example box intersection
and difference, can be carried out on both types of boxes. While the
implementation is actually in PastelSys, for convenience we provide
similarly named redirection files alignedbox.h and
alignedbox_tools.h for PastelGeometry, so that all shapes
in PastelGeometry can be logically found from the same location. Actually,
there is more than just convenience to this, since in the PastelGeometry
files we provide additional algorithms specific to geometry. Therefore,
when dealing with geometry, you should always include these files, rather
than the PastelSys files.