MCPcopy Create free account
hub / github.com/PyMesh/PyMesh / compute_from_surface_mesh

Method compute_from_surface_mesh

src/Attributes/VertexValanceAttribute.cpp:31–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void VertexValanceAttribute::compute_from_surface_mesh(Mesh& mesh) {
32 const size_t num_vertices = mesh.get_num_vertices();
33 const size_t num_faces = mesh.get_num_faces();
34 const size_t num_vertex_per_face = mesh.get_vertex_per_face();
35
36 VectorF& vertex_valance = m_values;
37 vertex_valance = VectorF::Zero(num_vertices);
38
39 std::set<Duplet> edges;
40 for (size_t i=0; i<num_faces; i++) {
41 VectorI face = mesh.get_face(i);
42 for (size_t j=0; j<num_vertex_per_face; j++) {
43 Duplet edge(face[j], face[(j+1)%num_vertex_per_face]);
44 edges.insert(edge);
45 }
46 }
47
48 for (auto edge : edges) {
49 const auto& data = edge.get_ori_data();
50 vertex_valance[data[0]] ++;
51 vertex_valance[data[1]] ++;
52 }
53}
54
55void VertexValanceAttribute::compute_from_tet_mesh(Mesh& mesh) {
56 const size_t num_vertices = mesh.get_num_vertices();

Callers

nothing calls this directly

Calls 5

get_faceMethod · 0.80
get_num_verticesMethod · 0.45
get_num_facesMethod · 0.45
get_vertex_per_faceMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected