OpenMesh
OpenMesh::PolyConnectivity Class Reference

Connectifity Class for polygonal meshes. More...

#include <OpenMesh/Core/Mesh/PolyConnectivity.hh>

Inheritance diagram for OpenMesh::PolyConnectivity:
Collaboration diagram for OpenMesh::PolyConnectivity:

List of all members.

Public Types

typedef PolyConnectivity This
Mesh Iterators

Refer to OpenMesh::Mesh::Iterators or Mesh Iterators and Circulators for documentation.

typedef Iterators::VertexIterT
< This
VertexIter
 Linear iterator.
typedef
Iterators::HalfedgeIterT< This
HalfedgeIter
 Linear iterator.
typedef Iterators::EdgeIterT
< This
EdgeIter
 Linear iterator.
typedef Iterators::FaceIterT
< This
FaceIter
 Linear iterator.
typedef
Iterators::ConstVertexIterT
< This
ConstVertexIter
 Linear iterator.
typedef
Iterators::ConstHalfedgeIterT
< This
ConstHalfedgeIter
 Linear iterator.
typedef
Iterators::ConstEdgeIterT
< This
ConstEdgeIter
 Linear iterator.
typedef
Iterators::ConstFaceIterT
< This
ConstFaceIter
 Linear iterator.
Mesh Circulators

Refer to OpenMesh::Mesh::Iterators or Mesh Iterators and Circulators for documentation.

typedef
Iterators::VertexVertexIterT
< This
VertexVertexIter
 Circulator.
typedef
Iterators::VertexOHalfedgeIterT
< This
VertexOHalfedgeIter
 Circulator.
typedef
Iterators::VertexIHalfedgeIterT
< This
VertexIHalfedgeIter
 Circulator.
typedef
Iterators::VertexEdgeIterT
< This
VertexEdgeIter
 Circulator.
typedef
Iterators::VertexFaceIterT
< This
VertexFaceIter
 Circulator.
typedef
Iterators::FaceVertexIterT
< This
FaceVertexIter
 Circulator.
typedef
Iterators::FaceHalfedgeIterT
< This
FaceHalfedgeIter
 Circulator.
typedef
Iterators::FaceEdgeIterT< This
FaceEdgeIter
 Circulator.
typedef
Iterators::FaceFaceIterT< This
FaceFaceIter
 Circulator.
typedef
Iterators::ConstVertexVertexIterT
< This
ConstVertexVertexIter
 Circulator.
typedef
Iterators::ConstVertexOHalfedgeIterT
< This
ConstVertexOHalfedgeIter
 Circulator.
typedef
Iterators::ConstVertexIHalfedgeIterT
< This
ConstVertexIHalfedgeIter
 Circulator.
typedef
Iterators::ConstVertexEdgeIterT
< This
ConstVertexEdgeIter
 Circulator.
typedef
Iterators::ConstVertexFaceIterT
< This
ConstVertexFaceIter
 Circulator.
typedef
Iterators::ConstFaceVertexIterT
< This
ConstFaceVertexIter
 Circulator.
typedef
Iterators::ConstFaceHalfedgeIterT
< This
ConstFaceHalfedgeIter
 Circulator.
typedef
Iterators::ConstFaceEdgeIterT
< This
ConstFaceEdgeIter
 Circulator.
typedef
Iterators::ConstFaceFaceIterT
< This
ConstFaceFaceIter
 Circulator.
Typedef Shortcuts

Provided for convenience only

typedef VertexHandle VHandle
 Alias typedef.
typedef HalfedgeHandle HHandle
 Alias typedef.
typedef EdgeHandle EHandle
 Alias typedef.
typedef FaceHandle FHandle
 Alias typedef.
typedef VertexIter VIter
 Alias typedef.
typedef HalfedgeIter HIter
 Alias typedef.
typedef EdgeIter EIter
 Alias typedef.
typedef FaceIter FIter
 Alias typedef.
typedef ConstVertexIter CVIter
 Alias typedef.
typedef ConstHalfedgeIter CHIter
 Alias typedef.
typedef ConstEdgeIter CEIter
 Alias typedef.
typedef ConstFaceIter CFIter
 Alias typedef.
typedef VertexVertexIter VVIter
 Alias typedef.
typedef VertexOHalfedgeIter VOHIter
 Alias typedef.
typedef VertexIHalfedgeIter VIHIter
 Alias typedef.
typedef VertexEdgeIter VEIter
 Alias typedef.
typedef VertexFaceIter VFIter
 Alias typedef.
typedef FaceVertexIter FVIter
 Alias typedef.
typedef FaceHalfedgeIter FHIter
 Alias typedef.
typedef FaceEdgeIter FEIter
 Alias typedef.
typedef FaceFaceIter FFIter
 Alias typedef.
typedef ConstVertexVertexIter CVVIter
 Alias typedef.
typedef ConstVertexOHalfedgeIter CVOHIter
 Alias typedef.
typedef ConstVertexIHalfedgeIter CVIHIter
 Alias typedef.
typedef ConstVertexEdgeIter CVEIter
 Alias typedef.
typedef ConstVertexFaceIter CVFIter
 Alias typedef.
typedef ConstFaceVertexIter CFVIter
 Alias typedef.
typedef ConstFaceHalfedgeIter CFHIter
 Alias typedef.
typedef ConstFaceEdgeIter CFEIter
 Alias typedef.
typedef ConstFaceFaceIter CFFIter
 Alias typedef.

Public Member Functions

void assign_connectivity (const PolyConnectivity &_other)
 assign_connectivity() method.
FaceHandle opposite_face_handle (HalfedgeHandle _heh) const
 returns the face handle of the opposite halfedge
void adjust_outgoing_halfedge (VertexHandle _vh)
 Adjust outgoing halfedge handle for vertices, so that it is a boundary halfedge whenever possible.
HalfedgeHandle find_halfedge (VertexHandle _start_vh, VertexHandle _end_vh) const
 Find halfedge from _vh0 to _vh1. Returns invalid handle if not found.
uint valence (VertexHandle _vh) const
 Vertex valence.
uint valence (FaceHandle _fh) const
 Face valence.
void collapse (HalfedgeHandle _heh)
 Halfedge collapse: collapse the from-vertex of halfedge _heh into its to-vertex.
bool is_simple_link (EdgeHandle _eh) const
 return true if the this the only link between the faces adjacent to _eh.
bool is_simply_connected (FaceHandle _fh) const
 return true if _fh shares only one edge with all of its adjacent faces.
FaceHandle remove_edge (EdgeHandle _eh)
 Removes the edge _eh.
void reinsert_edge (EdgeHandle _eh)
 Inverse of remove_edge.
HalfedgeHandle insert_edge (HalfedgeHandle _prev_heh, HalfedgeHandle _next_heh)
 Inserts an edge between to_vh(_prev_heh) and from_vh(_next_heh).
void split (FaceHandle _fh, VertexHandle _vh)
 Face split (= 1-to-n split)
void triangulate (FaceHandle _fh)
 triangulate the face _fh
void triangulate ()
 triangulate the entire mesh
Adding items to a mesh
VertexHandle add_vertex ()
 Add a new vertex.
FaceHandle add_face (const std::vector< VertexHandle > &_vhandles)
 Add and connect a new face.
FaceHandle add_face (VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2)
 Add and connect a new face.
FaceHandle add_face (VertexHandle _vh0, VertexHandle _vh1, VertexHandle _vh2, VertexHandle _vh3)
 Add and connect a new face.
FaceHandle add_face (const VertexHandle *_vhandles, uint _vhs_size)
 Add and connect a new face.
Deleting mesh items and other connectivity/topology modifications
void delete_vertex (VertexHandle _vh, bool _delete_isolated_vertices=true)
 Mark vertex and all incident edges and faces deleted.
void delete_edge (EdgeHandle _eh, bool _delete_isolated_vertices=true)
 Mark edge (two opposite halfedges) and incident faces deleted.
