Easy3D 2.5.3
SurfaceMeshBuilder Class Reference

A helper class for constructing manifold surface mesh models. More...

#include <easy3d/core/surface_mesh_builder.h>

Public Types

typedef SurfaceMesh::Vertex Vertex
 
typedef SurfaceMesh::Halfedge Halfedge
 
typedef SurfaceMesh::Face Face
 

Public Member Functions

 SurfaceMeshBuilder (SurfaceMesh *mesh)
 
Vertex add_vertex (const vec3 &p)
 Add a vertex to the mesh. More...
 
const std::vector< Vertex > & face_vertices () const
 The actual vertices of the previously added face. The order of the vertices are the same as those provided to add_[face/triangle/quad]() for the construction of the face. More...
 

Related Functions

(Note that these are not member functions.)

void begin_surface ()
 Begin surface construction. Must be called at the beginning of the surface construction and used in pair with end_surface() at the end of surface mesh construction. ().
 
Face add_face (const std::vector< Vertex > &vertices)
 Add a face to the mesh. More...
 
Face add_triangle (Vertex v1, Vertex v2, Vertex v3)
 Add a new triangle face connecting vertices v1, v2, and v3. More...
 
Face add_quad (Vertex v1, Vertex v2, Vertex v3, Vertex v4)
 Add a new quad face connecting vertices v1, v2, v3, and v4. More...
 
void end_surface (bool log_issues=true)
 Finalize surface construction. Must be called at the end of the surface construction and used in pair with begin_surface() at the beginning of surface mesh construction. More...
 

Detailed Description

A helper class for constructing manifold surface mesh models.

SurfaceMeshBuilder resolves non-manifoldness while building a surface mesh. It is typically used to load a model from a file (because you don't know if the mesh is manifold or not). For meshes guaranteed to be manifold, you can also use the built-in add_vertex() and add_[face/triangle/quad]() functions of SurfaceMesh for their construction. Example use:

SurfaceMeshBuilder builder(mesh);
builder.begin_surface();
for_each_vertex:
builder.add_vertex(p);
for_each_face:
builder.add_face(ids); // ids: the vertices of the face
builder.end_surface();
Examples
Tutorial_104_SurfaceMesh.

Member Function Documentation

◆ add_vertex()

SurfaceMesh::Vertex add_vertex ( const vec3 p)

Add a vertex to the mesh.

Parameters
pThe 3D coordinates of the vertex.
Returns
The added vertex on success.
Examples
Tutorial_104_SurfaceMesh.

◆ face_vertices()

const std::vector< Vertex > & face_vertices ( ) const
inline

The actual vertices of the previously added face. The order of the vertices are the same as those provided to add_[face/triangle/quad]() for the construction of the face.

Attention
The result is valid if the face was successfully added, and it will remain valid until the next call to add_[face/triangle/quad]() and end_surface().

Friends And Related Function Documentation

◆ add_face()

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

Add a face to the mesh.

Parameters
verticesThe vertices of the face.
Returns
The added face on success. (), add_quad().

◆ add_quad()

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

Add a new quad face connecting vertices v1, v2, v3, and v4.

Returns
The added face on success. (), add_triangle().

◆ add_triangle()

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

Add a new triangle face connecting vertices v1, v2, and v3.

Returns
The added face on success. (), add_quad().
Examples
Tutorial_104_SurfaceMesh.

◆ end_surface()

void end_surface ( bool  log_issues = true)
related

Finalize surface construction. Must be called at the end of the surface construction and used in pair with begin_surface() at the beginning of surface mesh construction.

Parameters
log_issuesTrue to log the issues detected and a report on the process of the issues to the log file. ().
Examples
Tutorial_104_SurfaceMesh.

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