Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

OpenMesh::PolyMeshT< Kernel > Class Template Reference

Base type for a polygonal mesh. More...

#include <OpenMesh/Mesh/PolyMeshT.hh>

Inheritance diagram for OpenMesh::PolyMeshT< Kernel >:

OpenMesh::BaseMesh OpenMesh::TriMeshT< Kernel > List of all members.

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.

const VertexHandle InvalidVertexHandle
 Invalid handle.

const HalfedgeHandle InvalidHalfedgeHandle
 Invalid handle.

const EdgeHandle InvalidEdgeHandle
 Invalid handle.

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::TexCoord TexCoord
 TexCoord 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
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
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
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 Methods

 PolyMeshT ()
 Default constructor.

 ~PolyMeshT ()
 Destructor.

PolyMeshT & operator= (const PolyMeshT &_rhs)
 Assignment operator.

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 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.

void adjust_outgoing_halfedge (VertexHandle _vh)
 Adjust outgoing halfedge handle for vertices, so that it is a boundary halfedge whenever possible.

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 (HalfedgeHandle _heh) const
 Is halfedge _heh a boundary halfedge (is its face handle invalid) ?

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 ?

Normal vector computation
void update_normals ()
 Calls update_face_normals() and update_vertex_normals() if these normals (i.e.

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 (FaceHandle _fh)
 Update normal for face _fh.

void update_face_normals ()
 Update normal vectors for all faces.

Normal calc_vertex_normal (VertexHandle _vh) const
 Calculate normal vector for vertex _vh by averaging normals of adjacent faces.

void update_normal (VertexHandle _vh)
 Update normal for vertex _vh.

void update_vertex_normals ()
 Update normal vectors for all vertices.

Generic handle derefertiation.
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.


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 Function Documentation

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.
Note:
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 >.

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 >::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().
Attention:
Needs the Attributes::Status attribute for vertices, edges and faces.

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>
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>
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>
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>
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_normals  
 

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

the properties) exist

template<class Kernel>
void OpenMesh::PolyMeshT< Kernel >::update_vertex_normals  
 

Update normal vectors for all vertices.

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


The documentation for this class was generated from the following files:
acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .