OpenMesh
|
This class describes the minimum interface a mesh kernel has to implement (because the resulting mesh will rely on this interface). More...
#include <Doc/Concepts/MeshKernel.hh>
Public Member Functions | |
Constructor/Destructor | |
KernelT () | |
Default constructor. | |
~KernelT () | |
Destructor. | |
KernelT & | operator= (const KernelT &_rhs) |
Assignment operator. | |
void | reserve (size_t _n_vertices, size_t _n_edges, size_t _n_faces) |
Reserve memory for vertices, edges, faces. More... | |
Handle -> Item. | |
const Vertex & | vertex (VertexHandle _h) const |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
Vertex & | vertex (VertexHandle _h) |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
const Halfedge & | halfedge (HalfedgeHandle _h) const |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
Halfedge & | halfedge (HalfedgeHandle _h) |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
const Edge & | edge (EdgeHandle _h) const |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
Edge & | edge (EdgeHandle _h) |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
const Face & | face (FaceHandle _h) const |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
Face & | face (FaceHandle _h) |
Translate handle to item (see also OpenMesh::PolyMeshT::deref()) | |
Item -> Handle | |
VertexHandle | handle (const Vertex &_v) const |
Translate item to handle. | |
HalfedgeHandle | handle (const Halfedge &_he) const |
Translate item to handle. | |
EdgeHandle | handle (const Edge &_e) const |
Translate item to handle. | |
FaceHandle | handle (const Face &_f) const |
Translate item to handle. | |
Get the i'th item | |
VertexHandle | vertex_handle (unsigned int _i) const |
Get the i'th item. | |
HalfedgeHandle | halfedge_handle (unsigned int _i) const |
Get the i'th item. | |
EdgeHandle | edge_handle (unsigned int _i) const |
Get the i'th item. | |
FaceHandle | face_handle (unsigned int _i) const |
Get the i'th item. | |
Delete items | |
void | clear () |
Delete all items, i.e. More... | |
void | clean () |
Delete all items, i.e. More... | |
void | garbage_collection () |
Remove all items that are marked as deleted from the corresponding containers. More... | |
void | remove_last_vertex () |
Remove the last vertex imidiately, i.e. More... | |
void | remove_last_edge () |
Remove the last edge imidiately, i.e. More... | |
void | remove_last_face () |
Remove the last face imidiately, i.e. More... | |
Number of elements | |
size_t | n_vertices () const |
Returns number of vertices. | |
size_t | n_halfedges () const |
Returns number of halfedges (should be 2*n_edges()) | |
size_t | n_edges () const |
Returns number of edges. | |
size_t | n_faces () const |
Returns number of faces. | |
bool | vertices_empty () const |
Is the vertex container empty? | |
bool | halfedges_empty () const |
Is the halfedge container empty (should be the same as edges_empty()). | |
bool | edges_empty () const |
Is the edge container empty? | |
bool | faces_empty () const |
Is the face container empty? | |
Vertex connectivity | |
HalfedgeHandle | halfedge_handle (VertexHandle _vh) const |
Get an outgoing halfedge of a given vertex. | |
void | set_halfedge_handle (VertexHandle _vh, HalfedgeHandle _heh) |
Set the outgoing halfedge handle of a given vertex. | |
const Point & | point (VertexHandle _vh) const |
Get the coordinate of a vertex. | |
const Point & | point (const Vertex &_v) const |
Get the coordinate of a vertex. | |
void | set_point (VertexHandle _vh, const Point &_p) |
Set the coordinate of a vertex. | |
void | set_point (Vertex &_v, const Point &_p) |
Set the coordinate of a vertex. | |
Halfedge connectivity | |
VertexHandle | to_vertex_handle (HalfedgeHandle _heh) const |
Get the vertex the halfedge points to. | |
VertexHandle | from_vertex_handle (HalfedgeHandle _heh) const |
Get the vertex the halfedge starts from (implemented as to-handle of the opposite halfedge, provided for convenience) | |
void | set_vertex_handle (HalfedgeHandle _heh, VertexHandle _vh) |
Set the to-vertex-handle of the halfedge. | |
FaceHandle | face_handle (HalfedgeHandle _heh) const |
Get the face the halfedge belongs to. More... | |
void | set_face_handle (HalfedgeHandle _heh, FaceHandle _fh) |
Set the face the halfedge belongs to. | |
HalfedgeHandle | next_halfedge_handle (HalfedgeHandle _heh) const |
Get the next halfedge handle. | |
void | set_next_halfedge_handle (HalfedgeHandle _heh, HalfedgeHandle _nheh) |
Set the next halfedge handle. More... | |
HalfedgeHandle | prev_halfedge_handle (HalfedgeHandle _heh) const |
Get the previous halfedge of the given halfedge. More... | |
HalfedgeHandle | opposite_halfedge_handle (HalfedgeHandle _heh) const |
Get the opposite halfedge. | |
HalfedgeHandle | ccw_rotated_halfedge_handle (HalfedgeHandle _heh) const |
Counter-clockwise rotate the given halfedge around its from vertex. | |
HalfedgeHandle | cw_rotated_halfedge_handle (HalfedgeHandle _heh) const |
Clockwise rotate the given halfedge around its from vertex. | |
EdgeHandle | edge_handle (HalfedgeHandle _heh) const |
Get the edge the current halfedge it contained in. | |
Edge connectivity | |
HalfedgeHandle | halfedge_handle (EdgeHandle _eh, unsigned int _i) const |
Get the first or second halfedge of the given edge. | |
Face connectivity | |
HalfedgeHandle | halfedge_handle (FaceHandle _fh) const |
Get a halfedge belonging to the face. | |
void | set_halfedge_handle (FaceHandle _fh, HalfedgeHandle _heh) |
Set one halfedge of the face. | |
set/get value of a standard property | |
const Point & | point (VertexHandle _vh) const |
Get position. | |
void | set_point (VertexHandle _vh, const Point &_p) |
Set position. | |
Point & | point (VertexHandle _vh) |
Convenience function. | |
const Normal & | normal (VertexHandle _vh) const |
Get normal. | |
void | set_normal (VertexHandle _vh, const Normal &_n) |
Set normal. | |
const Normal & | normal (HalfedgeHandle _heh) const |
Get normal of the to vertex of the given Halfedge (per face per vertex normals) | |
void | set_normal (HalfedgeHandle _heh, const Normal &_n) |
Set normal of the to vertex of the given Halfedge (per face per vertex normals) | |
const Color & | color (VertexHandle _vh) const |
Get color. | |
void | set_color (VertexHandle _vh, const Color &_c) |
Set color. | |
const TexCoord1D & | texcoord1D (VertexHandle _vh) const |
Get texture coordinate. | |
void | set_texcoord1D (VertexHandle _vh, const TexCoord1D &_t) |
Set texture coordinate. | |
const TexCoord2D & | texcoord2D (VertexHandle _vh) const |
Get texture coordinate. | |
void | set_texcoord2D (VertexHandle _vh, const TexCoord2D &_t) |
Set texture coordinate. | |
const TexCoord3D & | texcoord3D (VertexHandle _vh) const |
Get texture coordinate. | |
void | set_texcoord3D (VertexHandle _vh, const TexCoord3D &_t) |
Set texture coordinate. | |
const TexCoord1D & | texcoord1D (HalfedgeHandle _hh) const |
Get texture coordinate of the to vertex for the current face (per face per vertex texcoords) | |
void | set_texcoord1D (HalfedgeHandle _hh, const TexCoord1D &_t) |
Set texture coordinate of the to vertex of the given Halfedge (per face per vertex texcoords) | |
const TexCoord2D & | texcoord2D (HalfedgeHandle _hh) const |
Get texture coordinate of the to vertex for the current face (per face per vertex texcoords) | |
void | set_texcoord2D (HalfedgeHandle _hh, const TexCoord2D &_t) |
Set texture coordinate of the to vertex of the given Halfedge (per face per vertex texcoords) | |
const TexCoord3D & | texcoord3D (HalfedgeHandle _hh) const |
Get texture coordinate of the to vertex for the current face (per face per vertex texcoords) | |
void | set_texcoord3D (HalfedgeHandle _hh, const TexCoord3D &_t) |
Set texture coordinate of the to vertex of the given Halfedge (per face per vertex texcoords) | |
const StatusInfo & | status (VertexHandle _vh) const |
Get status. | |
StatusInfo & | status (VertexHandle _vh) |
Get status. | |
const StatusInfo & | status (HalfedgeHandle _vh) const |
Get status. | |
StatusInfo & | status (HalfedgeHandle _vh) |
Get status. | |
const Color & | color (HalfedgeHandle _heh) const |
Get color. | |
void | set_color (HalfedgeHandle _heh, const Color &_c) |
Set color. | |
const Color & | color (EdgeHandle _eh) const |
Get color. | |
void | set_color (EdgeHandle _eh, const Color &_c) |
Set color. | |
const StatusInfo & | status (EdgeHandle _vh) const |
Get status. | |
StatusInfo & | status (EdgeHandle _vh) |
Get status. | |
const Normal & | normal (FaceHandle _fh) const |
Get normal. | |
void | set_normal (FaceHandle _fh, const Normal &_n) |
Set normal. | |
const Color & | color (FaceHandle _fh) const |
Get color. | |
void | set_color (FaceHandle _fh, const Color &_c) |
Set color. | |
const StatusInfo & | status (FaceHandle _vh) const |
Get status. | |
StatusInfo & | status (FaceHandle _vh) |
Get status. | |
Dynamically add standard properties | |
void | request_vertex_normals () |
Request property. | |
void | request_vertex_colors () |
Request property. | |
void | request_vertex_texcoords1D () |
Request property. | |
void | request_vertex_texcoords2D () |
Request property. | |
void | request_vertex_texcoords3D () |
Request property. | |
void | request_vertex_status () |
Request property. | |
void | request_halfedge_status () |
Request property. | |
void | request_halfedge_normals () |
Request property. | |
void | request_halfedge_colors () |
Request property. | |
void | request_halfedge_texcoords1D () |
Request property. | |
void | request_halfedge_texcoords2D () |
Request property. | |
void | request_halfedge_texcoords3D () |
Request property. | |
void | request_edge_status () |
Request property. | |
void | request_edge_colors () |
Request property. | |
void | request_face_normals () |
Request property. | |
void | request_face_colors () |
Request property. | |
void | request_face_status () |
Request property. | |
void | request_face_texture_index () |
Request property. | |
Remove standard properties | |
void | release_vertex_normals () |
Remove property. | |
void | release_vertex_colors () |
Remove property. | |
void | release_vertex_texcoords1D () |
Remove property. | |
void | release_vertex_texcoords2D () |
Remove property. | |
void | release_vertex_texcoords3D () |
Remove property. | |
void | release_vertex_status () |
Remove property. | |
void | release_halfedge_status () |
Remove property. | |
void | release_halfedge_normals () |
Remove property. | |
void | release_halfedge_colors () |
Remove property. | |
void | release_halfedge_texcoords1D () |
Remove property. | |
void | release_halfedge_texcoords2D () |
Remove property. | |
void | release_halfedge_texcoords3D () |
Remove property. | |
void | release_edge_status () |
Remove property. | |
void | release_edge_colors () |
Remove property. | |
void | release_face_normals () |
Remove property. | |
void | release_face_colors () |
Remove property. | |
void | release_face_status () |
Remove property. | |
void | release_face_texture_index () |
Remove property. | |
Check availability of standard properties | |
bool | has_vertex_normals () const |
Is property available? | |
bool | has_vertex_colors () const |
Is property available? | |
bool | has_vertex_texcoords1D () const |
Is property available? | |
bool | has_vertex_texcoords2D () const |
Is property available? | |
bool | has_vertex_texcoords3D () const |
Is property available? | |
bool | has_vertex_status () const |
Is property available? | |
bool | has_halfedge_status () const |
Is property available? | |
bool | has_halfedge_normals () const |
Is property available? | |
bool | has_halfedge_colors () const |
Is property available? | |
bool | has_halfedge_texcoords1D () const |
Is property available? | |
bool | has_halfedge_texcoords2D () const |
Is property available? | |
bool | has_halfedge_texcoords3D () const |
Is property available? | |
bool | has_edge_status () const |
Is property available? | |
bool | has_edge_colors () const |
Is property available? | |
bool | has_face_normals () const |
Is property available? | |
bool | has_face_colors () const |
Is property available? | |
bool | has_face_status () const |
Is property available? | |
bool | has_face_texture_index () const |
Is property available? | |
Property management - add property | |
template<typename T > | |
void | add_property ([VEHFM]PropHandleT< T > &_ph, const std::string &_name="") |
Add property. More... | |
Property management - remove property | |
template<typename T > | |
void | remove_property ([VEHFM]PropHandleT< T > &) |
Remove property. | |
Property management - get property by name | |
template<typename T > | |
bool | get_property_handle ([VEHFM]PropHandleT< T > &ph, const std::string &_n) const |
Get property handle by name. | |
Property management - get property | |
template<typename T > | |
PropertyT< T > & | property ([VEHF]PropHandleT< T > _ph) |
Get property. | |
template<typename T > | |
const PropertyT< T > & | property ([VEHF]PropHandleT< T > _ph) const |
Get property. | |
template<typename T > | |
PropertyT< T > & | mproperty (MPropHandleT< T > _ph) |
Get property. | |
template<typename T > | |
const PropertyT< T > & | mproperty (MPropHandleT< T > _ph) const |
Get property. | |
Property management - get property value for an item | |
template<typename T > | |
T & | property (VPropHandleT< T > _ph, VertexHandle _vh) |
Get value for item represented by the handle. | |
template<typename T > | |
const T & | property (VPropHandleT< T > _ph, VertexHandle _vh) const |
Get value for item represented by the handle. | |
template<typename T > | |
T & | property (EPropHandleT< T > _ph, EdgeHandle _vh) |
Get value for item represented by the handle. | |
template<typename T > | |
const T & | property (EPropHandleT< T > _ph, EdgeHandle _vh) const |
Get value for item represented by the handle. | |
template<typename T > | |
T & | property (HPropHandleT< T > _ph, HalfedgeHandle _vh) |
Get value for item represented by the handle. | |
template<typename T > | |
const T & | property (HPropHandleT< T > _ph, HalfedgeHandle _vh) const |
Get value for item represented by the handle. | |
template<typename T > | |
T & | property (FPropHandleT< T > _ph, FaceHandle _vh) |
Get value for item represented by the handle. | |
template<typename T > | |
const T & | property (FPropHandleT< T > _ph, FaceHandle _vh) const |
Get value for item represented by the handle. | |
template<typename T > | |
T & | property (MPropHandleT< T > _ph) |
Get value for item represented by the handle. | |
template<typename T > | |
const T & | property (MPropHandleT< T > _ph) const |
Get value for item represented by the handle. | |
Low-level adding new items | |
VertexHandle | new_vertex () |
Add a new (default) vertex. More... | |
VertexHandle | new_vertex (const Point &_p) |
Add a new vertex with a given point coordinate. More... | |
VertexHandle | new_vertex (const Vertex &_v) |
Add a new vertex (copied from the given one). More... | |
HalfedgeHandle | new_edge (VertexHandle _start_vertex_handle, VertexHandle _end_vertex_handle) |
Add a new edge from _start_vertex_handle to _end_vertex_handle . More... | |
FaceHandle | new_face () |
Adding a new face. More... | |
FaceHandle | new_face (const Face &_f) |
Adding a new face (copied from a _f ). More... | |
Kernel item iterators | |
KernelVertexIter | vertices_begin () |
Kernel item iterator. More... | |
KernelConstVertexIter | vertices_begin () const |
Kernel item iterator. More... | |
KernelVertexIter | vertices_end () |
Kernel item iterator. More... | |
KernelConstVertexIter | vertices_end () const |
Kernel item iterator. More... | |
KernelEdgeIter | edges_begin () |
Kernel item iterator. More... | |
KernelConstEdgeIter | edges_begin () const |
Kernel item iterator. More... | |
KernelEdgeIter | edges_end () |
Kernel item iterator. More... | |
KernelConstEdgeIter | edges_end () const |
Kernel item iterator. More... | |
KernelFaceIter | faces_begin () |
Kernel item iterator. More... | |
KernelConstFaceIter | faces_begin () const |
Kernel item iterator. More... | |
KernelFaceIter | faces_end () |
Kernel item iterator. More... | |
KernelConstFaceIter | faces_end () const |
Kernel item iterator. More... | |
This class describes the minimum interface a mesh kernel has to implement (because the resulting mesh will rely on this interface).
This is the template class the actually holds the mesh kernel implementation. All functions marked as internal should only be used by the mesh class (that inherits the kernel). The mesh may then provide wrapper functions that provide the same functionality.
void OpenMesh::Concepts::KernelT< FinalMeshItems >::add_property | ( | [VEHFM] PropHandleT< T > & | _ph, |
const std::string & | _name = "" |
||
) |
Add property.
You should not use this function directly.
Instead, use the convenient PropertyManager wrapper and/or one of its helper functions such as makePropertyManagerFromNew, makePropertyManagerFromExisting, or makePropertyManagerFromExistingOrNew.
Adds a property
Depending on the property handle type a vertex, (half-)edge, face or mesh property is added to the mesh. If the action fails the handle is invalid. On success the handle must be used to access the property data with property().
_ph | A property handle defining the data type to bind to mesh. On success the handle is valid else invalid. |
_name | Optional name of property. Following restrictions apply to the name:
|
void OpenMesh::Concepts::KernelT< FinalMeshItems >::clean | ( | ) |
Delete all items, i.e.
clear all item containers. The properties will be kept
void OpenMesh::Concepts::KernelT< FinalMeshItems >::clear | ( | ) |
Delete all items, i.e.
clear all item containers. The properties will also be removed from the mesh
KernelEdgeIter OpenMesh::Concepts::KernelT< FinalMeshItems >::edges_begin | ( | ) |
Kernel item iterator.
KernelConstEdgeIter OpenMesh::Concepts::KernelT< FinalMeshItems >::edges_begin | ( | ) | const |
Kernel item iterator.
KernelEdgeIter OpenMesh::Concepts::KernelT< FinalMeshItems >::edges_end | ( | ) |
Kernel item iterator.
KernelConstEdgeIter OpenMesh::Concepts::KernelT< FinalMeshItems >::edges_end | ( | ) | const |
Kernel item iterator.
FaceHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::face_handle | ( | HalfedgeHandle | _heh | ) | const |
Get the face the halfedge belongs to.
KernelFaceIter OpenMesh::Concepts::KernelT< FinalMeshItems >::faces_begin | ( | ) |
Kernel item iterator.
KernelConstFaceIter OpenMesh::Concepts::KernelT< FinalMeshItems >::faces_begin | ( | ) | const |
Kernel item iterator.
KernelFaceIter OpenMesh::Concepts::KernelT< FinalMeshItems >::faces_end | ( | ) |
Kernel item iterator.
KernelConstFaceIter OpenMesh::Concepts::KernelT< FinalMeshItems >::faces_end | ( | ) | const |
Kernel item iterator.
void OpenMesh::Concepts::KernelT< FinalMeshItems >::garbage_collection | ( | ) |
Remove all items that are marked as deleted from the corresponding containers.
HalfedgeHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_edge | ( | VertexHandle | _start_vertex_handle, |
VertexHandle | _end_vertex_handle | ||
) |
Add a new edge from _start_vertex_handle
to _end_vertex_handle
.
This method should add an edge (i.e. two opposite halfedges) and set the corresponding vertex handles of these halfedges.
FaceHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_face | ( | ) |
Adding a new face.
FaceHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_face | ( | const Face & | _f | ) |
Adding a new face (copied from a _f
).
VertexHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_vertex | ( | ) |
Add a new (default) vertex.
VertexHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_vertex | ( | const Point & | _p | ) |
Add a new vertex with a given point coordinate.
VertexHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::new_vertex | ( | const Vertex & | _v | ) |
Add a new vertex (copied from the given one).
HalfedgeHandle OpenMesh::Concepts::KernelT< FinalMeshItems >::prev_halfedge_handle | ( | HalfedgeHandle | _heh | ) | const |
Get the previous halfedge of the given halfedge.
The implementation should take care of an existing OpenMesh::Attributes::PrevHalfedge attribute.
|
inline |
Remove the last edge imidiately, i.e.
call pop_back() for the EdgeContainer. Used e.g. by the add_face() method of PolyMeshT
|
inline |
Remove the last face imidiately, i.e.
call pop_back() for the FaceContainer. Used e.g. by the add_face() method of PolyMeshT
|
inline |
Remove the last vertex imidiately, i.e.
call pop_back() for the VertexContainer.
void OpenMesh::Concepts::KernelT< FinalMeshItems >::reserve | ( | size_t | _n_vertices, |
size_t | _n_edges, | ||
size_t | _n_faces | ||
) |
Reserve memory for vertices, edges, faces.
Reserve memory for the mesh items vertices, edges, faces. Use this method if you can estimate the memory consumption, for instance in algorithm expanding the mesh. Depending on the underlying array type you might be better of using this method, then letting the array type decide when to increase the capacity. For instance the STL vector class std::vector
(used in the supplied ArrayKernelT) doubles the capacity if it is exhausted. This might lead to an memory allocation exception, though an smaller increment would be enough.
void OpenMesh::Concepts::KernelT< FinalMeshItems >::set_next_halfedge_handle | ( | HalfedgeHandle | _heh, |
HalfedgeHandle | _nheh | ||
) |
Set the next halfedge handle.
KernelVertexIter OpenMesh::Concepts::KernelT< FinalMeshItems >::vertices_begin | ( | ) |
Kernel item iterator.
KernelConstVertexIter OpenMesh::Concepts::KernelT< FinalMeshItems >::vertices_begin | ( | ) | const |
Kernel item iterator.
KernelVertexIter OpenMesh::Concepts::KernelT< FinalMeshItems >::vertices_end | ( | ) |
Kernel item iterator.
KernelConstVertexIter OpenMesh::Concepts::KernelT< FinalMeshItems >::vertices_end | ( | ) | const |
Kernel item iterator.