GitHub link
Polygon Mesh Processing Library
SurfaceMesh Class Reference

A halfedge data structure for polygonal meshes. More...

#include <pmp/SurfaceMesh.h>

Inherited by SurfaceMeshGL.

Classes

class  EdgeContainer
 helper class for iterating through all edges using range-based for-loops. More...
 
class  EdgeIterator
 this class iterates linearly over all edges More...
 
class  FaceAroundVertexCirculator
 this class circulates through all incident faces of a vertex. More...
 
class  FaceContainer
 helper class for iterating through all faces using range-based for-loops. More...
 
class  FaceIterator
 this class iterates linearly over all faces More...
 
class  HalfedgeAroundFaceCirculator
 this class circulates through all halfedges of a face. More...
 
class  HalfedgeAroundVertexCirculator
 this class circulates through all outgoing halfedges of a vertex. More...
 
class  HalfedgeContainer
 helper class for iterating through all halfedges using range-based for-loops. More...
 
class  HalfedgeIterator
 this class iterates linearly over all halfedges More...
 
class  VertexAroundFaceCirculator
 this class circulates through the vertices of a face. More...
 
class  VertexAroundVertexCirculator
 this class circulates through all one-ring neighbors of a vertex. More...
 
class  VertexContainer
 helper class for iterating through all vertices using range-based for-loops. More...
 
class  VertexIterator
 An iterator class to iterate linearly over all vertices. More...
 

Public Member Functions

Construction, destruction, assignment
 SurfaceMesh ()
 default constructor More...
 
virtual ~SurfaceMesh ()
 destructor More...
 
 SurfaceMesh (const SurfaceMesh &rhs)
 copy constructor: copies rhs to *this. More...
 
SurfaceMeshoperator= (const SurfaceMesh &rhs)
 assign rhs to *this. performs a deep copy of all properties. More...
 
SurfaceMeshassign (const SurfaceMesh &rhs)
 assign rhs to *this. does not copy custom properties. More...
 
File IO
void read (const std::string &filename, const IOFlags &flags=IOFlags())
 Read mesh from file filename controlled by flags. More...
 
void write (const std::string &filename, const IOFlags &flags=IOFlags()) const
 Write mesh to file filename controlled by flags. More...
 
Add new elements by hand
Vertex add_vertex (const Point &p)
 add a new vertex with position p More...
 
Face add_face (const std::vector< Vertex > &vertices)
 Add a new face with vertex list vertices. More...
 
Face add_triangle (Vertex v0, Vertex v1, Vertex v2)
 add a new triangle connecting vertices v0, v1, v2 More...
 
Face add_quad (Vertex v0, Vertex v1, Vertex v2, Vertex v3)
 add a new quad connecting vertices v0, v1, v2, v3 More...
 
Memory Management
size_t vertices_size () const
 
size_t halfedges_size () const
 
size_t edges_size () const
 
size_t faces_size () const
 
size_t n_vertices () const
 
size_t n_halfedges () const
 
size_t n_edges () const
 
size_t n_faces () const
 
bool is_empty () const
 
virtual void clear ()
 clear mesh: remove all vertices, edges, faces More...
 
void free_memory ()
 remove unused memory from vectors More...
 
void reserve (size_t nvertices, size_t nedges, size_t nfaces)
 reserve memory (mainly used in file readers) More...
 
void garbage_collection ()
 remove deleted elements More...
 
bool is_deleted (Vertex v) const
 
bool is_deleted (Halfedge h) const
 
bool is_deleted (Edge e) const
 
bool is_deleted (Face f) const
 
bool is_valid (Vertex v) const
 
bool is_valid (Halfedge h) const
 
bool is_valid (Edge e) const
 
bool is_valid (Face f) const
 
Low-level connectivity
Halfedge halfedge (Vertex v) const
 
void set_halfedge (Vertex v, Halfedge h)
 set the outgoing halfedge of vertex v to h More...
 
bool is_boundary (Vertex v) const
 
bool is_isolated (Vertex v) const
 
bool is_manifold (Vertex v) const
 
Vertex to_vertex (Halfedge h) const
 
Vertex from_vertex (Halfedge h) const
 
void set_vertex (Halfedge h, Vertex v)
 sets the vertex the halfedge h points to to v More...
 
Face face (Halfedge h) const
 
void set_face (Halfedge h, Face f)
 sets the incident face to halfedge h to f More...
 
Halfedge next_halfedge (Halfedge h) const
 
void set_next_halfedge (Halfedge h, Halfedge nh)
 sets the next halfedge of h within the face to nh More...
 
void set_prev_halfedge (Halfedge h, Halfedge ph)
 sets the previous halfedge of h and the next halfedge of ph to nh More...
 
Halfedge prev_halfedge (Halfedge h) const
 
Halfedge opposite_halfedge (Halfedge h) const
 
Halfedge ccw_rotated_halfedge (Halfedge h) const
 
Halfedge cw_rotated_halfedge (Halfedge h) const
 
Edge edge (Halfedge h) const
 
bool is_boundary (Halfedge h) const
 
Halfedge halfedge (Edge e, unsigned int i) const
 
Vertex vertex (Edge e, unsigned int i) const
 
Face face (Edge e, unsigned int i) const
 
bool is_boundary (Edge e) const
 
Halfedge halfedge (Face f) const
 
void set_halfedge (Face f, Halfedge h)
 sets the halfedge of face f to h More...
 
bool is_boundary (Face f) const
 
Property handling
template<class T >
ObjectProperty< T > add_object_property (const std::string &name, const T t=T())
 add a object property of type T with name name and default value t. More...
 
template<class T >
ObjectProperty< T > get_object_property (const std::string &name) const
 get the object property named name of type T. More...
 
template<class T >
ObjectProperty< T > object_property (const std::string &name, const T t=T())
 if a object property of type T with name name exists, it is returned. More...
 
template<class T >
void remove_object_property (ObjectProperty< T > &p)
 remove the object property p More...
 
const std::type_info & get_object_property_type (const std::string &name)
 get the type_info T of object property named name. More...
 
std::vector< std::string > object_properties () const
 
template<class T >
VertexProperty< T > add_vertex_property (const std::string &name, const T t=T())
 add a vertex property of type T with name name and default value t. More...
 
template<class T >
VertexProperty< T > get_vertex_property (const std::string &name) const
 get the vertex property named name of type T. More...
 
template<class T >
VertexProperty< T > vertex_property (const std::string &name, const T t=T())
 if a vertex property of type T with name name exists, it is returned. More...
 
template<class T >
void remove_vertex_property (VertexProperty< T > &p)
 remove the vertex property p More...
 
bool has_vertex_property (const std::string &name) const
 does the mesh have a vertex property with name name? More...
 
template<class T >
HalfedgeProperty< T > add_halfedge_property (const std::string &name, const T t=T())
 add a halfedge property of type T with name name and default value t. More...
 
template<class T >
EdgeProperty< T > add_edge_property (const std::string &name, const T t=T())
 add a edge property of type T with name name and default value t. More...
 
template<class T >
HalfedgeProperty< T > get_halfedge_property (const std::string &name) const
 get the halfedge property named name of type T. More...
 
template<class T >
EdgeProperty< T > get_edge_property (const std::string &name) const
 get the edge property named name of type T. More...
 
template<class T >
HalfedgeProperty< T > halfedge_property (const std::string &name, const T t=T())
 if a halfedge property of type T with name name exists, it is returned. More...
 
template<class T >
EdgeProperty< T > edge_property (const std::string &name, const T t=T())
 if an edge property of type T with name name exists, it is returned. More...
 
template<class T >
void remove_halfedge_property (HalfedgeProperty< T > &p)
 remove the halfedge property p More...
 
bool has_halfedge_property (const std::string &name) const
 does the mesh have a halfedge property with name name? More...
 
template<class T >
void remove_edge_property (EdgeProperty< T > &p)
 remove the edge property p More...
 
bool has_edge_property (const std::string &name) const
 does the mesh have an edge property with name name? More...
 
const std::type_info & get_halfedge_property_type (const std::string &name)
 get the type_info T of halfedge property named name. More...
 
const std::type_info & get_vertex_property_type (const std::string &name)
 get the type_info T of vertex property named name. More...
 
const std::type_info & get_edge_property_type (const std::string &name)
 get the type_info T of edge property named name. More...
 
std::vector< std::string > vertex_properties () const
 
std::vector< std::string > halfedge_properties () const
 
std::vector< std::string > edge_properties () const
 
template<class T >
FaceProperty< T > add_face_property (const std::string &name, const T t=T())
 add a face property of type T with name name and default value t. More...
 
template<class T >
FaceProperty< T > get_face_property (const std::string &name) const
 get the face property named name of type T. More...
 
template<class T >
FaceProperty< T > face_property (const std::string &name, const T t=T())
 if a face property of type T with name name exists, it is returned. More...
 
template<class T >
void remove_face_property (FaceProperty< T > &p)
 remove the face property p More...
 
bool has_face_property (const std::string &name) const
 does the mesh have a face property with name name? More...
 
const std::type_info & get_face_property_type (const std::string &name)
 get the type_info T of face property named name . More...
 
std::vector< std::string > face_properties () const
 
void property_stats () const
 prints the names of all properties More...
 
Iterators and circulators
VertexIterator vertices_begin () const
 
