OpenMesh get number of faces/vertices/edges

1.2k views Asked by At

Is there a way to directly get the number of faces, vertices and edges in a mesh in OpenMesh? One could always iterate over them and count them but I was wondering if there is any member variable that holds them or whether there is any vector where they are stored and one could just check the size of that vector?

1

There are 1 answers

0
Mark Loyman On BEST ANSWER

[github] OpenMesh/Core/Mesh/ArrayKernel.hh

size_t n_vertices()  const { return vertices_.size(); }
size_t n_halfedges() const { return 2*edges_.size(); }
size_t n_edges()     const { return edges_.size(); }
size_t n_faces()     const { return faces_.size(); }

bool vertices_empty()  const { return vertices_.empty(); }
bool halfedges_empty() const { return edges_.empty(); }
bool edges_empty()     const { return edges_.empty(); }
bool faces_empty()     const { return faces_.empty(); }