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