CGAL 5.1 - Classification
CGAL::Classification::Cluster< ItemRange, ItemMap > Class Template Reference

#include <CGAL/Classification/Cluster.h>

Definition

template<typename ItemRange, typename ItemMap>
class CGAL::Classification::Cluster< ItemRange, ItemMap >

Class that represent a cluster of items to be classified as a single atomic object.

A cluster is a set of indices of items inside an input range with random access.

Template Parameters
ItemRangemodel of ConstRange. Its iterator type is RandomAccessIterator. Its value type depends on the data that is classified (for example, CGAL::Point_3 or CGAL::Triangle_3).
ItemMapmodel of ReadablePropertyMap whose key type is the value type of the iterator of ItemRange and value type is the type of item to classify (for example, CGAL::Point_3).

Public Types

typedef ItemMap::value_type Item
 

Constructor

 Cluster (const ItemRange &range, ItemMap item_map)
 Constructs an empty cluster of items. More...
 

Modifications

void clear ()
 Clears the cluster. More...
 
void insert (std::size_t idx)
 Inserts element of index idx in the cluster. More...
 

Access

std::size_t size () const
 Returns the number of items in the cluster. More...
 
std::size_t index (std::size_t i) const
 Returns the index (in the input range) of the i^{th} element of the cluster. More...
 
const Itemoperator[] (std::size_t i) const
 Returns the i^{th} item of the cluster. More...
 
const CGAL::Bbox_3bbox () const
 Returns the bounding box of the cluster. More...
 

Classification

int training () const
 Returns the input classification value used for training. More...
 
int & training ()
 Returns a reference to the input classification value used for training. More...
 
int label () const
 Returns the output classification value. More...
 
int & label ()
 Returns a reference to the output classification value. More...
 

Member Typedef Documentation

◆ Item

template<typename ItemRange , typename ItemMap >
typedef ItemMap::value_type CGAL::Classification::Cluster< ItemRange, ItemMap >::Item

Constructor & Destructor Documentation

◆ Cluster()

template<typename ItemRange , typename ItemMap >
CGAL::Classification::Cluster< ItemRange, ItemMap >::Cluster ( const ItemRange &  range,
ItemMap  item_map 
)

Constructs an empty cluster of items.

Items in the clusters will be subsets of range.

Parameters
rangeinput range.
item_mapproperty map to access the input items.

Member Function Documentation

◆ bbox()

template<typename ItemRange , typename ItemMap >
const CGAL::Bbox_3& CGAL::Classification::Cluster< ItemRange, ItemMap >::bbox ( ) const

Returns the bounding box of the cluster.

◆ clear()

template<typename ItemRange , typename ItemMap >
void CGAL::Classification::Cluster< ItemRange, ItemMap >::clear ( )

Clears the cluster.

◆ index()

template<typename ItemRange , typename ItemMap >
std::size_t CGAL::Classification::Cluster< ItemRange, ItemMap >::index ( std::size_t  i) const

Returns the index (in the input range) of the i^{th} element of the cluster.

◆ insert()

template<typename ItemRange , typename ItemMap >
void CGAL::Classification::Cluster< ItemRange, ItemMap >::insert ( std::size_t  idx)

Inserts element of index idx in the cluster.

◆ label() [1/2]

template<typename ItemRange , typename ItemMap >
int& CGAL::Classification::Cluster< ItemRange, ItemMap >::label ( )

Returns a reference to the output classification value.

◆ label() [2/2]

template<typename ItemRange , typename ItemMap >
int CGAL::Classification::Cluster< ItemRange, ItemMap >::label ( ) const

Returns the output classification value.

◆ operator[]()

template<typename ItemRange , typename ItemMap >
const Item& CGAL::Classification::Cluster< ItemRange, ItemMap >::operator[] ( std::size_t  i) const

Returns the i^{th} item of the cluster.

◆ size()

template<typename ItemRange , typename ItemMap >
std::size_t CGAL::Classification::Cluster< ItemRange, ItemMap >::size ( ) const

Returns the number of items in the cluster.

◆ training() [1/2]

template<typename ItemRange , typename ItemMap >
int& CGAL::Classification::Cluster< ItemRange, ItemMap >::training ( )

Returns a reference to the input classification value used for training.

◆ training() [2/2]

template<typename ItemRange , typename ItemMap >
int CGAL::Classification::Cluster< ItemRange, ItemMap >::training ( ) const

Returns the input classification value used for training.