VertexIterator vertices_end () const
 
VertexContainer vertices () const
 
HalfedgeIterator halfedges_begin () const
 
HalfedgeIterator halfedges_end () const
 
HalfedgeContainer halfedges () const
 
EdgeIterator edges_begin () const
 
EdgeIterator edges_end () const
 
EdgeContainer edges () const
 
VertexAroundVertexCirculator vertices (Vertex v) const
 
HalfedgeAroundVertexCirculator halfedges (Vertex v) const
 
FaceIterator faces_begin () const
 
FaceIterator faces_end () const
 
FaceContainer faces () const
 
FaceAroundVertexCirculator faces (Vertex v) const
 
VertexAroundFaceCirculator vertices (Face f) const
 
HalfedgeAroundFaceCirculator halfedges (Face f) const
 
Higher-level Topological Operations
Halfedge insert_vertex (Edge e, const Point &p)
 Subdivide the edge e = (v0,v1) by splitting it into the two edge (v0,p) and (p,v1). More...
 
Halfedge insert_vertex (Edge e, Vertex v)
 Subdivide the edge e = (v0,v1) by splitting it into the two edge (v0,v) and (v,v1). More...
 
Halfedge insert_vertex (Halfedge h0, Vertex v)
 Subdivide the halfedge h = (v0,v1) by splitting it into the two halfedges (v0,v) and (v,v1). More...
 
Halfedge find_halfedge (Vertex start, Vertex end) const
 find the halfedge from start to end More...
 
Edge find_edge (Vertex a, Vertex b) const
 find the edge (a,b) More...
 
bool is_triangle_mesh () const
 
bool is_quad_mesh () const
 
bool is_collapse_ok (Halfedge v0v1)
 
void collapse (Halfedge h)
 Collapse the halfedge h by moving its start vertex into its target vertex. More...
 
bool is_removal_ok (Edge e)
 
bool remove_edge (Edge e)
 Remove edge and merge its two incident faces into one. More...
 
Vertex split (Face f, const Point &p)
 Split the face f by first adding point p to the mesh and then inserting edges between p and the vertices of f. More...
 
void split (Face f, Vertex v)
 Split the face f by inserting edges between v and the vertices of f. More...
 
Halfedge split (Edge e, const Point &p)
 Split the edge e by first adding point p to the mesh and then connecting it to the two vertices of the adjacent triangles that are opposite to edge e. More...
 
Halfedge split (Edge e, Vertex v)
 Split the edge e by connecting vertex v it to the two vertices of the adjacent triangles that are opposite to edge e. More...
 
Halfedge insert_edge (Halfedge h0, Halfedge h1)
 insert edge between the to-vertices v0 of h0 and v1 of h1. More...
 
bool is_flip_ok (Edge e) const
 Check whether flipping edge e is topologically. More...
 
void flip (Edge e)
 Flip the edge e . More...
 
size_t valence (Vertex v) const
 
size_t valence (Face f) const
 
void delete_vertex (Vertex v)
 deletes the vertex v from the mesh More...
 
void delete_edge (Edge e)
 deletes the edge e from the mesh More...
 
void delete_face (Face f)
 deletes the face f from the mesh More...
 
Geometry-related Functions
const Pointposition (Vertex v) const
 position of a vertex (read only) More...
 
Pointposition (Vertex v)
 position of a vertex More...
 
std::vector< Point > & positions ()
 
BoundingBox bounds () const
 compute the bounding box of the object More...
 
Scalar edge_length (Edge e) const
 compute the length of edge e. More...
 
Allocate new elements
Vertex new_vertex ()
 Allocate a new vertex, resize vertex properties accordingly. More...
 
Halfedge new_edge ()
 Allocate a new edge, resize edge and halfedge properties accordingly. More...
 
Halfedge new_edge (Vertex start, Vertex end)
 Allocate a new edge, resize edge and halfedge properties accordingly. More...
 
Face new_face ()
 Allocate a new face, resize face properties accordingly. More...
 

Detailed Description

A halfedge data structure for polygonal meshes.

Constructor & Destructor Documentation

◆ SurfaceMesh() [1/2]

default constructor

◆ ~SurfaceMesh()

~SurfaceMesh ( )
virtualdefault

destructor

◆ SurfaceMesh() [2/2]

SurfaceMesh ( const SurfaceMesh rhs)
inline

copy constructor: copies rhs to *this.

performs a deep copy of all properties.

Member Function Documentation

◆ add_edge_property()

EdgeProperty< T > add_edge_property ( const std::string &  name,
const T  t = T() 
)
inline

add a edge property of type T with name name and default value t.

fails if a property named name exists already, since the name has to be unique. in this case it returns an invalid property.

◆ add_face()

Face add_face ( const std::vector< Vertex > &  vertices)

Add a new face with vertex list vertices.

Exceptions
TopologyExceptionin case a topological error occurs.
See also
add_triangle, add_quad

◆ add_face_property()

FaceProperty< T > add_face_property ( const std::string &  name,
const T  t = T() 
)
inline

add a face property of type T with name name and default value t.

fails if a property named name exists already, since the name has to be unique. in this case it returns an invalid property

◆ add_halfedge_property()

HalfedgeProperty< T > add_halfedge_property ( const std::string &  name,
const T  t = T() 
)
inline

add a halfedge property of type T with name name and default value t.

fails if a property named name exists already, since the name has to be unique. in this case it returns an invalid property.

◆ add_object_property()

ObjectProperty< T > add_object_property ( const std::string &  name,
const T  t = T() 
)
inline

add a object property of type T with name name and default value t.

fails if a property named name exists already, since the name has to be unique. in this case it returns an invalid property

◆ add_quad()

Face add_quad ( Vertex  v0,
Vertex  v1,
Vertex  v2,
Vertex  v3 
)

add a new quad connecting vertices v0, v1, v2, v3

See also
add_triangle, add_face

◆ add_triangle()

Face add_triangle ( Vertex  v0,
Vertex  v1,
Vertex  v2 
)

add a new triangle connecting vertices v0, v1, v2

See also
add_face, add_quad

◆ add_vertex()

Vertex add_vertex ( const Point p)

add a new vertex with position p

◆ add_vertex_property()

VertexProperty< T > add_vertex_property ( const std::string &  name,
const T  t = T() 
)
inline

add a vertex property of type T with name name and default value t.

fails if a property named name exists already, since the name has to be unique. in this case it returns an invalid property

◆ assign()

SurfaceMesh & assign ( const SurfaceMesh rhs)

assign rhs to *this. does not copy custom properties.

◆ bounds()

BoundingBox bounds ( ) const
inline

compute the bounding box of the object

◆ ccw_rotated_halfedge()

Halfedge ccw_rotated_halfedge ( Halfedge  h) const
inline
Returns
the halfedge that is rotated counter-clockwise around the start vertex of h. it is the opposite halfedge of the previous halfedge of h.

◆ clear()

void clear ( )
virtual

clear mesh: remove all vertices, edges, faces

Reimplemented in SurfaceMeshGL.

◆ collapse()

void collapse ( Halfedge  h)

Collapse the halfedge h by moving its start vertex into its target vertex.

For non-boundary halfedges this function removes one vertex, three edges, and two faces. For boundary halfedges it removes one vertex, two edges and one face.

Attention
This function is only valid for triangle meshes.
Halfedge collapses might lead to invalid faces. Call is_collapse_ok(Halfedge) to be sure the collapse is legal.
The removed items are only marked as deleted. You have to call garbage_collection() to finally remove them.

◆ cw_rotated_halfedge()

Halfedge cw_rotated_halfedge ( Halfedge  h) const
inline
Returns
the halfedge that is rotated clockwise around the start vertex of h. it is the next halfedge of the opposite halfedge of h.

◆ delete_edge()

void delete_edge ( Edge  e)

deletes the edge e from the mesh

◆ delete_face()

void delete_face ( Face  f)

deletes the face f from the mesh

◆ delete_vertex()

void delete_vertex ( Vertex  v)

deletes the vertex v from the mesh

◆ edge()

Edge edge ( Halfedge  h) const
inline
Returns
the edge that contains halfedge h as one of its two halfedges.

◆ edge_length()

Scalar edge_length ( Edge  e) const
inline

compute the length of edge e.

◆ edge_properties()

std::vector< std::string > edge_properties ( ) const
inline
Returns
the names of all edge properties

◆ edge_property()

EdgeProperty< T > edge_property ( const std::string &  name,
const T  t = T() 
)
inline

if an edge property of type T with name name exists, it is returned.

otherwise this property is added (with default value t)

◆ edges()

EdgeContainer edges ( ) const
inline
Returns
edge container for C++11 range-based for-loops

◆ edges_begin()

EdgeIterator edges_begin ( ) const
inline
Returns
start iterator for edges

◆ edges_end()

EdgeIterator edges_end ( ) const
inline
Returns
end iterator for edges

◆ edges_size()

size_t edges_size ( ) const
inline
Returns
number of (deleted and valid) edges in the mesh

◆ face() [1/2]

Face face ( Edge  e,
unsigned int  i 
) const
inline
Returns
the face incident to the i'th halfedge of edge e. i has to be 0 or 1.

◆ face() [2/2]

Face face ( Halfedge  h) const
inline
Returns
the face incident to halfedge h

◆ face_properties()

