- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# OpenMesh::PolyMeshT< Kernel > Class Template Reference

Base type for a polygonal mesh. More...

`#include <OpenMesh/Mesh/PolyMeshT.hh>`

Inheritance diagram for OpenMesh::PolyMeshT< Kernel >:

List of all members.

enum |
| Determine whether this is a PolyMeshT or TriMeshT.
enum |
| Determine whether this is a PolyMeshT or TriMeshT.
static bool | is_polymesh ()
| Determine whether this is a PolyMeshT or TriMeshT.
static bool | is_trimesh ()
| Determine whether this is a PolyMeshT or TriMeshT.
## Normal vector computation
enum | VertexNormalMode { FAST, CORRECT, ANGLE_WEIGHTED, LOOP }
| Different methods for calculation of the normal at a vertex. More...
void | update_normals (VertexNormalMode _mode=FAST)
| Calls update_face_normals() and update_vertex_normals() if these normals (i.e.
void | update_normal (FaceHandle _fh)
| Update normal for face _fh.
void | update_face_normals ()
| Update normal vectors for all faces.
Normal | calc_face_normal (FaceHandle _fh) const
| Calculate normal vector for face _fh.
Normal | calc_face_normal (const Point &_p0, const Point &_p1, const Point &_p2) const
| Calculate normal vector for face (_p0, _p1, _p2).
void | update_normal (VertexHandle _vh)
| Update normal for vertex _vh.
void | update_vertex_normals (VertexNormalMode _mode=FAST)
| Update normal vectors for all vertices.
Normal | calc_vertex_normal (VertexHandle _vh) const
| Calculate normal vector for vertex _vh by averaging normals of adjacent faces.
void | calc_vertex_normal_fast (VertexHandle _vh, Normal &_n) const
| Different methods for calculation of the normal at a vertex.
void | calc_vertex_normal_correct (VertexHandle _vh, Normal &_n) const
| Different methods for calculation of the normal at a vertex.
void | calc_vertex_normal_loop (VertexHandle _vh, Normal &_n) const
| Different methods for calculation of the normal at a vertex.
void | calc_vertex_normal_angle_weighted (VertexHandle _vh, Normal &_n) const
| Different methods for calculation of the normal at a vertex.
## Mesh Handles
typedef Kernel::VertexHandle | VertexHandle
| Handle for referencing the corresponding item.
typedef Kernel::HalfedgeHandle | HalfedgeHandle
| Handle for referencing the corresponding item.
typedef Kernel::EdgeHandle | EdgeHandle
| Handle for referencing the corresponding item.
typedef Kernel::FaceHandle | FaceHandle
| Handle for referencing the corresponding item.
static const VertexHandle | InvalidVertexHandle
| Invalid handle.
static const HalfedgeHandle | InvalidHalfedgeHandle
| Invalid handle.
static const EdgeHandle | InvalidEdgeHandle
| Invalid handle.
static const FaceHandle | InvalidFaceHandle
| Invalid handle.
## Public Types
typedef PolyMeshT< Kernel > | This
| Self type. Used to specify iterators/circulators.
Mesh Items
typedef Kernel::Scalar | Scalar
| Scalar type.
typedef Kernel::Point | Point
| Coordinate type.
typedef Kernel::Normal | Normal
| Normal type.
typedef Kernel::Color | Color
| Color type.
typedef Kernel::TexCoord1D | TexCoord1D
| TexCoord1D type.
typedef Kernel::TexCoord2D | TexCoord2D
| TexCoord2D type.
typedef Kernel::TexCoord3D | TexCoord3D
| TexCoord3D type.
typedef Kernel::Vertex | Vertex
| Vertex type.
typedef Kernel::Halfedge | Halfedge
| Halfedge type.
typedef Kernel::Edge | Edge
| Edge type.
typedef Kernel::Face | Face
| Face type.
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
| PolyMeshT ()
| Default constructor.
| ~PolyMeshT ()
| Destructor.
PolyMeshT & | operator= (const PolyMeshT &_rhs)
| Assignment operator.
void | calc_edge_vector (EdgeHandle _eh, Normal &_edge_vec) const
| Calculates the edge vector as the vector defined by the halfedge with id #0 (see below).
void | calc_edge_vector (HalfedgeHandle _heh, Normal &_edge_vec) const
| Calculates the edge vector as the difference of the the points defined by to_vertex_handle() and from_vertex_handle().
Scalar | calc_edge_length (EdgeHandle _eh) const
| Calculates the length of the edge _eh.
Scalar | calc_edge_length (HalfedgeHandle _heh) const
| Calculates the length of the edge _heh.
void | calc_sector_vectors (HalfedgeHandle _in_heh, Normal &_vec0, Normal &_vec1) const
| defines a consistent representation of a sector geometry: the halfedge _in_heh defines the sector orientation the vertex pointed by _in_heh defines the sector center _vec0 and _vec1 are resp.
Scalar | calc_sector_angle (HalfedgeHandle _in_heh) const
| calculates the sector angle NOTE: only boundary concave sectors are treated correctly
void | calc_sector_normal (HalfedgeHandle _in_heh, Normal &_sector_normal) const
| calculates the normal (non-normalized) of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh))
Scalar | calc_sector_area (HalfedgeHandle _in_heh) const
| calculates the area of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh)) NOTE: special cases (e.g.
Scalar | calc_dihedral_angle (HalfedgeHandle _heh) const
| calculates the dihedral angle on the halfedge _heh
Scalar | calc_dihedral_angle (EdgeHandle _eh) const
| calculates the dihedral angle on the edge _eh
uint | find_feature_edges (Scalar _angle_tresh=deg_to_rad(44.0))
| tags an edge as a feature if its dihedral angle is larger than _angle_tresh returns the number of the found feature edges, requires edge_status property
HalfedgeHandle | find_halfedge (VertexHandle _start_vertex_handle, VertexHandle _end_vertex_habdle) const
| Find halfedge from _vh0 to _vh1. Returns invalid handle if not found.
void | adjust_outgoing_halfedge (VertexHandle _vh)
| Adjust outgoing halfedge handle for vertices, so that it is a boundary halfedge whenever possible.
void | split (FaceHandle _fh, VertexHandle _vh)
| Face split (= 1-to-n split).
void | split (FaceHandle _fh, const Point &_p)
| Face split (= 1-to-n split).
void | triangulate (FaceHandle _fh)
| triangulate the face _fh
void | triangulate ()
| triangulate the entire mesh
unsigned int | valence (VertexHandle _vh) const
| Vertex valence.
unsigned int | valence (FaceHandle _fh) const
| Face valence.
Adding items to a mesh
VertexHandle | add_vertex (const Point &_p)
| Add a new vertex with coordinate `_p`.
FaceHandle | add_face (const std::vector< VertexHandle > &_vhandles)
| Add and connect a new face.
template<class OtherMesh>
PolyMeshT & | assign (const OtherMesh &_rhs)
| Assignment from another mesh of another type.
Deleting mesh items
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
Boundary and manifold tests
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 Vertex & | deref (VertexHandle _h) const
| Get item from handle.
Vertex & | deref (VertexHandle _h)
| Get item from handle.
const Halfedge & | deref (HalfedgeHandle _h) const
| Get item from handle.
Halfedge & | deref (HalfedgeHandle _h)
| Get item from handle.
const Edge & | deref (EdgeHandle _h) const
| Get item from handle.
Edge & | deref (EdgeHandle _h)
| Get item from handle.
const Face & | deref (FaceHandle _h) const
| Get item from handle.
Face & | deref (FaceHandle _h)
| Get item from handle.

## Detailed Description

### template<class Kernel>
class OpenMesh::PolyMeshT< Kernel >

Base type for a polygonal mesh.

This is the base class for a polygonal mesh. It is parameterized by a mesh kernel that is given as a template argument. This class inherits all methods from its mesh kernel.

Parameters:

  | Kernel,: | template argument for the mesh kernel

Note:
  You should use the predefined mesh-kernel combinations in Predefined Mesh Types

See also:
  Specifying your MyMesh

## Member Enumeration Documentation

template<class Kernel>

enum OpenMesh::PolyMeshT::VertexNormalMode

Different methods for calculation of the normal at a vertex.

Enumerator:

  FAST | the default one, needs the Attributes::Normal attribute for faces also
  CORRECT | works properly for non-triangular meshes, does not need any attributes
  ANGLE_WEIGHTED | computes vertex normals as angle weighted averages of face normals, therefore needs face normals, too
  LOOP | calculates Loop surface normals, does not need any attributes

## Member Function Documentation

template<class Kernel>

PolyMeshT& OpenMesh::PolyMeshT< Kernel >::operator= | ( | const PolyMeshT< Kernel > & | _rhs | ) | `[inline]`

Assignment operator.

This function call is passed on to the correspoding mesh kernel. Use this function to assign two meshes of equal type. If the mesh types vary, use PolyMeshT::assign() instead.

template<class Kernel>
template<class OtherMesh>

PolyMeshT& OpenMesh::PolyMeshT< Kernel >::assign | ( | const OtherMesh & | _rhs | ) |

Assignment from another mesh of another type.

This method will use `add_vertex()` and `add_face()` in order to copy _rhs to itself. This will not be very efficient, but because different mesh types can have different item types it's the only solution.

Note:
  All that's copied is connectivity and vertex positions. All other information (like e.g. attributes or additional elements from traits classes) is not copied.

  If the two mesh types are equal (PolyMeshT<Kernel>==OtherMesh) you should use PolyMeshT::operator=() instead, because its more efficient and all information is copied.

Reimplemented in OpenMesh::TriMeshT< Kernel >, and OpenMesh::TriMeshT< MeshKernel >.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::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.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::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.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::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.

template<class Kernel>

bool OpenMesh::PolyMeshT< Kernel >::is_boundary | ( | EdgeHandle | _eh | ) | const`[inline]`

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

is one of its halfedges a boundary halfege ?

template<class Kernel>

bool OpenMesh::PolyMeshT< Kernel >::is_boundary | ( | FaceHandle | _fh,
|  | bool | _check_vertex = `false` |
| ) |  |  | const`[inline]`

Is face _fh at boundary, i.e.

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

Parameters:

  | _fh | Check this face
  | _check_vertex | If `true`, check the corner vertices of the face, too.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::update_normals | ( | VertexNormalMode | _mode = `FAST` | ) |

Calls update_face_normals() and update_vertex_normals() if these normals (i.e.

the properties) exist

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::update_face_normals | ( |  | ) |

Update normal vectors for all faces.

Attention:
  Needs the Attributes::Normal attribute for faces.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::update_vertex_normals | ( | VertexNormalMode | _mode = `FAST` | ) |

Update normal vectors for all vertices.

Attention:
  Needs the Attributes::Normal attribute for faces and vertices.

template<class Kernel>

PolyMeshT< Kernel >::Normal OpenMesh::PolyMeshT< Kernel >::calc_vertex_normal | ( | VertexHandle | _vh | ) | const

Calculate normal vector for vertex _vh by averaging normals of adjacent faces.

Face normals have to be computed first.

Attention:
  Needs the Attributes::Normal attribute for faces.

template<class Kernel>

void OpenMesh::PolyMeshT< Kernel >::calc_sector_vectors | ( | HalfedgeHandle | _in_heh,
|  | Normal & | _vec0,
|  | Normal & | _vec1 |
| ) |  |  | const`[inline]`

defines a consistent representation of a sector geometry: the halfedge _in_heh defines the sector orientation the vertex pointed by _in_heh defines the sector center _vec0 and _vec1 are resp.

the first and the second vectors defining the sector

template<class Kernel>

Scalar OpenMesh::PolyMeshT< Kernel >::calc_sector_area | ( | HalfedgeHandle | _in_heh | ) | const`[inline]`

calculates the area of the face sector defined by the angle <(_in_heh,next_halfedge(_in_heh)) NOTE: special cases (e.g.

concave sectors) are not handled correctly

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

- Core/Mesh/PolyMeshT.hh
- Core/Mesh/PolyMeshT.cc