14#include <lagrange/Mesh.h>
15#include <lagrange/MeshTrait.h>
16#include <lagrange/legacy/inline.h>
21template <
typename MeshType>
24 static_assert(MeshTrait<MeshType>::is_mesh(),
"Input type is not Mesh");
26 using Index =
typename MeshType::Index;
31 const auto& facets = mesh.get_facets();
33 typename MeshType::AttributeArray valence(num_vertices, 1);
36 for (Index i = 0; i < num_facets; i++) {
37 for (Index j = 0; j < vertex_per_facet; j++) {
38 valence(facets(i, j), 0) += 1.0;
42 mesh.add_vertex_attribute(
"valence");
43 mesh.import_vertex_attribute(
"valence", valence);
Index get_num_vertices() const
Retrieves the number of vertices.
Definition: SurfaceMesh.h:671
Index get_num_facets() const
Retrieves the number of facets.
Definition: SurfaceMesh.h:678
Index get_vertex_per_facet() const
Retrieves the number of vertex per facet in a regular mesh.
Definition: SurfaceMesh.cpp:2118
AttributeId compute_vertex_valence(SurfaceMesh< Scalar, Index > &mesh, VertexValenceOptions options={})
Compute vertex valence.
Definition: compute_vertex_valence.cpp:25
Main namespace for Lagrange.
Definition: AABBIGL.h:30