This example shows how to create and access properties defined on a surface mesh. We use per-face properties as example, you should be able to do similarly for per-edge/vertex properties.
27#include <easy3d/core/surface_mesh.h>
28#include <easy3d/util/initializer.h>
50 mesh->add_triangle(v0, v1, v3);
51 mesh->add_triangle(v1, v2, v3);
52 mesh->add_triangle(v2, v0, v3);
53 mesh->add_triangle(v0, v2, v1);
58int main(
int argc,
char** argv) {
63 SurfaceMesh* mesh = old_mesh_from_previous_example();
69 for (
auto f : mesh->faces()) {
73 normals[f] = mesh->compute_face_normal(f);
74 std::cout <<
"normal of face " << f <<
": " << normals[f] << std::endl;
Face property of type T.
Definition surface_mesh.h:363
A halfedge data structure for polygonal meshes of 2-manifold.
Definition surface_mesh.h:51
Definition collider.cpp:182
This type represents a vertex (internally it is basically an index).
Definition surface_mesh.h:135