\( \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.9 - Intersecting Sequences of dD Iso-oriented Boxes
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy > Class Template Reference

#include <CGAL/Box_intersection_d/Box_d.h>

Definition

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.
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_with_handle_d<NT, int D, Handle, IdPolicy>
CGAL::Box_intersection_d::Box_traits_d<BoxHandle>
BoxIntersectionTraits_d
Examples:
Box_intersection_d/box_grid.cpp, Box_intersection_d/minimal.cpp, and Box_intersection_d/minimal_self.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_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_2bbox () const
 returns the bounding box Requirements: \( D=2\) and NT \( \equiv\)double
 
const Bbox_3bbox () const
 returns the bounding box Requirements: \( D=3\) and NT \( \equiv\)double
 
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.
 

Member Typedef Documentation

template<typename NT , typename int D, typename IdPolicy >
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.

Constructor & Destructor Documentation

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

Default constructor.

No particular initialization.

template<typename NT , typename int D, typename IdPolicy >
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.

template<typename NT , typename int D, typename IdPolicy >
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\).

Precondition
lo[i] \( <\) hi[i] for \( 0 \leq i < D\).
template<typename NT , typename int D, typename IdPolicy >
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d ( const Bbox_2 bbox)

constructs from bbox.

Requirements: \( D=2\) and NT \( \equiv\)double.

template<typename NT , typename int D, typename IdPolicy >
CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::Box_d ( const Bbox_3 bbox)

constructs from bbox.

Requirements: \( D=3\) and NT \( \equiv\)double.

Member Function Documentation

template<typename NT , typename int D, typename IdPolicy >
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.

Template Parameters
<tt>IdPolicy</tt>\( \neq\)ID_NONE
template<typename NT , typename int D, typename IdPolicy >
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.

template<typename NT , typename int D, typename IdPolicy >
NT CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::max_coord ( int  d) const

returns the upper boundary in dimension d

Precondition
\( 0 \leq\)d \( < D\).
template<typename NT , typename int D, typename IdPolicy >
NT CGAL::Box_intersection_d::Box_d< NT, D, IdPolicy >::min_coord ( int  d) const

returns the lower boundary in dimension d

Precondition
\( 0 \leq\)d \( < D\).