std::vector< std::string > face_properties ( ) const
inline
Returns
the names of all face properties

◆ face_property()

FaceProperty< T > face_property ( const std::string &  name,
const T  t = T() 
)
inline

if a face property of type T with name name exists, it is returned.

otherwise this property is added (with default value t)

◆ faces() [1/2]

FaceContainer faces ( ) const
inline
Returns
face container for C++11 range-based for-loops

◆ faces() [2/2]

FaceAroundVertexCirculator faces ( Vertex  v) const
inline
Returns
circulator for faces around vertex v

◆ faces_begin()

FaceIterator faces_begin ( ) const
inline
Returns
start iterator for faces

◆ faces_end()

FaceIterator faces_end ( ) const
inline
Returns
end iterator for faces

◆ faces_size()

size_t faces_size ( ) const
inline
Returns
number of (deleted and valid) faces in the mesh

◆ find_edge()

Edge find_edge ( Vertex  a,
Vertex  b 
) const

find the edge (a,b)

◆ find_halfedge()

Halfedge find_halfedge ( Vertex  start,
Vertex  end 
) const

find the halfedge from start to end

◆ flip()

void flip ( Edge  e)

Flip the edge e .

Removes the edge e and add an edge between the two vertices opposite to edge e of the two incident triangles.

Attention
This function is only valid for triangle meshes.
Flipping an edge may result in a non-manifold mesh, hence check for yourself whether this operation is allowed or not!
See also
is_flip_ok()

◆ free_memory()

void free_memory ( )

remove unused memory from vectors

◆ from_vertex()

Vertex from_vertex ( Halfedge  h) const
inline
Returns
the vertex the halfedge h emanates from

◆ garbage_collection()

void garbage_collection ( )

remove deleted elements

◆ get_edge_property()

EdgeProperty< T > get_edge_property ( const std::string &  name) const
inline

get the edge property named name of type T.

returns an invalid VertexProperty if the property does not exist or if the type does not match.

◆ get_edge_property_type()

const std::type_info & get_edge_property_type ( const std::string &  name)
inline

get the type_info T of edge property named name.

returns an typeid(void) if the property does not exist or if the type does not match.

◆ get_face_property()

FaceProperty< T > get_face_property ( const std::string &  name) const
inline

get the face property named name of type T.

returns an invalid VertexProperty if the property does not exist or if the type does not match.

◆ get_face_property_type()

const std::type_info & get_face_property_type ( const std::string &  name)
inline

get the type_info T of face property named name .

returns an typeid(void) if the property does not exist or if the type does not match.

◆ get_halfedge_property()

HalfedgeProperty< T > get_halfedge_property ( const std::string &  name) const
inline

get the halfedge property named name of type T.

returns an invalid VertexProperty if the property does not exist or if the type does not match.

◆ get_halfedge_property_type()

const std::type_info & get_halfedge_property_type ( const std::string &  name)
inline

get the type_info T of halfedge property named name.

returns an typeid(void) if the property does not exist or if the type does not match.

◆ get_object_property()

ObjectProperty< T > get_object_property ( const std::string &  name) const
inline

get the object property named name of type T.

returns an invalid ObjectProperty if the property does not exist or if the type does not match.

◆ get_object_property_type()

const std::type_info & get_object_property_type ( const std::string &  name)
inline

get the type_info T of object property named name.

returns an typeid(void) if the property does not exist or if the type does not match.

◆ get_vertex_property()

VertexProperty< T > get_vertex_property ( const std::string &  name) const
inline

get the vertex property named name of type T.

returns an invalid VertexProperty if the property does not exist or if the type does not match.

◆ get_vertex_property_type()

const std::type_info & get_vertex_property_type ( const std::string &  name)
inline

get the type_info T of vertex property named name.

returns an typeid(void) if the property does not exist or if the type does not match.

◆ halfedge() [1/3]

Halfedge halfedge ( Edge  e,
unsigned int  i 
) const
inline
Returns
the i'th halfedge of edge e. i has to be 0 or 1.

◆ halfedge() [2/3]

Halfedge halfedge ( Face  f) const
inline
Returns
a halfedge of face f

◆ halfedge() [3/3]

Halfedge halfedge ( Vertex  v) const
inline
Returns
an outgoing halfedge of vertex v. if v is a boundary vertex this will be a boundary halfedge.

◆ halfedge_properties()

std::vector< std::string > halfedge_properties ( ) const
inline
Returns
the names of all halfedge properties

◆ halfedge_property()

HalfedgeProperty< T > halfedge_property ( const std::string &  name,
const T  t = T() 
)
inline

if a halfedge property of type T with name name exists, it is returned.

otherwise this property is added (with default value t)

◆ halfedges() [1/3]

