|
OpenABF 2.1.0
|
Half-edge mesh class. More...
Classes | |
| struct | Edge |
| Edge type More... | |
| class | EdgesIterator |
| Iterator that lazily flattens all face edges across all faces. More... | |
| struct | Face |
| Face type More... | |
| class | FaceIterator |
| Iterator for the edges of a face. More... | |
| struct | Vertex |
| Vertex type More... | |
| class | WheelIterator |
| Iterator for the edges of a vertex's wheel. More... | |
Public Types | |
| using | type = T |
| using | Pointer = std::shared_ptr< HalfEdgeMesh > |
| using | VertPtr = std::shared_ptr< Vertex > |
| Vertex pointer type. | |
| using | EdgePtr = std::shared_ptr< Edge > |
| Edge pointer type. | |
| using | FacePtr = std::shared_ptr< Face > |
| Edge pointer type. | |
Public Member Functions | |
| HalfEdgeMesh ()=default | |
| Default constructor. | |
| ~HalfEdgeMesh () | |
| Destructor deallocating all element pointers. | |
| auto | clone () const -> Pointer |
| Clone this mesh. | |
| template<typename... Args> | |
| auto | insert_vertex (Args... args) -> std::size_t |
| Insert a new vertex. | |
| template<class VectorOfVectors > | |
| auto | insert_vertices (const VectorOfVectors &v) -> std::vector< std::size_t > |
| Insert new vertices from a list of Vertex-like objects. | |
| template<typename ValType > | |
| auto | insert_vertices (std::initializer_list< std::initializer_list< ValType > > v) -> std::vector< std::size_t > |
| Insert new vertices from a list of Vertex-like objects. | |
| template<class Vector > | |
| auto | insert_face (Vector &&vector) -> std::size_t |
| Insert a face from an ordered list of Vertex indices. | |
| template<typename... Args> | |
| auto | insert_face (Args... args) -> std::size_t |
| Insert a new face from an ordered list of Vertex indices. | |
| template<class VectorOfVectors > | |
| auto | insert_faces (const VectorOfVectors &v) -> std::vector< std::size_t > |
| Insert new faces from a list of lists of Vertex indices. | |
| template<typename IdxType > | |
| auto | insert_faces (std::initializer_list< std::initializer_list< IdxType > > v) |
| Insert new faces from a list of lists of Vertex indices. | |
| void | update_boundary () |
| Update the mesh boundary connections. | |
| auto | vertices () const -> const std::vector< VertPtr > & |
| Get the list of vertices in insertion order. | |
| auto | vertex (std::size_t idx) const -> VertPtr |
| Get a vertex by index. | |
| auto | edges () const |
| Get a lazy range over all face edges in insertion order. | |
| auto | edge (std::size_t start, std::size_t end) -> EdgePtr |
| Find an existing edge with the provided end points. | |
| auto | boundary_edge () const -> EdgePtr |
| Get a boundary edge. | |
| auto | boundaries () const -> std::vector< std::vector< EdgePtr > > |
| Build a list of all boundary edges. | |
| auto | faces () const -> const std::vector< FacePtr > & |
| Get the list of faces in insertion order. | |
| auto | face (std::size_t idx) const -> FacePtr |
| Get a face by index. | |
| auto | num_connected_components () const -> std::size_t |
| Get the number of connected components. | |
| auto | connected_components () const -> std::vector< std::vector< FacePtr > > |
| Get a list of connected components. | |
| auto | vertices_interior () const |
| Get the list of interior vertices in insertion order. | |
| auto | vertices_boundary () const |
| Get a lazy range over boundary vertices in insertion order. | |
| auto | num_vertices () const -> std::size_t |
| Get the number of vertices. | |
| auto | num_vertices_interior () const -> std::size_t |
| Get the number of interior vertices. | |
| auto | num_edges () const -> std::size_t |
| Get the number of edges. | |
| auto | num_faces () const -> std::size_t |
| Get the number of faces. | |
| void | split_edge (const EdgePtr &edge) |
| Split an edge in order to introduce a new boundary. | |
| void | split_path (const std::vector< EdgePtr > &path) |
| Split a list of edges (path) to form a new boundary. | |
| void | split_path (const std::vector< std::size_t > &path) |
| Split a list of edges (path) to form a new boundary. | |
| auto | outgoing_edges (const std::size_t idx) -> std::vector< EdgePtr > |
| Get a list of outgoing edges from a specific vertex (by index) | |
| auto | incoming_edges (const std::size_t idx) -> std::vector< EdgePtr > |
| Get a list of incoming edges to a specific vertex (by index) | |
Static Public Member Functions | |
| template<typename... Args> | |
| static Pointer | New (Args... args) |
| Construct a new HalfEdgeMesh pointer. | |
Private Member Functions | |
| template<class Vector > | |
| auto | insert_face_ (const Vector &vector, FacePtr face=nullptr) -> std::size_t |
| auto | clone_face_ (const FacePtr &face) |
Private Attributes | |
| std::vector< VertPtr > | verts_ |
| std::vector< FacePtr > | faces_ |
| std::multimap< std::size_t, EdgePtr > | edges_ |
| std::size_t | numFaceEdges_ {0} |
Half-edge mesh class.
A half-edge mesh represents each edge as two oppositely oriented half-edges. There is one half-edge for each face containing the original edge. For example, if two faces share the edge AB, this will result in two half-edges, AB and BA. If an edge BC lies on the mesh border (i.e. it is only included in a single face), there will one be a single half-edge created. This data structure makes it possible to easily traverse the edges and faces adjacent to a vertex (the "wheel"), as well as to traverse the edges of each face.
For more information, see Chapter 12.1 in "Fundamentals of Computer Graphics, Fourth edition", Marschner and Shirley (2015) [2].
| T | Floating-point type for coordinates |
| Dim | Dimensionality of vertex coordinates |
| VertexTraits | Additional traits for vertices |
| EdgeTraits | Additional traits for edges |
| FaceTraits | Additional traits for face |
| using OpenABF::HalfEdgeMesh< T, Dim, VertexTraits, EdgeTraits, FaceTraits >::Pointer = std::shared_ptr<HalfEdgeMesh> |
Pointer type
| using OpenABF::HalfEdgeMesh< T, Dim, VertexTraits, EdgeTraits, FaceTraits >::type = T |
Fundamental element type (e.g. float, double)
|
inline |
Build a list of all boundary edges.
Returns a list of lists of edges which lie on one of this mesh's boundaries. One edge list is returned for each unique boundary. Meshes with a single connected component may still have multiple boundaries (i.e. if the mesh has holes).
|
inline |
Get a boundary edge.
Returns the first boundary edge in the list of edges
|
inline |
Clone this mesh.
Returns a new mesh with the same structure as this mesh but not sharing vertex, face, or edge elements.
|
inlineprivate |
Extra steps which need to be run before insert_face_ when cloning a face from an existing mesh
| face | Existing face from the mesh being cloned |
|
inline |
Insert a new face from an ordered list of Vertex indices.
Accepts vertex indices as individual variadic arguments.
| std::out_of_range | If one of the vertex indices is out of bounds. |
| MeshException | If one of provided edges is already paired. This indicates that the mesh is not 2-manifold. |
|
inline |
Insert a face from an ordered list of Vertex indices.
Accepts an iterable supporting range-based for loops.
| vector | List of vertex indices |
| std::out_of_range | If one of the vertex indices is out of bounds. |
| MeshException | (1) If one of provided edges is already paired. This indicates that the mesh is not 2-manifold. (2) If an edge has zero length. This means the face has zero area. (3) If an edge's interior angle is NaN or Inf. |
|
inlineprivate |
|
inline |
Insert new faces from a list of lists of Vertex indices.
A convenience function which adds multiple faces to the mesh (using insert_face()) and updates the mesh boundary (using update_boundary()) when complete.
|
inline |
Insert new faces from a list of lists of Vertex indices.
A convenience function which adds multiple faces to the mesh (using insert_face()) and updates the mesh boundary (using update_boundary()) when complete.
|
inline |
Insert a new vertex.
Accepts all arguments supported by the Vertex constructor.
|
inline |
Insert new vertices from a list of Vertex-like objects.
A convenience function which adds multiple vertices to the mesh.
|
inline |
Insert new vertices from a list of Vertex-like objects.
A convenience function which adds multiple vertices to the mesh.
|
inline |
Get the number of connected components.
A connected component is a set of continuous, adjacent faces. If you want to get the list of connected components, use connected_components().
|
inline |
Split an edge in order to introduce a new boundary.
Disconnects a single, paired half-edge (i.e. a single edge between two connected triangles) into two, unpaired half-edges, creating a "hole" in the mesh's connectivity graph. Useful when you want to introduce a boundary, or tear, into a mesh to improve parameterization.
|
inline |
Split a list of edges (path) to form a new boundary.
|
inline |
Split a list of edges (path) to form a new boundary.
This overload accepts a list of vertex indices forming a continuous path.
|
inline |
Update the mesh boundary connections.
Because the mesh boundary may become temporarily non-traversable while the mesh is being constructed, the mesh boundary connections should only be updated after all faces have been added to the mesh. Call this function after inserting faces with insert_face() or use insert_faces() to construct the mesh and update the boundary in one step.
|
private |
List of all edges, indexed by the vertex's insertion index
|
private |
List of faces
|
private |
Number of all edges which border a face
|
private |
List of vertices