CGAL 6.2 - Intersecting Sequences of dD Iso-oriented Boxes
Loading...
Searching...
No Matches
CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, IdPolicy > Class Template Reference

#include <CGAL/Box_intersection_d/Box_with_info_d.h>

Definition

template<typename NT, typename int D, typename Info, typename IdPolicy>
class CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, IdPolicy >

Box_with_info_d is a generic iso-oriented bounding box in dimension \( D\) that stores additionally a variable 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.
Infoarbitrary user-defined type.
IdPolicyspecifies how the id-number will be provided and can be one of the following types, where ID_EXPLICIT is the default for this parameter:
  • ID_NONE: no id-number is provided. This 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. This 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.
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/boxes_with_different_types.cpp.

Types

typedef unspecified_type NT
 number type to represent the box boundaries.
 
typedef std::size_t ID
 type for the box id-number.
 

Creation

 Box_with_info_d ()
 Default constructor.
 
 Box_with_info_d (bool complete, Info info)
 initializes to the complete or the empty space.
 
 Box_with_info_d (NT lo[D], NT hi[D], Info info)
 initializes the box intervals to [lo[i],hi[i]], \( 0 \leq i < D\) and sets info to \( info\).
 
 Box_with_info_d (const Bbox_2 &bbox, Info info)
 constructs from bbox and sets info to \( info\), exists iff \( D=2\) and NT \( \equiv\)double.
 
 Box_with_info_d (const Bbox_3 &bbox, Info info)
 constructs from bbox and sets info to \( info\), exists iff \( D=3\) and NT \( \equiv\)double.
 

Modifiers

void init (bool complete=false)
 initializes to the complete or the empty space.
 
void extend (NT point[D])
 extend box to contain the old box and point.
 

Access Functions

Info info () const
 returns the info stored in box.
 
std::size_t id ()
 returns a unique box id, see the IdPolicy template parameter above for the different choices.
 
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

◆ NT

template<typename NT , typename int D, typename Info , typename IdPolicy >
typedef unspecified_type CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, IdPolicy >::NT

number type to represent the box boundaries.

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

Constructor & Destructor Documentation

◆ Box_with_info_d() [1/3]

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

Default constructor.

No particular initialization.

◆ Box_with_info_d() [2/3]

template<typename NT , typename int D, typename Info , typename IdPolicy >
CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, IdPolicy >::Box_with_info_d ( bool  complete,
Info  info 
)

initializes to the complete or the empty space.

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

◆ Box_with_info_d() [3/3]

template<typename NT , typename int D, typename Info , typename IdPolicy >
CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, IdPolicy >::Box_with_info_d ( NT  lo[D],
NT  hi[D],
Info  info 
)

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

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

Member Function Documentation

◆ id()

template<typename NT , typename int D, typename Info , typename IdPolicy >
std::size_t CGAL::Box_intersection_d::Box_with_info_d< NT, D, Info, 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.

◆ init()

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