CGAL 4.6.1 - Intersecting Sequences of dD Iso-oriented Boxes
|
#include <CGAL/Box_intersection_d/Box_d.h>
Box_d
is a generic iso-oriented bounding box in dimension \( D\).
It provides in each dimension an interval with lower and upper endpoints represented with the number type NT
. This class is designed to work smoothly with the algorithms for intersecting sequences of iso-oriented boxes. For degeneracy handling, the boxes need to provide a unique id
-number. The policy parameter IdPolicy
offers several choices. The template parameters have to comply with the following requirements:
NT
: number type for the box boundaries, needs to be a model of the Assignable
and the LessThanComparable
concept. int D
: the dimension of the box. IdPolicy
: specifies how the id
-number will be provided. Can be one of the following types, where ID_EXPLICIT
is the default for this parameter: ID_NONE
: no id
-number is provided. Can be useful if Box_d
is used as a base class for a different implementation of id
-numbers than the ones provided here. ID_EXPLICIT
: the id
-number is stored explicitly in the box and automatically created and assigned at construction time of the box. Note that copying a box (copy-constructor and assignment) does not create a new id
-number but keeps the old one, which is the behavior needed by the box_self_intersection_d()
algorithm. This is therefore the safe default implementation. ID_FROM_BOX_ADDRESS
: casts the address of the box into a std::ptrdiff_t
to create the id
-number. Works fine if the intersection algorithms work effectively with pointers to boxes, but not in the case where the algorithms work with box values, because the algorithms modify the order of the boxes, and the box_self_intersection_d()
algorithm creates copies of the boxes that would not have identical id
-numbers. Types | |
typedef unspecified_type | NT |
number type to represent the box boundaries. More... | |
typedef std::size_t | ID |
type for the box id -number. | |
Creation | |
Box_d () | |
Default constructor. More... | |
Box_d (bool complete) | |
Constructor initialized to the complete or the empty space. More... | |
Box_d (NT lo[D], NT hi[D]) | |
initializes the box intervals to [lo[i] ,hi[i] ], \( 0 \leq i < D\). More... | |
Box_d (const Bbox_2 &bbox) | |
constructs from bbox . More... | |
Box_d (const Bbox_3 &bbox) | |
constructs from bbox . More... | |
Modifiers | |
void | init (bool complete=false) |
initializes to the complete or the empty space. More... | |
void | extend (NT point[D]) |
extend box to contain the old box and point . | |
static int | dimension () |
returns \( D\), the dimension of the box. | |
Access Functions | |
std::size_t | id () |
returns a unique box id, see the IdPolicy template parameter above for the different choices. More... | |
NT | min_coord (int d) const |
returns the lower boundary in dimension d More... | |
NT | max_coord (int d) const |
returns the upper boundary in dimension d More... | |
const Bbox_2 & | bbox () const |
returns the bounding box More... | |
const Bbox_3 & | bbox () const |
returns the bounding box More... | |
void | extend (NT p[N]) |
extends box to the smallest box that additionally contains the point represented by coordinates in p . | |
void | extend (std::pair< NT, NT > p[N]) |
extends box to the smallest box that additionally contains the point represented by coordinate intervals in p . | |
typedef unspecified_type CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::NT |
number type to represent the box boundaries.
Allowed are the built-in types int
, unsigned int
, float
, and double
.
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d | ( | ) |
Default constructor.
No particular initialization.
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d | ( | bool | complete) |
Constructor initialized to the complete or the empty space.
If empty, all interval starting(end) points will be set to positive(negative) infinity.
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d | ( | NT | lo[D], |
NT | hi[D] | ||
) |
initializes the box intervals to [lo[i]
,hi[i]
], \( 0 \leq i < D\).
lo[i]
\( <\) hi[i]
for \( 0 \leq i < D\). CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d | ( | const Bbox_2 & | bbox) |
constructs from bbox
.
NT
\( \equiv\)double
. CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d | ( | const Bbox_3 & | bbox) |
constructs from bbox
.
NT
\( \equiv\)double
. const Bbox_2& CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::bbox | ( | ) | const |
returns the bounding box
NT
\( \equiv\)double
const Bbox_3& CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::bbox | ( | ) | const |
returns the bounding box
NT
\( \equiv\)double
std::size_t CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::id | ( | ) |
returns a unique box id, see the IdPolicy
template parameter above for the different choices.
IdPolicy
\( \neq\)ID_NONE
void CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::init | ( | bool | complete = false ) |
initializes to the complete or the empty space.
If empty, all interval starting(end) points will be set to positive(negative) infinity.
NT CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::max_coord | ( | int | d) | const |
returns the upper boundary in dimension d
d
\( < D\). NT CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::min_coord | ( | int | d) | const |
returns the lower boundary in dimension d
d
\( < D\).