void delete_face (FaceHandle _fh, bool _delete_isolated_vertices=true)
 Delete face _fh and resulting degenerated empty halfedges as well.
Begin and end iterators
VertexIter vertices_begin ()
 Begin iterator for vertices.
ConstVertexIter vertices_begin () const
 Const begin iterator for vertices.
VertexIter vertices_end ()
 End iterator for vertices.
ConstVertexIter vertices_end () const
 Const end iterator for vertices.
HalfedgeIter halfedges_begin ()
 Begin iterator for halfedges.
ConstHalfedgeIter halfedges_begin () const
 Const begin iterator for halfedges.
HalfedgeIter halfedges_end ()
 End iterator for halfedges.
ConstHalfedgeIter halfedges_end () const
 Const end iterator for halfedges.
EdgeIter edges_begin ()
 Begin iterator for edges.
ConstEdgeIter edges_begin () const
 Const begin iterator for edges.
EdgeIter edges_end ()
 End iterator for edges.
ConstEdgeIter edges_end () const
 Const end iterator for edges.
FaceIter faces_begin ()
 Begin iterator for faces.
ConstFaceIter faces_begin () const
 Const begin iterator for faces.
FaceIter faces_end ()
 End iterator for faces.
ConstFaceIter faces_end () const
 Const end iterator for faces.
Begin for skipping iterators
VertexIter vertices_sbegin ()
 Begin iterator for vertices.
ConstVertexIter vertices_sbegin () const
 Const begin iterator for vertices.
HalfedgeIter halfedges_sbegin ()
 Begin iterator for halfedges.
ConstHalfedgeIter halfedges_sbegin () const
 Const begin iterator for halfedges.
EdgeIter edges_sbegin ()
 Begin iterator for edges.
ConstEdgeIter edges_sbegin () const
 Const begin iterator for edges.
FaceIter faces_sbegin ()
 Begin iterator for faces.
ConstFaceIter faces_sbegin () const
 Const begin iterator for faces.
Vertex and Face circulators
VertexVertexIter vv_iter (VertexHandle _vh)
 vertex - vertex circulator
VertexIHalfedgeIter vih_iter (VertexHandle _vh)
 vertex - incoming halfedge circulator
VertexOHalfedgeIter voh_iter (VertexHandle _vh)
 vertex - outgoing halfedge circulator
VertexEdgeIter ve_iter (VertexHandle _vh)
 vertex - edge circulator
VertexFaceIter vf_iter (VertexHandle _vh)
 vertex - face circulator
ConstVertexVertexIter cvv_iter (VertexHandle _vh) const
 const vertex circulator
ConstVertexIHalfedgeIter cvih_iter (VertexHandle _vh) const
 const vertex - incoming halfedge circulator
ConstVertexOHalfedgeIter cvoh_iter (VertexHandle _vh) const
 const vertex - outgoing halfedge circulator
ConstVertexEdgeIter cve_iter (VertexHandle _vh) const
 const vertex - edge circulator
ConstVertexFaceIter cvf_iter (VertexHandle _vh) const
 const vertex - face circulator
FaceVertexIter fv_iter (FaceHandle _fh)
 face - vertex circulator
FaceHalfedgeIter fh_iter (FaceHandle _fh)
 face - halfedge circulator
FaceEdgeIter fe_iter (FaceHandle _fh)
 face - edge circulator
FaceFaceIter ff_iter (FaceHandle _fh)
 face - face circulator
ConstFaceVertexIter cfv_iter (FaceHandle _fh) const
 const face - vertex circulator
ConstFaceHalfedgeIter cfh_iter (FaceHandle _fh) const
 const face - halfedge circulator
ConstFaceEdgeIter cfe_iter (FaceHandle _fh) const
 const face - edge circulator
ConstFaceFaceIter cff_iter (FaceHandle _fh) const
 const face - face circulator
VertexVertexIter vv_begin (VertexHandle _vh)
 vertex - vertex circulator
VertexIHalfedgeIter vih_begin (VertexHandle _vh)
 vertex - incoming halfedge circulator
VertexOHalfedgeIter voh_begin (VertexHandle _vh)
 vertex - outgoing halfedge circulator
VertexEdgeIter ve_begin (VertexHandle _vh)
 vertex - edge circulator
VertexFaceIter vf_begin (VertexHandle _vh)
 vertex - face circulator
ConstVertexVertexIter cvv_begin (VertexHandle _vh) const
 const vertex circulator
ConstVertexIHalfedgeIter cvih_begin (VertexHandle _vh) const
 const vertex - incoming halfedge circulator
ConstVertexOHalfedgeIter cvoh_begin (VertexHandle _vh) const
 const vertex - outgoing halfedge circulator
ConstVertexEdgeIter cve_begin (VertexHandle _vh) const
 const vertex - edge circulator
ConstVertexFaceIter cvf_begin (VertexHandle _vh) const
 const vertex - face circulator
FaceVertexIter fv_begin (FaceHandle _fh)
 face - vertex circulator
FaceHalfedgeIter fh_begin (FaceHandle _fh)
 face - halfedge circulator
FaceEdgeIter fe_begin (FaceHandle _fh)
 face - edge circulator
FaceFaceIter ff_begin (FaceHandle _fh)
 face - face circulator
ConstFaceVertexIter cfv_begin (FaceHandle _fh) const
 const face - vertex circulator
ConstFaceHalfedgeIter cfh_begin (FaceHandle _fh) const
 const face - halfedge circulator
ConstFaceEdgeIter cfe_begin (FaceHandle _fh) const
 const face - edge circulator
ConstFaceFaceIter cff_begin (FaceHandle _fh) const
 const face - face circulator
VertexVertexIter vv_end (VertexHandle _vh)
 vertex - vertex circulator
VertexIHalfedgeIter vih_end (VertexHandle _vh)
 vertex - incoming halfedge circulator
VertexOHalfedgeIter voh_end (VertexHandle _vh)
 vertex - outgoing halfedge circulator
VertexEdgeIter ve_end (VertexHandle _vh)
 vertex - edge circulator
VertexFaceIter vf_end (VertexHandle _vh)
 vertex - face circulator
ConstVertexVertexIter cvv_end (VertexHandle _vh) const
 const vertex circulator
ConstVertexIHalfedgeIter cvih_end (VertexHandle _vh) const
 const vertex - incoming halfedge circulator
ConstVertexOHalfedgeIter cvoh_end (VertexHandle _vh) const
 const vertex - outgoing halfedge circulator
ConstVertexEdgeIter cve_end (VertexHandle _vh) const
 const vertex - edge circulator
ConstVertexFaceIter cvf_end (VertexHandle _vh) const
 const vertex - face circulator
FaceVertexIter fv_end (FaceHandle _fh)
 face - vertex circulator
FaceHalfedgeIter fh_end (FaceHandle _fh)
 face - halfedge circulator
FaceEdgeIter fe_end (FaceHandle _fh)
 face - edge circulator
FaceFaceIter ff_end (FaceHandle _fh)
 face - face circulator
ConstFaceVertexIter cfv_end (FaceHandle _fh) const
 const face - vertex circulator
ConstFaceHalfedgeIter cfh_end (FaceHandle _fh) const
 const face - halfedge circulator
ConstFaceEdgeIter cfe_end (FaceHandle _fh) const
 const face - edge circulator
ConstFaceFaceIter cff_end (FaceHandle _fh) const
 const face - face circulator
Boundary and manifold tests
bool is_boundary (HalfedgeHandle _heh) const
 Is the edge _eh a boundary edge, i.e.
bool is_boundary (EdgeHandle _eh) const
 Is the edge _eh a boundary edge, i.e.
bool is_boundary (VertexHandle _vh) const
 Is vertex _vh a boundary vertex ?
bool is_boundary (FaceHandle _fh, bool _check_vertex=false) const
 Is face _fh at boundary, i.e.
