Easy3D 2.5.3
SurfaceMesh Class Reference

A halfedge data structure for polygonal meshes of 2-manifold. More...

#include <easy3d/core/surface_mesh.h>

Inheritance diagram for SurfaceMesh:
Model

Classes

class  BaseHandle
 
struct  Edge
 
class  EdgeContainer
 
class  EdgeIterator
 
class  EdgeProperty
 
struct  Face
 
class  FaceAroundVertexCirculator
 
struct  FaceConnectivity
 
class  FaceContainer
 
class  FaceIterator
 
class  FaceProperty
 
struct  Halfedge
 
class  HalfedgeAroundFaceCirculator
 
class  HalfedgeAroundVertexCirculator
 
struct  HalfedgeConnectivity
 
class  HalfedgeContainer
 
class  HalfedgeIterator
 
class  HalfedgeProperty
 
class  ModelProperty
 
struct  Vertex
 
class  VertexAroundFaceCirculator
 
class  VertexAroundVertexCirculator
 
struct  VertexConnectivity
 
class  VertexContainer
 
class  VertexIterator
 
class  VertexProperty
 

Public Member Functions

Construct, destruct, assignment
 SurfaceMesh ()
 default constructor
 
 ~SurfaceMesh () override=default
 destructor (is virtual, since we inherit from Geometry_representation)
 
 SurfaceMesh (const SurfaceMesh &rhs)
 copy constructor: copies rhs to *this. performs a deep copy of all properties.
 
SurfaceMeshoperator= (const SurfaceMesh &rhs)
 assign rhs to *this. performs a deep copy of all properties.
 
SurfaceMeshoperator+= (const SurfaceMesh &other)
 Merges another surface mesh into the current one. Shifts the indices of vertices of the other mesh by number_of_vertices() + number_of_removed_vertices() and analogously for halfedges, edges, and faces. Copies entries of all property maps which have the same name in both meshes. That is, properties maps which are only in other are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both meshes.
 
SurfaceMeshjoin (const SurfaceMesh &other)
 Merges another surface mesh into the current one. Shifts the indices of vertices of the other mesh by number_of_vertices() + number_of_removed_vertices() and analogously for halfedges, edges, and faces. Copies entries of all property maps which have the same name in both meshes. That is, properties maps which are only in other are ignored. Also copies elements which are marked as removed, and concatenates the freelists of both meshes.
 
SurfaceMeshassign (const SurfaceMesh &rhs)
 assign rhs to *this. does not copy custom properties.
 
File IO
bool read (const std::string &filename)
 Read mesh from a SM file filename. Mainly for quick debug purposes. Client code should use SurfaceMeshIO. More...
 
bool write (const std::string &filename) const
 Write mesh to a SM file filename. Mainly for quick debug purposes. Client code should use SurfaceMeshIO. More...
 
Add new elements by hand
Vertex add_vertex (const vec3 &p)
 add a new vertex with position p
 
Face add_face (const std::vector< Vertex > &vertices)
 
Face add_triangle (Vertex v1, Vertex v2, Vertex v3)
 
Face add_quad (Vertex v1, Vertex v2, Vertex v3, Vertex v4)
 
Memory Management
unsigned int vertices_size () const
 returns number of (deleted and valid) vertices in the mesh
 
unsigned int halfedges_size () const
 returns number of (deleted and valid)halfedge in the mesh
 
unsigned int edges_size () const
 returns number of (deleted and valid)edges in the mesh
 
unsigned int faces_size () const
 returns number of (deleted and valid)faces in the mesh
 
unsigned int n_vertices () const
 returns number of vertices in the mesh
 
unsigned int n_halfedges () const
 returns number of halfedge in the mesh
 
unsigned int n_edges () const
 returns number of edges in the mesh
 
unsigned int n_faces () const
 returns number of faces in the mesh
 
void clear ()
 Removes all vertices, edges, faces, and properties (and resets garbage state). More...
 
void reserve (unsigned int nvertices, unsigned int nedges, unsigned int nfaces)
 reserves memory (mainly used in file readers)
 
void resize (unsigned int nv, unsigned int ne, unsigned int nf)
 
bool has_garbage () const
 are there deleted vertices, edges or faces?
 
void collect_garbage ()
 remove deleted vertices/edges/faces
 
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
 return whether vertex v is valid, i.e. the index is stores it within the array bounds.
 
bool is_valid (Halfedge h) const
 return whether halfedge h is valid, i.e. the index is stores it within the array bounds.
 
bool is_valid (Edge e) const
 return whether edge e is valid, i.e. the index is stores it within the array bounds.
 
bool is_valid (Face f) const
 return whether face f is valid, i.e. the index is stores it within the array bounds.
 
Low-level connectivity
Halfedge out_halfedge (Vertex v) const
 
void set_out_halfedge (Vertex v, Halfedge h)
 set the outgoing halfedge of vertex v to h
 
bool is_border (Vertex v) const
 returns whether v is a boundary vertex
 
bool is_isolated (Vertex v) const
 returns whether v is isolated, i.e., not incident to any face
 
bool is_manifold (Vertex v) const
 returns whether v is a manifold vertex (not incident to several patches)
 
bool is_degenerate (Face f) const
 returns whether f is degenerate
 
Vertex target (Halfedge h) const
 returns the vertex the halfedge h points to
 
Vertex source (Halfedge h) const
 returns the vertex the halfedge h emanates from
 
void set_target (Halfedge h, Vertex v)
 sets the vertex the halfedge h points to to v
 
Face face (Halfedge h) const
 returns the face incident to halfedge h
 
void set_face (Halfedge h, Face f)
 sets the incident face to halfedge h to f
 
Halfedge next (Halfedge h) const
 returns the next halfedge within the incident face
 
void set_next (Halfedge h, Halfedge nh)
 sets the next halfedge of h within the face to nh
 
Halfedge prev (Halfedge h) const
 returns the previous halfedge within the incident face
 
Halfedge opposite (Halfedge h) const
 returns the opposite halfedge of h
 
Halfedge prev_around_source (Halfedge h) const
 
Halfedge next_around_source (Halfedge h) const
 
Halfedge prev_around_target (Halfedge h) const
 
Halfedge next_around_target (Halfedge h) const
 
Edge edge (Halfedge h) const
 return the edge that contains halfedge h as one of its two halfedges.
 
bool is_border (Halfedge h) const
 returns whether h is a boundary halfedge, i.e., if its face does not exist.
 
Halfedge halfedge (Edge e, unsigned int i) const
 returns the i'th halfedge of edge e. i has to be 0 or 1.
 
Vertex vertex (Edge e, unsigned int i) const
 returns the i'th vertex of edge e. i has to be 0 or 1.
 
Face face (Edge e, unsigned int i) const
 returns the face incident to the i'th halfedge of edge e. i has to be 0 or 1.
 
bool is_border (Edge e) const
 
Halfedge halfedge (Face f) const
 returns a halfedge of face f
 
void set_halfedge (Face f, Halfedge h)
 sets the halfedge of face f to h
 
bool is_border (Face f) const
 returns whether f is a boundary face, i.e., it one of its edges is a boundary edge.
 
Property handling
template<class T >
VertexProperty< T > add_vertex_property (const std::string &name, const T t=T())
 
template<class T >
HalfedgeProperty< T > add_halfedge_property (const std::string &name, const T t=T())
 
template<class T >
EdgeProperty< T > add_edge_property (const std::string &name, const T t=T())
 
template<class T >
FaceProperty< T > add_face_property (const std::string &name, const T t=T())
 
template<class T >
ModelProperty< T > add_model_property (const std::string &name, const T t=T())
 Adds a model 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
 
template<class T >
HalfedgeProperty< T > get_halfedge_property (const std::string &name) const
 
