DGtal  1.0.0
Public Member Functions | Data Fields
DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge Struct Reference

#include <DGtal/topology/DigitalSurface.h>

Public Member Functions

 Edge (const Vertex &v1, const Vertex &v2)
 
bool operator== (const Edge &other) const
 
bool operator< (const Edge &other) const
 

Data Fields

Vertex vertices [2]
 The two vertices. More...
 

Detailed Description

template<typename TDigitalSurfaceContainer>
struct DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge

An edge is a unordered pair of vertices. To make comparisons easier, the smallest vertex is stored before the greatest vertex. Note that loops are legal.

Definition at line 192 of file DigitalSurface.h.

Constructor & Destructor Documentation

◆ Edge()

template<typename TDigitalSurfaceContainer>
DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::Edge ( const Vertex v1,
const Vertex v2 
)
inline

Constructor from vertices.

Parameters
v1the first vertex.
v2the second vertex.

Definition at line 200 of file DigitalSurface.h.

201  {
202  if ( v1 <= v2 )
203  {
204  vertices[ 0 ] = v1;
205  vertices[ 1 ] = v2;
206  }
207  else
208  {
209  vertices[ 0 ] = v2;
210  vertices[ 1 ] = v1;
211  }
212  }
Vertex vertices[2]
The two vertices.

References DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::vertices.

Member Function Documentation

◆ operator<()

template<typename TDigitalSurfaceContainer>
bool DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::operator< ( const Edge other) const
inline

Definition at line 218 of file DigitalSurface.h.

219  {
220  return ( vertices[ 0 ] < other.vertices[ 0 ] )
221  || ( ( vertices[ 0 ] == other.vertices[ 0 ] )
222  && ( vertices[ 1 ] < other.vertices[ 1 ] ) );
223  }
Vertex vertices[2]
The two vertices.

References DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::vertices.

◆ operator==()

template<typename TDigitalSurfaceContainer>
bool DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::operator== ( const Edge other) const
inline

Definition at line 213 of file DigitalSurface.h.

214  {
215  return ( vertices[ 0 ] == other.vertices[ 0 ] )
216  && ( vertices[ 1 ] == other.vertices[ 1 ] );
217  }
Vertex vertices[2]
The two vertices.

References DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::vertices.

Field Documentation

◆ vertices

template<typename TDigitalSurfaceContainer>
Vertex DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::vertices[2]

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