Graphite  Version 3
An experimental 3D geometry processing program
GEO::basic_trindex< IndexType > Struct Template Reference

A triple of three indices. More...

#include <geogram/mesh/index.h>

Public Types

enum  KeepOrderType { KEEP_ORDER }
 This type is used to overload basic_trindex constructors with versions that keep the order of the stored indices. More...
 

Public Member Functions

 basic_trindex ()
 Creates an uninitialized basic_trindex.
 
 basic_trindex (IndexType i, IndexType j, IndexType k)
 Creates a basic_trindex from three integers. More...
 
 basic_trindex (IndexType i, IndexType j, IndexType k, KeepOrderType order)
 Creates a basic_trindex from three integers and keeps their order. More...
 
bool operator< (const basic_trindex< IndexType > &rhs) const
 Compares two basic_trindex. More...
 
bool operator== (const basic_trindex< IndexType > &rhs) const
 Compares two basic_trindex. More...
 
bool operator!= (const basic_trindex< IndexType > &rhs) const
 Compares two basic_trindex. More...
 
 basic_trindex (const basic_trindex< IndexType > &rhs)=default
 Constructs a basic_trindex from another one. More...
 
basic_trindex< IndexType > & operator= (const basic_trindex< IndexType > &rhs)=default
 Assigns a basic_trindex to this one. More...
 

Static Public Member Functions

static bool same_orientation (const basic_trindex< IndexType > &t, IndexType i, IndexType j, IndexType k)
 Tests whether a basic_trindex has the same orientation as a triple of integers. More...
 
static bool same_orientation (const basic_trindex< IndexType > &t1, const basic_trindex< IndexType > &t2)
 Tests whether two basic_trindex have the same orientation. More...
 
static basic_trindex inverse (const basic_trindex< IndexType > &t)
 Computes the inverse of a basic_trindex. More...
 

Public Attributes

IndexType indices [3]
 The array of 3 indices.
 

Related Functions

(Note that these are not member functions.)

template<class IndexType >
std::ostream & operator<< (std::ostream &out, const basic_trindex< IndexType > &T)
 Writes a basic_trindex to a stream. More...
 

Detailed Description

template<class IndexType>
struct GEO::basic_trindex< IndexType >

A triple of three indices.

Can be used as a key in associative data structures (std::map, std::set). The indices are defined by IndexType, generally signed or unsigned integers.

Template Parameters
IndexTypetype of the indices

Definition at line 239 of file index.h.

Member Enumeration Documentation

◆ KeepOrderType

template<class IndexType >
enum GEO::basic_trindex::KeepOrderType

This type is used to overload basic_trindex constructors with versions that keep the order of the stored indices.

Enumerator
KEEP_ORDER 

Value to pass to basic_trindex ordered constructor

Definition at line 250 of file index.h.

Constructor & Destructor Documentation

◆ basic_trindex() [1/3]

template<class IndexType >
GEO::basic_trindex< IndexType >::basic_trindex ( IndexType  i,
IndexType  j,
IndexType  k 
)
inline

Creates a basic_trindex from three integers.

The integers are reordered.

Parameters
[in]ifirst integer
[in]jsecond integer
[in]kthird integer

Definition at line 268 of file index.h.

◆ basic_trindex() [2/3]

template<class IndexType >
GEO::basic_trindex< IndexType >::basic_trindex ( IndexType  i,
IndexType  j,
IndexType  k,
KeepOrderType  order 
)
inline

Creates a basic_trindex from three integers and keeps their order.

The integers are not sorted.

Parameters
[in]ifirst integer
[in]jsecond integer
[in]kthird integer
[in]orderargument of type KeepOrderType used to select the right constructor. Use basic_trindex::KEEP_ORDER for this argument.

Definition at line 290 of file index.h.

◆ basic_trindex() [3/3]

template<class IndexType >
GEO::basic_trindex< IndexType >::basic_trindex ( const basic_trindex< IndexType > &  rhs)
default