template<class T >
EdgeProperty< T > get_edge_property (const std::string &name) const
 
template<class T >
FaceProperty< T > get_face_property (const std::string &name) const
 
template<class T >
ModelProperty< T > get_model_property (const std::string &name) const
 Gets the model property named name of type T. More...
 
template<class T >
VertexProperty< T > vertex_property (const std::string &name, const T t=T())
 
template<class T >
HalfedgeProperty< T > halfedge_property (const std::string &name, const T t=T())
 
template<class T >
EdgeProperty< T > edge_property (const std::string &name, const T t=T())
 
template<class T >
FaceProperty< T > face_property (const std::string &name, const T t=T())
 
template<class T >
ModelProperty< T > model_property (const std::string &name, const T t=T())
 
template<class T >
bool remove_vertex_property (VertexProperty< T > &p)
 remove the vertex property p
 
bool remove_vertex_property (const std::string &n)
 remove the vertex property named n
 
template<class T >
bool remove_halfedge_property (HalfedgeProperty< T > &p)
 remove the halfedge property p
 
bool remove_halfedge_property (const std::string &n)
 remove the halfedge property named n
 
template<class T >
bool remove_edge_property (EdgeProperty< T > &p)
 remove the edge property p
 
bool remove_edge_property (const std::string &n)
 remove the edge property named n
 
template<class T >
bool remove_face_property (FaceProperty< T > &p)
 remove the face property p
 
bool remove_face_property (const std::string &n)
 remove the face property named n
 
template<class T >
bool remove_model_property (ModelProperty< T > &p)
 remove the model property p
 
bool remove_model_property (const std::string &n)
 remove the model property named n
 
bool rename_vertex_property (const std::string &old_name, const std::string &new_name)
 rename a vertex property given its name
 
bool rename_face_property (const std::string &old_name, const std::string &new_name)
 rename a face property given its name
 
bool rename_edge_property (const std::string &old_name, const std::string &new_name)
 rename an edge property given its name
 
bool rename_halfedge_property (const std::string &old_name, const std::string &new_name)
 rename a halfedge property given its name
 
bool rename_model_property (const std::string &old_name, const std::string &new_name)
 rename a model property given its name
 
const std::type_info & get_vertex_property_type (const std::string &name) const
 
const std::type_info & get_halfedge_property_type (const std::string &name) const
 
const std::type_info & get_edge_property_type (const std::string &name) const
 
const std::type_info & get_face_property_type (const std::string &name) const
 
const std::type_info & get_model_property_type (const std::string &name) const
 
std::vector< std::string > vertex_properties () const
 returns the names of all vertex properties
 
std::vector< std::string > halfedge_properties () const
 returns the names of all halfedge properties
 
std::vector< std::string > edge_properties () const
 returns the names of all edge properties
 
std::vector< std::string > face_properties () const
 returns the names of all face properties
 
std::vector< std::string > model_properties () const
 returns the names of all model properties
 
void property_stats (std::ostream &output) const override
 prints the names of all properties to an output stream (e.g., std::cout). More...
 
Iterators & Circulators
VertexIterator vertices_begin () const
 returns start iterator for vertices
 
VertexIterator vertices_end () const
 returns end iterator for vertices
 
VertexContainer vertices () const
 returns vertex container for C++11 range-based for-loops
 
HalfedgeIterator halfedges_begin () const
 returns start iterator for halfedges
 
HalfedgeIterator halfedges_end () const
 returns end iterator for halfedges
 
HalfedgeContainer halfedges () const
 returns halfedge container for C++11 range-based for-loops
 
EdgeIterator edges_begin () const
 returns start iterator for edges
 
EdgeIterator edges_end () const
 returns end iterator for edges
 
EdgeContainer edges () const
 returns edge container for C++11 range-based for-loops
 
FaceIterator faces_begin () const
 returns start iterator for faces
 
FaceIterator faces_end () const
 returns end iterator for faces
 
FaceContainer faces () const
 returns face container for C++11 range-based for-loops
 
