Developer Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
adasub.cc
1 #include <iostream>
2 #include <algorithm>
3 #include <iterator>
4 #include <OpenMesh/Core/IO/MeshIO.hh>
5 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
6 #include <OpenMesh/Tools/Subdivider/Adaptive/CompositeT.hh>
7 
8 // ----------------------------------------
9 
11 
12 // ---------------------------------------- necessary types
13 
15 CompositeT< MyMesh > Subdivider;
16 
17 // ---------------------------------------- setup a subdivider
18 
19 int main(int argc, char **argv)
20 {
21  MyMesh mesh; // create mesh and fill it
22 
23  if (!OpenMesh::IO::read_mesh(mesh, argv[1]))
24  return 1; // error reading mesh
25 
26  Subdivider subdivider(mesh); // bind subdivider to mesh
27 
28  // -------------------- add some rules
29 
30  // anonymous registration
31  subdivider.add< Tvv3<MyMesh>::Handle >();
32  subdivider.add< VF<MyMesh>::Handle >();
33  subdivider.add< FF<MyMesh>::Handle >();
34 
35  // 'named' registration
36  FVc<MyMesh>::Handle hFVc;
37  subdivider.add( hFVc );
38 
39  // print pre-computed coefficients to std::cout...
40  std::copy(subdivider.rule( hFVc ).coeffs().begin(),
41  subdivider.rule( hFVc ).coeffs().end(),
42  std::ostream_iterator<double>(std::cout, ", "));
43 
44  // prepare subdivider and the traits
45  if (!subdivider.initialize())
46  return 1; // error initializing subdivider
47 
48  MyMesh::FaceHandle fh; // select a face
49  subdivider.refine(fh);
50 }
bool read_mesh(Mesh &_mesh, const std::string &_filename)
Read a mesh from file _filename.
Definition: MeshIO.hh:104