Constructs a basic_trindex from another one.

Parameters
[in]rhsthe basic_trindex this basic_trindex should be copied from

Member Function Documentation

◆ inverse()

template<class IndexType >
static basic_trindex GEO::basic_trindex< IndexType >::inverse ( const basic_trindex< IndexType > &  t)
inlinestatic

Computes the inverse of a basic_trindex.

The inverse of a basic_trindex has the same indices but in reverse order.

Parameters
[in]tthe basic_trindex
Returns
a basic_trindex with the same indices as t but in reverse order.

Definition at line 412 of file index.h.

◆ operator!=()

template<class IndexType >
bool GEO::basic_trindex< IndexType >::operator!= ( const basic_trindex< IndexType > &  rhs) const
inline

Compares two basic_trindex.

Parameters
[in]rhsthe basic_trindex to compare this basic_trindex with.
Returns
true if one of the indices in rhs differs from the index in this basic_trindex at the same position, false otherwise.

Definition at line 340 of file index.h.

◆ operator<()

template<class IndexType >
bool GEO::basic_trindex< IndexType >::operator< ( const basic_trindex< IndexType > &  rhs) const
inline

Compares two basic_trindex.

Parameters
[in]rhsthe basic_trindex to compares this basic_trindex with.
Returns
true if rhs is smaller than this basic_trindex according to the lexicographic order, false otherwise.

Definition at line 308 of file index.h.

◆ operator=()

template<class IndexType >
basic_trindex<IndexType>& GEO::basic_trindex< IndexType >::operator= ( const basic_trindex< IndexType > &  rhs)
default

Assigns a basic_trindex to this one.

Parameters
[in]rhsthe basic_trindex this basic_trindex should be assigned from
Returns
a reference to this basic_trindex

◆ operator==()

template<class IndexType >
bool GEO::basic_trindex< IndexType >::operator== ( const basic_trindex< IndexType > &  rhs) const
inline

Compares two basic_trindex.

Parameters
[in]rhsthe basic_trindex to compare this basic_trindex with.
Returns
true of all indices of this basic_trindex correspond to the indices in rhs at the same positions, false otherwise.

Definition at line 326 of file index.h.

◆ same_orientation() [1/2]

template<class IndexType >
static bool GEO::basic_trindex< IndexType >::same_orientation ( const basic_trindex< IndexType > &  t,
IndexType  i,
IndexType  j,
IndexType  k 
)
inlinestatic

Tests whether a basic_trindex has the same orientation as a triple of integers.

Two basic_trindex have the same orientation if one of them is a circular permutation of the other one.

Parameters
[in]tthe basic_trindex
[in]ifirst index
[in]jsecond index
[in]kthird index
Returns
true if the indices in t are a circular permutation of (i, j, k), false otherwise.

Definition at line 376 of file index.h.

◆ same_orientation() [2/2]

template<class IndexType >
static bool GEO::basic_trindex< IndexType >::same_orientation ( const basic_trindex< IndexType > &  t1,
const basic_trindex< IndexType > &  t2 
)
inlinestatic

Tests whether two basic_trindex have the same orientation.

Two basic_trindex have the same orientation if one of them is a circular permutation of the other one.

Parameters
[in]t1first basic_trindex
[in]t2second basic_trindex
Returns
true if the indices in t2 are a circular permutation of the indices in t1, false otherwise.

Definition at line 395 of file index.h.

Friends And Related Function Documentation

◆ operator<<()

template<class IndexType >
std::ostream & operator<< ( std::ostream &  out,
const basic_trindex< IndexType > &  T 
)
related

Writes a basic_trindex to a stream.

Displays all the indices of the basic_trindex T.

Parameters
[in]outthe output stream
[in]Tthe basic_trindex to write
Template Parameters
IndexTypetype of the indices
Returns
a reference to the output stream out

Definition at line 441 of file index.h.


The documentation for this struct was generated from the following file: