ug4
polygonal-chain util

Enumerations

enum  ug::PolyChainTypes {
  ug::PCT_UNKNOWN = 0 , ug::PCT_CLOSED = 1 , ug::PCT_OPEN = 1 << 1 , ug::PCT_SEPARATED = 1 << 2 ,
  ug::PCT_IRREGULAR = 1 << 3 , ug::PCT_EMPTY = 1 << 4
}
 

Functions

template<class TEdgeIter >
bool ug::CreatePolyChain (std::vector< Vertex * > &polyChainOut, Grid &grid, TEdgeIter edgesBegin, TEdgeIter edgesEnd)
 given a list of edges, this method collects associated vertices in a polychain More...
 
template<class TEdgeIterator >
std::pair< Vertex *, Edge * > ug::GetFirstSectionOfPolyChain (Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, Grid::edge_traits::callback cbEdgeIsInPolyChain)
 Returns the start-vertex and start-edge of a polygonal chain. More...
 
std::pair< Vertex *, Edge * > ug::GetNextSectionOfPolyChain (Grid &grid, std::pair< Vertex *, Edge * > lastSection, Grid::edge_traits::callback cbEdgeIsInPolyChain)
 returns the next section in a polygonal chain. More...
 
template<class TEdgeIterator >
size_t ug::GetPolyChainType (Grid &grid, TEdgeIterator edgesBegin, TEdgeIterator edgesEnd, Grid::edge_traits::callback cbEdgeIsInPolyChain)
 returns an or combination of constants enumerated in PolyChainTypes. More...
 
bool ug::SplitIrregularPolyChain (SubsetHandler &sh, int srcIndex, int targetIndex)
 Makes sure that the polychain at srcIndex is regular and not separated. More...
 

Detailed Description

Methods that allow to interprete parts of a grid as a polygonal chain.

Enumeration Type Documentation

◆ PolyChainTypes

Enumerator
PCT_UNKNOWN 
PCT_CLOSED 
PCT_OPEN 
PCT_SEPARATED 
PCT_IRREGULAR 
PCT_EMPTY 

Function Documentation

◆ CreatePolyChain()

template<class TEdgeIter >
bool ug::CreatePolyChain ( std::vector< Vertex * > &  polyChainOut,
Grid grid,
TEdgeIter  edgesBegin,
TEdgeIter  edgesEnd 
)

given a list of edges, this method collects associated vertices in a polychain

This method uses Grid::mark. edges between edgesBegin and edgesEnd should build a closed regular polygon.

Todo:
add support for open chains.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Grid::begin_marking(), ug::Grid::end_marking(), ug::GetConnectedVertex(), ug::Grid::is_marked(), ug::Grid::mark(), and ug::EdgeVertices::vertex().

Referenced by ug::QualityGridGeneration(), ug::ReplaceLowValenceVertices(), and ug::TriangleFill().

◆ GetFirstSectionOfPolyChain()

template<class TEdgeIterator >
std::pair< Vertex *, Edge * > ug::GetFirstSectionOfPolyChain ( Grid grid,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd,
Grid::edge_traits::callback  cbEdgeIsInPolyChain 
)

Returns the start-vertex and start-edge of a polygonal chain.

The edges between iteratorBegin and iteratorEnd are considered to be edges of a polygonal chain. The algorithm then searches for a vertex that lies on the boundary of that chain. If a boundary vertex is found which is the first vertex in its associated chain-edge, it is preferred to a vertex, which is the second vertex of its associated chain-edge.

Returned is an std::pair. The first component points to the vertex and the second to its associated edge.

If the polygonal chain is closed, the the edge at edgesBegin and its first vertex is returned.

The given callback cbConsiderEdge has to return true for all edges between edgesBegin and edgesEnd and false for all other edges.

If there are no edges between the given iterators, std::pair(NULL, NULL) is returned.

References ug::IsBoundaryVertex1D(), and ug::EdgeVertices::vertex().

Referenced by ug::ExportGridToUG_2D(), and ug::SplitIrregularPolyChain().

◆ GetNextSectionOfPolyChain()

std::pair< Vertex *, Edge * > ug::GetNextSectionOfPolyChain ( Grid grid,
std::pair< Vertex *, Edge * >  lastSection,
Grid::edge_traits::callback  cbEdgeIsInPolyChain 
)

returns the next section in a polygonal chain.

lastSection has to contain a vertex and an associated edge, which is part of the polygonal chain. You can retrieve such a section by a call to ug::GetFirstVertexOfPolyChain or to ug::GetNextSectionInPolyChain.

If no more sections can be found, std::pair(NULL, NULL) is returned.

Be careful with closed polychains! The algorithm will always find a next section in this case.

If the polychain is irregular (more than 2 chain-edges meet at one vertex) the algorithm still terminates. However assumtions on the outcome should not be made.

References ug::Grid::associated_edges_begin(), ug::Grid::associated_edges_end(), ug::Grid::enable_options(), ug::GetConnectedVertex(), LOG, ug::Grid::option_is_enabled(), and ug::VRTOPT_STORE_ASSOCIATED_EDGES.

Referenced by ug::ExportGridToUG_2D(), and ug::SplitIrregularPolyChain().

◆ GetPolyChainType()

template<class TEdgeIterator >
size_t ug::GetPolyChainType ( Grid grid,
TEdgeIterator  edgesBegin,
TEdgeIterator  edgesEnd,
Grid::edge_traits::callback  cbEdgeIsInPolyChain 
)

◆ SplitIrregularPolyChain()

bool ug::SplitIrregularPolyChain ( SubsetHandler sh,
int  srcIndex,
int  targetIndex 
)