DGtal  0.9.3beta
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]
 

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 173 of file DigitalSurface.h.

Constructor & Destructor Documentation

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 181 of file DigitalSurface.h.

182  {
183  if ( v1 <= v2 )
184  {
185  vertices[ 0 ] = v1;
186  vertices[ 1 ] = v2;
187  }
188  else
189  {
190  vertices[ 0 ] = v2;
191  vertices[ 1 ] = v1;
192  }
193  }
Vertex vertices[2]
The two vertices.

Member Function Documentation

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

Definition at line 199 of file DigitalSurface.h.

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

200  {
201  return ( vertices[ 0 ] < other.vertices[ 0 ] )
202  || ( ( vertices[ 0 ] == other.vertices[ 0 ] )
203  && ( vertices[ 1 ] < other.vertices[ 1 ] ) );
204  }
Vertex vertices[2]
The two vertices.
template<typename TDigitalSurfaceContainer>
bool DGtal::DigitalSurface< TDigitalSurfaceContainer >::Edge::operator== ( const Edge other) const
inline

Definition at line 194 of file DigitalSurface.h.

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

195  {
196  return ( vertices[ 0 ] == other.vertices[ 0 ] )
197  && ( vertices[ 1 ] == other.vertices[ 1 ] );
198  }
Vertex vertices[2]
The two vertices.

Field Documentation

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

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