VertexAroundVertexCirculator vertices (Vertex v) const
 returns circulator for vertices around vertex v
 
HalfedgeAroundVertexCirculator halfedges (Vertex v) const
 returns circulator for outgoing halfedges around vertex v
 
FaceAroundVertexCirculator faces (Vertex v) const
 returns circulator for faces around vertex v
 
VertexAroundFaceCirculator vertices (Face f) const
 returns circulator for vertices of face f
 
HalfedgeAroundFaceCirculator halfedges (Face f) const
 returns circulator for halfedges of face f
 
- Public Member Functions inherited from Model
 Model (const std::string &name="unknown")
 Default constructor. The parameter name is optional, but it is useful for handling multiple models with the same viewer.
 
void set_name (const std::string &n)
 Sets/Changes the name of a model. Assigning a name to a model is optional, but it is useful for handling multiple models with the same viewer.
 
const std::string & name () const
 The name of a model.
 
const Box3bounding_box (bool recompute=false) const
 The bounding box of the model. More...
 
void invalidate_bounding_box ()
 Invalidates the bounding box of the model. So when bounding_box() is called, the bounding box will be re-computed. This function is typically called when the geometry of a model is changed.
 
virtual std::vector< vec3 > & points ()=0
 The vertices of the model. More...
 
virtual const std::vector< vec3 > & points () const =0
 The vertices of the model. More...
 
bool empty () const
 Tests if the model is empty.
 
virtual void property_stats (std::ostream &output) const
 Prints the names of all properties to an output stream (e.g., std::cout). More...
 
void set_renderer (Renderer *r)
 Sets the renderer of this model. More...
 
Rendererrenderer ()
 Gets the renderer of this model.
 
const Rendererrenderer () const
 Gets the constant renderer of this model.
 
void set_manipulator (Manipulator *manip)
 Attaches a manipulator to this model. More...
 
Manipulatormanipulator ()
 Gets the manipulator attached to this model.
 
const Manipulatormanipulator () const
 Gets the manipulator attached to this model.
 

Geometry-related Functions

class SurfaceMeshBuilder
 
const vec3position (Vertex v) const
 position of a vertex (read only)
 
vec3position (Vertex v)
 position of a vertex
 
const std::vector< vec3 > & points () const override
 vector of vertex positions (read only) More...
 
std::vector< vec3 > & points () override
 vector of vertex positions More...
 
void update_face_normals ()
 compute face normals by calling compute_face_normal(Face) for each face.
 
vec3 compute_face_normal (Face f) const
 compute normal vector of face f.
 
void update_vertex_normals ()
 compute vertex normals by calling compute_vertex_normal(Vertex) for each vertex.
 
vec3 compute_vertex_normal (Vertex v) const
 
float edge_length (Edge e) const
 compute the length of edge e.
 
float edge_length (Halfedge h) const
 compute the length of an edge denoted by one of its halfedge h.
 

Higher-level Topological Operations

bool is_closed () const
 returns whether the mesh closed (i.e., no boundary edges)
 
bool is_triangle_mesh () const
 
bool is_quad_mesh () const
 
void triangulate ()
 
void triangulate (Face f)
 
void reverse_orientation ()
 Reverses the orientation of the entire mesh. More...
 
bool is_collapse_ok (Halfedge h) const
 
void collapse (Halfedge h)
 
Vertex split (Face f, const vec3 &p)
 
void split (Face f, Vertex v)
 
Halfedge split (Edge e, const vec3 &p)
 
Halfedge split (Edge e, Vertex v)
 
bool join_edges (Vertex v)
 
bool can_join_edges (Vertex v) const
 
Halfedge insert_edge (Halfedge h0, Halfedge h1)
 
bool is_flip_ok (Edge e) const
 
void flip (Edge e)
 
bool is_stitch_ok (Halfedge h0, Halfedge h1)
 
void stitch (Halfedge h0, Halfedge h1)
 Stitch two halfedges h0 and h1. Precondition: h0 and h1 are both on the border and point in reversed directions. More...
 
unsigned int valence (Vertex v) const
 
unsigned int valence (Face f) const
 returns the valence of face f (its number of vertices)
 
Halfedge find_halfedge (Vertex start, Vertex end) const
 find the halfedge from start to end
 
Edge find_edge (Vertex a, Vertex b) const
 find the edge (a, b)
 
void delete_vertex (Vertex v)
 
void delete_edge (Edge e)
 
void delete_face (Face f)
 
Halfedge insert_vertex (Edge e, const vec3 &p)
 
Halfedge insert_vertex (Edge e, Vertex v)
 
Halfedge insert_vertex (Halfedge h, Vertex v)
 

Detailed Description

A halfedge data structure for polygonal meshes of 2-manifold.

A surface mesh is a consistent and orientable polygonal mesh that may have one or more boundaries. The faces are simple polygons and the edges are line segments. Each edge connects two vertices, and is shared by two faces (including the null face for boundary edges). A surface mesh can have any number of connected components and also some self-intersections.

Note
The construction of a manifold surface mesh can be done by iteratively calling add_vertex() and add_face(). These two methods can ONLY be used when you're sure that the mesh is manifold. Otherwise, SurfaceMeshBuilder should be used for the construction, which guarantees you end up with a polygonal mesh of a 2-manifold topology. In any case, client code is highly recommended to use SurfaceMeshBuilder.
See also
SurfaceMeshBuilder.
Examples
Tutorial_104_SurfaceMesh, Tutorial_105_SurfaceMesh_Connectivity, Tutorial_106_SurfaceMesh_Property, Tutorial_107_SurfaceMesh_IO, Tutorial_302_Imposters, Tutorial_303_ScalarField, Tutorial_304_VectorField, Tutorial_305_Texture, Tutorial_310_TextMesher, Tutorial_402_FacePicker, Tutorial_406_CollisionDetection, Tutorial_601_Tessellator, and Tutorial_602_ConvexPartition.

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()

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

add a new face with vertex list vertices

Parameters
verticesThe input vertices created by add_vertex().
See also
add_triangle, add_quad
Examples
Tutorial_602_ConvexPartition.

◆ 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

Examples
Tutorial_106_SurfaceMesh_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_model_property()

ModelProperty< T > add_model_property ( const std::string &  name,
const T  t = T() 
)
inline

Adds a model 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. Example:

auto trans = cloud->add_model_property<mat4>("transformation", mat4::identity());
trans[0] = mat4::translation(-x0, -y0, -z0);
static Mat4< float > translation(const Vec< 3, float > &t)
Static constructor return a 3D translation matrix (as a 4D affine transformation).
Definition: mat.h:2280
static Mat< N, M, float > identity()
Static constructor return an N x M identity matrix. see also load_identity()
Definition: mat.h:483
Mat4< float > mat4
A 4 by 4 matrix of float type.
Definition: types.h:68

◆ add_quad()

SurfaceMesh::Face add_quad ( Vertex  v1,
Vertex  v2,
Vertex  v3,
Vertex  v4 
)

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

Parameters
{v1,v2,v3,v4}The input vertices created by add_vertex().
See also
add_triangle, add_face

◆ add_triangle()

SurfaceMesh::Face add_triangle ( Vertex  v1,
Vertex  v2,
Vertex  v3 
)

add a new triangle connecting vertices v1, v2, v3

Parameters
{v1,v2,v3}The input vertices created by add_vertex().
See also
add_face, add_quad
Examples
Tutorial_104_SurfaceMesh, and Tutorial_601_Tessellator.

◆ 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

Examples
Tutorial_305_Texture.

◆ can_join_edges()

bool can_join_edges ( Vertex  v) const

Check whether the two incident edges of a vertex can be joined. It only allows for vertices of valence two.

See also
join_edges(Vertex)

◆ clear()

void clear ( )

Removes all vertices, edges, faces, and properties (and resets garbage state).

After calling this method, the mesh is the same as newly constructed. The additional properties (such as normal vectors) are also removed and must thus be re-added if needed.

Examples
Tutorial_601_Tessellator.

◆ 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 collect_garbage() to finally remove them.

◆ compute_vertex_normal()

vec3 compute_vertex_normal ( Vertex  v) const

compute normal vector of vertex v. This is the angle-weighted average of incident face normals. TODO: not stable for concave vertices or vertices with spanning angles close to 0 or 180 degrees.

◆ delete_edge()

void delete_edge ( Edge  e)

deletes the edge e from the mesh. Its incident faces will also be deleted.

Attention
This function only marks the edge and its incident faces as deleted, and you have to call collect_garbage() to finally remove them.

◆ delete_face()

void delete_face ( Face  f)

deletes the face f from the mesh. Its incident edges (if on boundary) will also be deleted.

Attention
This function only marks the face and its incident edges (if on boundary) as deleted, and you have to call collect_garbage() to finally remove them.

◆ delete_vertex()

void delete_vertex ( Vertex  v)

deletes the vertex v from the mesh. Its incident edges and faces will also be deleted.

Attention
This function only marks the vertex and its incident edges and faces as deleted, and you have to call collect_garbage() to finally remove them.

◆ 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)

◆ 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)

Examples
Tutorial_601_Tessellator.

◆ flip()

void flip ( Edge  e)

Flip edge e: Remove 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.
See also
is_flip_ok(Edge)

◆ 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) const
inline

get the type_info T of edge property 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.

Examples
Tutorial_601_Tessellator.

◆ get_face_property_type()

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

get the type_info T of face property 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) const
inline

get the type_info T of halfedge property name. returns an typeid(void) if the property does not exist or if the type does not match.

◆ get_model_property()

ModelProperty< T > get_model_property ( const std::string &  name) const
inline

Gets the model property named name of type T.

Returns
The model property. An invalid ModelProperty will be returned if the property does not exist or if the type does not match. Example:
auto T = cloud->get_model_property<mat4>("transformation");
T[0] = mat4::translation(-x0, -y0, -z0);

◆ get_model_property_type()

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

get the type_info T of model property 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.

Examples
Tutorial_302_Imposters.

◆ get_vertex_property_type()

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

get the type_info T of vertex property name. returns an typeid(void) if the property does not exist or if the type does not match.

◆ 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)

◆ insert_edge()

SurfaceMesh::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

◆ is_border()

bool is_border ( Edge  e) const
inline

returns whether e is a boundary edge, i.e., if one of its halfedges is a boundary halfedge.

◆ is_collapse_ok()

bool is_collapse_ok ( Halfedge  h) const

returns whether collapsing the halfedge h 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
collect_garbage()

◆ is_deleted() [2/4]

bool is_deleted ( Face  f) const
inline

returns whether face f is deleted

See also
collect_garbage()

◆ is_deleted() [3/4]

bool is_deleted ( Halfedge  h) const
inline

returns whether halfedge h is deleted

See also
collect_garbage()

◆ is_deleted() [4/4]

bool is_deleted ( Vertex  v) const
inline

returns whether vertex v is deleted

See also
collect_garbage()

◆ is_flip_ok()

bool is_flip_ok ( Edge  e) const

Check whether flipping edge e is topologically allowed.

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

◆ 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_stitch_ok()

bool is_stitch_ok ( Halfedge  h0,
Halfedge  h1 
)

Check whether stitching two halfedges h0 an h1 is topologically allowed. Two halfedges can be stitched if they are both on on the border and point in reverse directions.

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

See also
triangulate(), triangulate(Face)

◆ join_edges()

bool join_edges ( Vertex  v)

Merges the two incident edges of a 2-degree vertex. This is the reverse operation of insert_vertex().

Precondition
valence(v) == 2.
See also
insert_vertex(Edge, vec3)
insert_vertex(Edge, Vertex)
insert_vertex(Halfedge, Vertex)

◆ model_property()

ModelProperty< T > model_property ( const std::string &  name,
const T  t = T() 
)
inline

if a model property of type T with name name exists, it is returned. otherwise this property is added (with default value t)

◆ next_around_source()

Halfedge next_around_source ( 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.

◆ next_around_target()

Halfedge next_around_target ( Halfedge  h) const
inline

returns the halfedge that is rotated clockwise around the end vertex of h. it is the opposite halfedge of the next halfedge of h.

◆ out_halfedge()

Halfedge out_halfedge ( Vertex  v) const
inline

returns an outgoing halfedge of vertex v. if v is a boundary vertex this will be a boundary halfedge.

◆ points() [1/2]

const std::vector< vec3 > & points ( ) const
inlineoverridevirtual

vector of vertex positions (read only)

Implements Model.

◆ points() [2/2]

std::vector< vec3 > & points ( )
inlineoverridevirtual

vector of vertex positions

Implements Model.

◆ prev_around_source()

Halfedge prev_around_source ( 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.

◆ prev_around_target()

Halfedge prev_around_target ( Halfedge  h) const
inline

returns the halfedge that is rotated counter-clockwise around the end vertex of h. it is the prev halfedge of the opposite halfedge of h.

◆ property_stats()

void property_stats ( std::ostream &  output) const
overridevirtual

prints the names of all properties to an output stream (e.g., std::cout).

Reimplemented from Model.

◆ read()

bool read ( const std::string &  filename)

Read mesh from a SM file filename. Mainly for quick debug purposes. Client code should use SurfaceMeshIO.

See also
SurfaceMeshIO.

◆ resize()

void resize ( unsigned int  nv,
unsigned int  ne,
unsigned int  nf 
)
inline

resizes space for vertices, halfedges, edges, faces, and their currently associated properties. Note: ne is the number of edges. for halfedges, nh = 2 * ne. *‍/

◆ reverse_orientation()

void reverse_orientation ( )

Reverses the orientation of the entire mesh.

This function reverses for each face the order of the vertices along the face boundary. As a consequence, the normal computed for each face using compute_face_normal() is also reversed.

◆ split() [1/4]

Halfedge split ( Edge  e,
const vec3 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]

SurfaceMesh::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 p that is created by splitting the existing edge e.

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

◆ split() [3/4]

Vertex split ( Face  f,
const vec3 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 vec3&)

◆ stitch()

void stitch ( Halfedge  h0,
Halfedge  h1 
)

Stitch two halfedges h0 and h1. Precondition: h0 and h1 are both on the border and point in reversed directions.

Attention
Stitching two halfedges changes the topology and geometry significantly, thus it may result in a non-manifold mesh, client code must check if this operation can be executed.
See also
is_stitch_ok().

◆ triangulate() [1/2]

void triangulate ( )

triangulate the entire mesh, by calling triangulate(Face) for each face.

See also
triangulate(Face)

◆ triangulate() [2/2]

void triangulate ( Face  f)

triangulate the face f

See also
triangulate()

◆ valence()

unsigned int valence ( Vertex  v) const

returns the valence (number of incident edges or neighboring vertices) of vertex v.

◆ 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)

◆ write()

bool write ( const std::string &  filename) const

Write mesh to a SM file filename. Mainly for quick debug purposes. Client code should use SurfaceMeshIO.

See also
SurfaceMeshIO.

Friends And Related Function Documentation

◆ insert_vertex() [1/3]

Halfedge insert_vertex ( Edge  e,
const vec3 p 
)
related

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) (Vertex)

◆ insert_vertex() [2/3]

Halfedge insert_vertex ( Edge  e,
Vertex  v 
)
related

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

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

◆ insert_vertex() [3/3]

SurfaceMesh::Halfedge insert_vertex ( Halfedge  h,
Vertex  v 
)
related

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

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

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