Lagrange
|
Utility functions. More...
Modules | |
Assert and errors | |
Assertions and exceptions. | |
Miscellaneous | |
Useful functions that don't have their place anywhere else. | |
Warnings | |
Managing compiler warnings. | |
Classes | |
class | AdjacencyList< Index > |
Adjacency list. More... | |
class | BitField< EnumType_ > |
Bit field utility class. More... | |
struct | ChainEdgesOptions |
Options for chain_directed_edges and chain_undirected_edges. More... | |
struct | ChainEdgesResult< Index > |
Result struct holding the loops and chains extracted from a set of edges. More... | |
class | DisjointSets< IndexType > |
Disjoint sets computation. More... | |
class | SmallVector< T, N > |
Hybrid vector that uses the stack upto a maximum size, and the heap beyond that. More... | |
struct | StackSet< T, N > |
Stack-allocated set with a maximum size. More... | |
struct | StackVector< T, N > |
Stack-allocated vector with a maximum size. More... | |
Functions | |
template<typename Index > | |
ChainEdgesResult< Index > | chain_directed_edges (const span< const Index > edges, const ChainEdgesOptions &options={}) |
Chain a set of directed edges into loops and chains. More... | |
template<typename Index > | |
ChainEdgesResult< Index > | chain_undirected_edges (const span< const Index > edges, const ChainEdgesOptions &options={}) |
Chain a set of undirected edges into loops and chains. More... | |
template<class T , size_t N> | |
bool | operator== (const StackSet< T, N > &lhs, const StackSet< T, N > &rhs) |
template<class T , size_t N> | |
bool | operator== (const StackVector< T, N > &lhs, const StackVector< T, N > &rhs) |
Utility functions.
A simple loop is defined as a set of connected edges whose starting and ending vertex is the same.
All vertices involved in a simple loop has exact two incident edges. For example, the letter O
contains one simple loop.
An ear loop is defined as a set of connected edges whose starting and ending vertex is the same. All vertices except the start/end vertex has exact two incident edges. For example, the digit 8
contains two ear loops.
A chain is defined as a set of connected edges whose starting and ending vertex is different. All vertices in a chain except the end points have exactly two incident edges. For example, the digit 2
contains one chain.
A chain is called a simple chain its both of its end points are not connected to any other edges. I.e. they have degree 1. For example, the =
sign has two simple chains.
A chain is called a hanging chain if one of its end vertices is not connected to any other edges. For example, the digit 6
contains 1 hanging chain and a ear loop.
ChainEdgesResult< Index > chain_directed_edges | ( | const span< const Index > | edges, |
const ChainEdgesOptions & | options = {} |
||
) |
#include <lagrange/utils/chain_edges.h>
Chain a set of directed edges into loops and chains.
This methods guarantees that all simple loops and simple chains are extracted. This method will also iteratively extract all ear loops and hanging chains.
Index | The Index type. |
edges | The input set of edges. |
options | Options controlling the behavior of this function. |
Both loops and chains are stored as an array of edges indices if options.output_edge_index
is true, otherwise, they are an array of vertex indices.
If options.output_edge_vertex
is false and options.close_loop_with_identical_vertices
is true, the first and last vertices of a loop is identical.
ChainEdgesResult< Index > chain_undirected_edges | ( | const span< const Index > | edges, |
const ChainEdgesOptions & | options = {} |
||
) |
#include <lagrange/utils/chain_edges.h>
Chain a set of undirected edges into loops and chains.
This methods guarantees that all simple loops and simple chains are extracted. This method will also iteratively extract all ear loops and hanging chains.
Index | The Index type. |
edges | The input set of edges. |
options | Options controlling the behavior of this function. |
Both loops and chains are stored as an array of edges indices if options.output_edge_index
is true, otherwise, they are an array of vertex indices.
If options.output_edge_vertex
is false and options.close_loop_with_identical_vertices
is true, the first and last vertices of a loop is identical.