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

Method get_euler_characteristic

tools/MeshUtils/MeshChecker.cpp:148–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148int MeshChecker::get_euler_characteristic() const {
149 int num_vertices = m_vertices.rows();
150 if (m_voxels.rows() > 0) {
151 // Only count surface vertices.
152 std::vector<bool> on_surface(num_vertices, false);
153 std::for_each(m_faces.data(), m_faces.data() + m_faces.size(),
154 [&](int i) { on_surface[i] = true; } );
155 num_vertices = std::accumulate(on_surface.begin(),
156 on_surface.end(), 0);
157 }
158 const int num_edges = m_edge_face_adjacency.size();
159 const int num_faces = m_faces.rows();
160 return num_vertices - num_edges + num_faces;
161}
162
163size_t MeshChecker::get_num_connected_components() const {
164 MeshSeparator separator(m_faces);

Callers 2

euler_characteristicMethod · 0.80
TEST_FFunction · 0.80

Calls 3

sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 1

TEST_FFunction · 0.64