A helper class for constructing manifold surface mesh models.
More...
#include <easy3d/core/surface_mesh_builder.h>
|
| SurfaceMeshBuilder (SurfaceMesh *mesh) |
| Constructor that initializes the builder with a given surface mesh.
|
|
| ~SurfaceMeshBuilder () |
| Destructor.
|
|
void | begin_surface () |
| Begin surface construction.
|
|
Vertex | add_vertex (const vec3 &p) |
| Add a vertex to the mesh.
|
|
Face | add_face (const std::vector< Vertex > &vertices) |
| Add a face to the mesh.
|
|
Face | add_triangle (Vertex v1, Vertex v2, Vertex v3) |
| Add a new triangle face connecting vertices v1, v2, and v3.
|
|
Face | add_quad (Vertex v1, Vertex v2, Vertex v3, Vertex v4) |
| Add a new quad face connecting vertices v1, v2, v3, and v4.
|
|
void | end_surface (bool log_issues=true) |
| Finalize surface construction.
|
|
const std::vector< Vertex > & | face_vertices () const |
| Get the actual vertices of the previously added face.
|
|
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:
builder.begin_surface();
for_each_vertex:
builder.add_vertex(p);
for_each_face:
builder.add_face(ids);
builder.end_surface();
SurfaceMeshBuilder(SurfaceMesh *mesh)
Constructor that initializes the builder with a given surface mesh.
Definition surface_mesh_builder.cpp:44
- Examples
- Tutorial_104_SurfaceMesh/main.cpp.
◆ SurfaceMeshBuilder()
Constructor that initializes the builder with a given surface mesh.
- Parameters
-
mesh | The surface mesh to build. |
◆ add_face()
Add a face to the mesh.
- Parameters
-
vertices | The vertices of the face. |
- Returns
- The added face on success.
- See also
- add_triangle(), add_quad().
◆ add_quad()
Add a new quad face connecting vertices v1, v2, v3, and v4.
- Parameters
-
v1 | The first vertex of the quad. |
v2 | The second vertex of the quad. |
v3 | The third vertex of the quad. |
v4 | The fourth vertex of the quad. |
- Returns
- The added face on success.
- See also
- add_face(), add_triangle().
◆ add_triangle()
Add a new triangle face connecting vertices v1, v2, and v3.
- Parameters
-
v1 | The first vertex of the triangle. |
v2 | The second vertex of the triangle. |
v3 | The third vertex of the triangle. |
- Returns
- The added face on success.
- See also
- add_face(), add_quad().
- Examples
- Tutorial_104_SurfaceMesh/main.cpp.
◆ add_vertex()
◆ begin_surface()
◆ end_surface()
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.
- Parameters
-
log_issues | True to log the issues detected and a report on the process of the issues to the log file. |
- See also
- begin_surface().
- Examples
- Tutorial_104_SurfaceMesh/main.cpp.
◆ face_vertices()
const std::vector< Vertex > & face_vertices |
( |
| ) |
const |
|
inline |
Get 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().
- Returns
- A vector containing the vertices of the face.
The documentation for this class was generated from the following files: