\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.10 - Intersecting Sequences of dD Iso-oriented Boxes
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy > Class Template Reference

#include <CGAL/Box_intersection_d/Box_with_handle_d.h>

Definition

Box_with_handle_d is a generic iso-oriented bounding box in dimension \( D\) that stores additionally a handle to some underlying geometric object.

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.

Template Parameters
NTnumber type for the box boundaries, needs to be a model of the Assignable and the LessThanComparable concept.
Dthe dimension of the box.
HandleHandle concept, e.g., a pointer, an iterator, or a circulator.
IdPolicyspecifies how the id-number will be provided. Can be one of the following types, where ID_FROM_HANDLE is the default for this parameter:
  • ID_NONE: no id-number is provided. Can be useful to have this class as a base class for different implementations 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 CGAL::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 CGAL::box_self_intersection_d() algorithm creates copies of the boxes that would not have identical id-numbers.
  • ID_FROM_HANDLE: casts the address of the value of the handle into a std::ptrdiff_t to create the id-number. Works in many conceivable settings, e.g., it works with boxes copied by value or by pointer, and the self intersection test. It will not work if there is no one-to-one mapping between boxes and the geometry that is referred to with the handles, i.e., this id-number scheme fails if a geometric object creates several boxes with the same handle value. Note that this option is not available for the CGAL::Box_intersection_d::Box_d type that does not store a handle.
Is Model Of:
BoxIntersectionBox_d
See Also
CGAL::box_intersection_d()
CGAL::box_self_intersection_d()
CGAL::box_intersection_all_pairs_d()
CGAL::box_self_intersection_all_pairs_d()
CGAL::Box_intersection_d::Box_traits_d<BoxHandle>
BoxIntersectionTraits_d
Examples:
Box_intersection_d/triangle_self_intersect.cpp, and Box_intersection_d/triangle_self_intersect_pointers.cpp.

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_with_handle_d ()
 Default constructor. More...
 
 Box_with_handle_d (bool complete, Handle h)
 initializes to the complete or the empty space. More...
 
 Box_with_handle_d (NT lo[D], NT hi[D], Handle h)
 initializes the box intervals to [lo[i],hi[i]], \( 0 \leq i < D\) and sets the handle to \( h\). More...
 
 Box_with_handle_d (const Bbox_2 &bbox, Handle h)
 constructs from bbox and sets the handle to \( h\), exists iff \( D=2\) and NT \( \equiv\)double.
 
 Box_with_handle_d (const Bbox_3 &bbox, Handle h)
 constructs from bbox and sets the handle to \( h\), exists iff \( D=3\) and NT \( \equiv\)double.
 

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.
 

Access Functions

Handle handle () const
 returns the handle stored in box.
 
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, \( 0 \leq\)d \( < D\).
 
NT max_coord (int d) const
 returns the upper boundary in dimension d, \( 0 \leq\)d \( < D\).
 
const Bbox_2bbox () const
 returns the bounding box iff \( D=2\) and NT \( \equiv\)double.
 
const Bbox_3bbox () const
 returns the bounding box iff \( D=3\) and NT \( \equiv\)double.
 
static int dimension ()
 returns \( D\), the dimension of the box.
 

Member Typedef Documentation

template<typename NT , typename int D, typename Handle , typename IdPolicy >
typedef unspecified_type CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy >::NT

number type to represent the box boundaries.

Allowed are the built-in types int, unsigned int, float, and double.

Constructor & Destructor Documentation

template<typename NT , typename int D, typename Handle , typename IdPolicy >
CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy >::Box_with_handle_d ( )

Default constructor.

No particular initialization.

template<typename NT , typename int D, typename Handle , typename IdPolicy >
CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy >::Box_with_handle_d ( bool  complete,
Handle  h 
)

initializes to the complete or the empty space.

If empty, all interval starting (end) points will be set to positive (negative) infinity, sets handle to \( h\).

template<typename NT , typename int D, typename Handle , typename IdPolicy >
CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy >::Box_with_handle_d ( NT  lo[D],
NT  hi[D],
Handle  h 
)

initializes the box intervals to [lo[i],hi[i]], \( 0 \leq i < D\) and sets the handle to \( h\).

Precondition
lo[i] \( <\) hi[i] for \( 0 \leq i < D\).

Member Function Documentation

template<typename NT , typename int D, typename Handle , typename IdPolicy >
std::size_t CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, IdPolicy >::id ( )

returns a unique box id, see the IdPolicy template parameter above for the different choices.

Does not exist if ID_NONE has been chosen for the IdPolicy.

template<typename NT , typename int D, typename Handle , typename IdPolicy >
void CGAL::Box_intersection_d::Box_with_handle_d< NT, D, Handle, 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.