HalfedgeContainer halfedges ( ) const
inline
Returns
halfedge container for C++11 range-based for-loops

◆ halfedges() [2/3]

HalfedgeAroundFaceCirculator halfedges ( Face  f) const
inline
Returns
circulator for halfedges of face f

◆ halfedges() [3/3]

HalfedgeAroundVertexCirculator halfedges ( Vertex  v) const
inline
Returns
circulator for outgoing halfedges around vertex v

◆ halfedges_begin()

HalfedgeIterator halfedges_begin ( ) const
inline
Returns
start iterator for halfedges

◆ halfedges_end()

HalfedgeIterator halfedges_end ( ) const
inline
Returns
end iterator for halfedges

◆ halfedges_size()

size_t halfedges_size ( ) const
inline
Returns
number of (deleted and valid) halfedges in the mesh

◆ has_edge_property()

bool has_edge_property ( const std::string &  name) const
inline

does the mesh have an edge property with name name?

◆ has_face_property()

bool has_face_property ( const std::string &  name) const
inline

does the mesh have a face property with name name?

◆ has_halfedge_property()

bool has_halfedge_property ( const std::string &  name) const
inline

does the mesh have a halfedge property with name name?

◆ has_vertex_property()

bool has_vertex_property ( const std::string &  name) const
inline

does the mesh have a vertex property with name name?

◆ insert_edge()

Halfedge insert_edge ( Halfedge  h0,
Halfedge  h1 
)

insert edge between the to-vertices v0 of h0 and v1 of h1.

Returns
the new halfedge from v0 to v1.
Attention
h0 and h1 have to belong to the same face

◆ insert_vertex() [1/3]

Halfedge insert_vertex ( Edge  e,
const Point p 
)
inline

Subdivide the edge e = (v0,v1) by splitting it into the two edge (v0,p) and (p,v1).

Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns halfedge that points to p.

See also
insert_vertex(Edge, Vertex)
insert_vertex(Halfedge, Vertex)

◆ insert_vertex() [2/3]

Halfedge insert_vertex ( Edge  e,
Vertex  v 
)
inline

Subdivide the edge e = (v0,v1) by splitting it into the two edge (v0,v) and (v,v1).

Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns halfedge that points to p.

See also
insert_vertex(Edge, Point)
insert_vertex(Halfedge, Vertex)

◆ insert_vertex() [3/3]

Halfedge insert_vertex ( Halfedge  h0,
Vertex  v 
)

Subdivide the halfedge h = (v0,v1) by splitting it into the two halfedges (v0,v) and (v,v1).

Note that this function does not introduce any other edge or faces. It simply splits the edge. Returns the halfedge that points from v1 to v.

See also
insert_vertex(Edge, Point)
insert_vertex(Edge, Vertex)

◆ is_boundary() [1/4]

bool is_boundary ( Edge  e) const
inline
Returns
whether e is a boundary edge, i.e., if one of its halfedges is a boundary halfedge.

◆ is_boundary() [2/4]

bool is_boundary ( Face  f) const
inline
Returns
whether f is a boundary face, i.e., it one of its edges is a boundary edge.

◆ is_boundary() [3/4]

bool is_boundary ( Halfedge  h) const
inline
Returns
whether h is a boundary halfedge, i.e., if its face does not exist.

◆ is_boundary() [4/4]

bool is_boundary ( Vertex  v) const
inline
Returns
whether v is a boundary vertex

◆ is_collapse_ok()

bool is_collapse_ok ( Halfedge  v0v1)
Returns
whether collapsing the halfedge v0v1 is topologically legal.
Attention
This function is only valid for triangle meshes.

◆ is_deleted() [1/4]

bool is_deleted ( Edge  e) const
inline
Returns
whether edge e is deleted
See also
garbage_collection()

◆ is_deleted() [2/4]

bool is_deleted ( Face  f) const
inline
Returns
whether face f is deleted
See also
garbage_collection()

◆ is_deleted() [3/4]

bool is_deleted ( Halfedge  h) const
inline
Returns
whether halfedge h is deleted
See also
garbage_collection()

◆ is_deleted() [4/4]

bool is_deleted ( Vertex  v) const
inline
Returns
whether vertex v is deleted
See also
garbage_collection()

◆ is_empty()

bool is_empty ( ) const
inline
Returns
true if the mesh is empty, i.e., has no vertices

◆ is_flip_ok()

bool is_flip_ok ( Edge  e) const

Check whether flipping edge e is topologically.

Attention
This function is only valid for triangle meshes.
See also
flip(Edge)

◆ is_isolated()

bool is_isolated ( Vertex  v) const
inline
Returns
whether v is isolated, i.e., not incident to any edge

◆ is_manifold()