bool is_manifold (VertexHandle _vh) const
 Is (the mesh at) vertex _vh two-manifold ?
Generic handle derefertiation.

Calls the respective vertex(), halfedge(), edge(), face() method of the mesh kernel.

const Vertexderef (VertexHandle _h) const
 Get item from handle.
Vertexderef (VertexHandle _h)
 Get item from handle.
const Halfedgederef (HalfedgeHandle _h) const
 Get item from handle.
Halfedgederef (HalfedgeHandle _h)
 Get item from handle.
const Edgederef (EdgeHandle _h) const
 Get item from handle.
Edgederef (EdgeHandle _h)
 Get item from handle.
const Facederef (FaceHandle _h) const
 Get item from handle.
Facederef (FaceHandle _h)
 Get item from handle.

Static Public Member Functions

static bool is_triangles ()

Static Public Attributes

Mesh Handles
static const VertexHandle InvalidVertexHandle
 Invalid handle.
static const HalfedgeHandle InvalidHalfedgeHandle
 Invalid handle.
static const EdgeHandle InvalidEdgeHandle
 Invalid handle.
static const FaceHandle InvalidFaceHandle
 Invalid handle.

Protected Member Functions

void collapse_edge (HalfedgeHandle _hh)
 Helper for halfedge collapse.
void collapse_loop (HalfedgeHandle _hh)
 Helper for halfedge collapse.

Detailed Description

Connectifity Class for polygonal meshes.


Member Function Documentation

FaceHandle OpenMesh::PolyConnectivity::add_face ( const std::vector< VertexHandle > &  _vhandles) [inline]

Add and connect a new face.

Create a new face consisting of the vertices provided by the vertex handle vector. (The vertices have to be already added to the mesh by add_vertex)

Parameters:
_vhandlessorted list of vertex handles (also defines order in which the vertices are added to the face)

Reimplemented in OpenMesh::TriConnectivity.

FaceHandle OpenMesh::PolyConnectivity::add_face ( VertexHandle  _vh0,
VertexHandle  _vh1,
VertexHandle  _vh2 
) [inline]

Add and connect a new face.

Create a new face consisting of three vertices provided by the handles. (The vertices have to be already added to the mesh by add_vertex)

Parameters:
_vh0First vertex handle
_vh1Second vertex handle
_vh2Third vertex handle

Reimplemented in OpenMesh::TriConnectivity.

FaceHandle OpenMesh::PolyConnectivity::add_face ( VertexHandle  _vh0,
VertexHandle  _vh1,
VertexHandle  _vh2,
VertexHandle  _vh3 
) [inline]

Add and connect a new face.

Create a new face consisting of four vertices provided by the handles. (The vertices have to be already added to the mesh by add_vertex)

Parameters:
_vh0First vertex handle
_vh1Second vertex handle
_vh2Third vertex handle
_vh3Fourth vertex handle
PolyConnectivity::FaceHandle OpenMesh::PolyConnectivity::add_face ( const VertexHandle _vhandles,
uint  _vhs_size 
)

Add and connect a new face.

Create a new face consisting of vertices provided by a handle array. (The vertices have to be already added to the mesh by add_vertex)

Parameters:
_vhandlespointer to a sorted list of vertex handles (also defines order in which the vertices are added to the face)
_vhs_sizenumber of vertex handles in the array

Reimplemented in OpenMesh::TriConnectivity.

void OpenMesh::PolyConnectivity::assign_connectivity ( const PolyConnectivity _other) [inline]
void OpenMesh::PolyConnectivity::collapse ( HalfedgeHandle  _heh)

Halfedge collapse: collapse the from-vertex of halfedge _heh into its to-vertex.

Attention:
Needs vertex/edge/face status attribute in order to delete the items that degenerate.
Note:
This function does not perform a garbage collection. It only marks degenerate items as deleted.
Attention:
A halfedge collapse may lead to topological inconsistencies. Therefore you should check this using is_collapse_ok().
Todo:
Implement is_collapse_ok() const for polygonal/triangle meshes
void OpenMesh::PolyConnectivity::delete_edge ( EdgeHandle  _eh,
bool  _delete_isolated_vertices = true 
)

Mark edge (two opposite halfedges) and incident faces deleted.

Resulting isolated vertices are marked deleted if _delete_isolated_vertices is true. Items marked deleted will be removed by garbageCollection().

Attention:
Needs the Attributes::Status attribute for vertices, edges and faces.
void OpenMesh::PolyConnectivity::delete_face ( FaceHandle  _fh,
bool  _delete_isolated_vertices = true 
)

Delete face _fh and resulting degenerated empty halfedges as well.

Resultling isolated vertices will be deleted if _delete_isolated_vertices is true.

Attention:
All item will only be marked to be deleted. They will actually be removed by calling garbage_collection().
Needs the Attributes::Status attribute for vertices, edges and faces.
void OpenMesh::PolyConnectivity::delete_vertex ( VertexHandle  _vh,
bool  _delete_isolated_vertices = true 
)

Mark vertex and all incident edges and faces deleted.

Items marked deleted will be removed by garbageCollection().

Attention:
Needs the Attributes::Status attribute for vertices, edges and faces.
PolyConnectivity::HalfedgeHandle OpenMesh::PolyConnectivity::insert_edge ( HalfedgeHandle  _prev_heh,
HalfedgeHandle  _next_heh 
)

Inserts an edge between to_vh(_prev_heh) and from_vh(_next_heh).

A new face is created started at heh0 of the inserted edge and its halfedges loop includes both _prev_heh and _next_heh. If an old face existed which includes the argument halfedges, it is split at the new edge. heh0 is returned.

Note:
assumes _prev_heh and _next_heh are either boundary or pointed to the same face
bool OpenMesh::PolyConnectivity::is_boundary ( FaceHandle  _fh,
bool  _check_vertex = false 
) const

Is face _fh at boundary, i.e.

is one of its edges (or vertices) a boundary edge?

Parameters:
_fhCheck this face
_check_vertexIf true, check the corner vertices of the face, too.
bool OpenMesh::PolyConnectivity::is_boundary ( HalfedgeHandle  _heh) const [inline]

Is the edge _eh a boundary edge, i.e.

is one of its halfedges a boundary halfege ?

Reimplemented from OpenMesh::ArrayKernel.

bool OpenMesh::PolyConnectivity::is_boundary ( EdgeHandle  _eh) const [inline]

Is the edge _eh a boundary edge, i.e.

is one of its halfedges a boundary halfege ?

bool OpenMesh::PolyConnectivity::is_simple_link ( EdgeHandle  _eh) const

return true if the this the only link between the faces adjacent to _eh.

_eh is allowed to be boundary, in which case true is returned iff _eh is the only boundary edge of its ajdacent face.

bool OpenMesh::PolyConnectivity::is_simply_connected ( FaceHandle  _fh) const

return true if _fh shares only one edge with all of its adjacent faces.

Boundary is treated as one face, i.e., the function false if _fh has more than one boundary edge.

void OpenMesh::PolyConnectivity::reinsert_edge ( EdgeHandle  _eh)

Inverse of remove_edge.

_eh should be the handle of the edge and the vertex and halfedge handles pointed by edge(_eh) should be valid.

PolyConnectivity::FaceHandle OpenMesh::PolyConnectivity::remove_edge ( EdgeHandle  _eh)

Removes the edge _eh.

Its adjacent faces are merged. _eh and one of the adjacent faces are set deleted. The handle of the remaining face is returned (InvalidFaceHandle is returned if _eh is a boundary edge).

Precondition:
is_simple_link(_eh). This ensures that there are no hole faces or isolated vertices appearing in result of the operation.
Attention:
Needs the Attributes::Status attribute for edges and faces.
Note:
This function does not perform a garbage collection. It only marks items as deleted.

The documentation for this class was generated from the following files: