2#include <OpenMesh/Core/IO/MeshIO.hh>
3#include <OpenMesh/Core/Mesh/DefaultTriMesh.hh>
4#include <OpenMesh/Core/Utils/PropertyManager.hh>
5#include <OpenMesh/Core/Utils/Predicates.hh>
14int main(
int argc,
char** argv)
16 using namespace OpenMesh::Predicates;
21 std::cerr <<
"Usage: " << argv[0] <<
" infile" << std::endl;
24 const std::string infile = argv[1];
28 std::cerr <<
"Error: Cannot read mesh from " << infile << std::endl;
33 std::cout <<
"Mesh contains " << mesh.vertices().count_if(
Boundary()) <<
" boundary vertices";
36 std::cout <<
"These are the selected inner vertices: " << std::endl;
38 std::cout << vh.idx() <<
", ";
39 std::cout << std::endl;
42 auto vec = mesh.faces().filtered(is_divisible_by_3).to_vector();
43 std::cout <<
"There are " << vec.size() <<
" faces whose id is divisible by 3" << std::endl;
46 auto vec2 = mesh.faces().filtered(
Tagged() || !make_predicate(is_divisible_by_3)).to_vector();
47 std::cout <<
"There are " << vec2.size() <<
" faces which are tagged or whose id is not divisible by 3" << std::endl;
51 for (
auto eh : mesh.edges())
52 longer_than_10[eh] = mesh.calc_edge_length(eh) > 10;
53 std::cout <<
"There are " <<
55 " edges which are shorter than 2 or longer than 10" << std::endl;
int idx() const
Get the underlying index of this handle.
Scalar calc_edge_length(EdgeHandle _eh) const
Compute normals for all primitives.
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Handle for a edge entity.
Handle for a face entity.