bool is_manifold ( Vertex  v) const
inline
Returns
whether v is a manifold vertex (not incident to several patches)

◆ is_quad_mesh()

bool is_quad_mesh ( ) const
Returns
whether the mesh a quad mesh. this function simply tests each face, and therefore is not very efficient.

◆ is_removal_ok()

bool is_removal_ok ( Edge  e)
Returns
whether removing the edge e is topologically legal.

◆ is_triangle_mesh()

bool is_triangle_mesh ( ) const
Returns
whether the mesh a triangle mesh. this function simply tests each face, and therefore is not very efficient.

◆ is_valid() [1/4]

bool is_valid ( Edge  e) const
inline
Returns
whether edge e is valid.

◆ is_valid() [2/4]

bool is_valid ( Face  f) const
inline
Returns
whether the face f is valid.

◆ is_valid() [3/4]

bool is_valid ( Halfedge  h) const
inline
Returns
whether halfedge h is valid.

◆ is_valid() [4/4]

bool is_valid ( Vertex  v) const
inline
Returns
whether vertex v is valid.

◆ n_edges()

size_t n_edges ( ) const
inline
Returns
number of edges in the mesh

◆ n_faces()

size_t n_faces ( ) const
inline
Returns
number of faces in the mesh

◆ n_halfedges()

size_t n_halfedges ( ) const
inline
Returns
number of halfedge in the mesh

◆ n_vertices()

size_t n_vertices ( ) const
inline
Returns
number of vertices in the mesh

◆ new_edge() [1/2]

Halfedge new_edge ( )
inline

Allocate a new edge, resize edge and halfedge properties accordingly.

Exceptions
AllocationExceptionin case of failure to allocate a new edge.

◆ new_edge() [2/2]

Halfedge new_edge ( Vertex  start,
Vertex  end 
)
inline

Allocate a new edge, resize edge and halfedge properties accordingly.

Exceptions
AllocationExceptionin case of failure to allocate a new edge.
Parameters
startstarting Vertex of the new edge
endend Vertex of the new edge

◆ new_face()

Face new_face ( )
inline

Allocate a new face, resize face properties accordingly.

Exceptions
AllocationExceptionin case of failure to allocate a new face.

◆ new_vertex()

Vertex new_vertex ( )
inline

Allocate a new vertex, resize vertex properties accordingly.

Exceptions
AllocationExceptionin case of failure to allocate a new vertex.

◆ next_halfedge()

Halfedge next_halfedge ( Halfedge  h) const
inline
Returns
the next halfedge within the incident face

◆ object_properties()

std::vector< std::string > object_properties ( ) const
inline
Returns
the names of all object properties

◆ object_property()

ObjectProperty< T > object_property ( const std::string &  name,
const T  t = T() 
)
inline

if a object property of type T with name name exists, it is returned.

otherwise this property is added (with default value t)

◆ operator=()

SurfaceMesh & operator= ( const SurfaceMesh rhs)

assign rhs to *this. performs a deep copy of all properties.

◆ opposite_halfedge()

Halfedge opposite_halfedge ( Halfedge  h) const
inline
Returns
the opposite halfedge of h

◆ position() [1/2]

Point & position ( Vertex  v)
inline

position of a vertex

◆ position() [2/2]

const Point & position ( Vertex  v) const
inline

position of a vertex (read only)

◆ positions()

std::vector< Point > & positions ( )
inline
Returns
vector of point positions

◆ prev_halfedge()

Halfedge prev_halfedge ( Halfedge  h) const
inline
Returns
the previous halfedge within the incident face

◆ property_stats()

void property_stats ( ) const

prints the names of all properties

◆ read()

void read ( const std::string &  filename,
const IOFlags flags = IOFlags() 
)

Read mesh from file filename controlled by flags.

File extension determines file type. Supported formats and vertex attributes (a=ASCII, b=binary):

Format ASCII Binary Normals Colors Texcoords
OFF yes yes a / b a a / b
OBJ yes no a no no
STL yes yes no no no
PLY yes yes no no no
PMP no yes no no no
XYZ yes no a no no
AGI yes no a a no

In addition, the OBJ and PMP formats support reading per-halfedge texture coordinates.

◆ remove_edge()

bool remove_edge ( Edge  e)

Remove edge and merge its two incident faces into one.

This operation requires that the edge has two incident faces and that these two are not equal.

See also
is_removal_ok(Edge)

◆ remove_edge_property()

void remove_edge_property ( EdgeProperty< T > &  p)
inline

remove the edge property p

◆ remove_face_property()

void remove_face_property ( FaceProperty< T > &  p)
inline

remove the face property p

◆ remove_halfedge_property()

void remove_halfedge_property ( HalfedgeProperty< T > &  p)
inline

remove the halfedge property p

◆ remove_object_property()

void remove_object_property ( ObjectProperty< T > &  p)
inline

remove the object property p

◆ remove_vertex_property()

void remove_vertex_property ( VertexProperty< T > &  p)
inline

remove the vertex property p

◆ reserve()

void reserve ( size_t  nvertices,
size_t  nedges,
size_t  nfaces 
)

reserve memory (mainly used in file readers)

◆ set_face()

void set_face ( Halfedge  h,
Face  f 
)
inline

sets the incident face to halfedge h to f

◆ set_halfedge() [1/2]

void set_halfedge ( Face  f,
Halfedge  h 
)
inline

sets the halfedge of face f to h

◆ set_halfedge() [2/2]

void set_halfedge ( Vertex  v,
Halfedge  h 
)
inline

set the outgoing halfedge of vertex v to h

◆ set_next_halfedge()

void set_next_halfedge ( Halfedge  h,
Halfedge  nh 
)
inline

sets the next halfedge of h within the face to nh

◆ set_prev_halfedge()

void set_prev_halfedge ( Halfedge  h,
Halfedge  ph 
)
inline

sets the previous halfedge of h and the next halfedge of ph to nh

◆ set_vertex()

void set_vertex ( Halfedge  h,
Vertex  v 
)
inline

sets the vertex the halfedge h points to to v

◆ split() [1/4]

Halfedge split ( Edge  e,
const Point p 
)
inline

Split the edge e by first adding point p to the mesh and then connecting it to the two vertices of the adjacent triangles that are opposite to edge e.

Returns the halfedge pointing to p that is created by splitting the existing edge e.

Attention
This function is only valid for triangle meshes.
See also
split(Edge, Vertex)

◆ split() [2/4]

Halfedge split ( Edge  e,
Vertex  v 
)

Split the edge e by connecting vertex v it to the two vertices of the adjacent triangles that are opposite to edge e.

Returns the halfedge pointing to v that is created by splitting the existing edge e.

Attention
This function is only valid for triangle meshes.
See also
split(Edge, Point)

◆ split() [3/4]

Vertex split ( Face  f,
const Point p 
)
inline

Split the face f by first adding point p to the mesh and then inserting edges between p and the vertices of f.

For a triangle this is a standard one-to-three split.

See also
split(Face, Vertex)

◆ split() [4/4]

void split ( Face  f,
Vertex  v 
)

Split the face f by inserting edges between v and the vertices of f.

For a triangle this is a standard one-to-three split.

See also
split(Face, const Point&)

◆ to_vertex()

Vertex to_vertex ( Halfedge  h) const
inline
Returns
the vertex the halfedge h points to

◆ valence() [1/2]

size_t valence ( Face  f) const
Returns
the valence of face f (its number of vertices)

◆ valence() [2/2]

size_t valence ( Vertex  v) const
Returns
the valence (number of incident edges or neighboring vertices) of vertex v.

◆ vertex()

Vertex vertex ( Edge  e,
unsigned int  i 
) const
inline
Returns
the i'th vertex of edge e. i has to be 0 or 1.

◆ vertex_properties()

std::vector< std::string > vertex_properties ( ) const
inline
Returns
the names of all vertex properties

◆ vertex_property()

VertexProperty< T > vertex_property ( const std::string &  name,
const T  t = T() 
)
inline

if a vertex property of type T with name name exists, it is returned.

otherwise this property is added (with default value t)

◆ vertices() [1/3]

VertexContainer vertices ( ) const
inline
Returns
vertex container for C++11 range-based for-loops

◆ vertices() [2/3]

VertexAroundFaceCirculator vertices ( Face  f) const
inline
Returns
circulator for vertices of face f

◆ vertices() [3/3]

VertexAroundVertexCirculator vertices ( Vertex  v) const
inline
Returns
circulator for vertices around vertex v

◆ vertices_begin()

VertexIterator vertices_begin ( ) const
inline
Returns
start iterator for vertices

◆ vertices_end()

VertexIterator vertices_end ( ) const
inline
Returns
end iterator for vertices

◆ vertices_size()

size_t vertices_size ( ) const
inline
Returns
number of (deleted and valid) vertices in the mesh

◆ write()

void write ( const std::string &  filename,
const IOFlags flags = IOFlags() 
) const

Write mesh to file filename controlled by flags.

File extension determines file type. Supported formats and vertex attributes (a=ASCII, b=binary):

Format ASCII Binary Normals Colors Texcoords
OFF yes yes a a a
OBJ yes no a no no
STL yes no no no no
PLY yes yes no no no
PMP no yes no no no
XYZ yes no a no no

In addition, the OBJ and PMP formats support writing per-halfedge texture coordinates.