Commit 00f21ae5 authored by Daniel Gotzen's avatar Daniel Gotzen
Browse files

added decimeter examples to doc

parent 57bc372a
Pipeline #4174 passed with stage
in 70 minutes and 57 seconds
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModQuadricT<Mesh>::Handle HModQuadric;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModNormalDeviationT<Mesh>::Handle HModNormalDeviation;
typedef Decimater::ModAspectRatioT<Mesh>::Handle HModAspectRatio;
typedef Decimater::ModHausdorffT<Mesh>::Handle HModHausdorff;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModQuadric hModQuadric; // use a quadric module
decimater.add(hModQuadric); // register module at the decimater
std::cout << decimater.module(hModQuadric).name() << std::endl; // module access
HModNormalDeviation hModNormalDeviation; // use a normal deviation module primarily
decimater.add(hModNormalDeviation); // register deviation module at the decimater
decimater.module(hModNormalDeviation).set_binary(false); // exact one module must be non-binary
decimater.module(hModNormalDeviation).set_normal_deviation(15.0); // set max angle between normals in degrees
std::cout << decimater.module(hModNormalDeviation).name() << std::endl; // module access
HModAspectRatio hModAspectRatio; // use an aspect ratio module
decimater.add(hModAspectRatio); // register the second module
decimater.module(hModAspectRatio).set_binary(true); // further modules must be binary
decimater.module(hModAspectRatio).set_aspect_ratio(3.0); // prevents collapsses which result in a smaller aspect ratio than the chosen minimum
/*
* since we need exactly one priority module (non-binary)
* we have to call set_binary(false) for our priority module
* in the case of HModQuadric, unset_max_err() calls set_binary(false) internally
*/
decimater.module(hModQuadric).unset_max_err();
HModHausdorff hModHausdorff; // use a hausdorff distance module
decimater.add(hModHausdorff); // register the third module
//note that ModHausdorff only supports binary mode
decimater.module(hModHausdorff).set_tolerance(10.0); // set max Hausdorff distance tollerance
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModAspectRatioT<Mesh>::Handle HModAspectRatio;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModAspectRatio hModAspectRatio; // use an aspect ratio module
decimater.add(hModAspectRatio); // register the aspect ratio module
decimater.module(hModAspectRatio).set_binary(false); // if the aspect ratio module is not the primary module set binary to true;
decimater.module(hModAspectRatio).set_aspect_ratio(3.0); // prevents collapsses which result in a smaller aspect ratio than the chosen minimum
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModEdgeLengthT<Mesh>::Handle HModEdgeLength;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModEdgeLength hModEdgeLength; // use an edge length module
decimater.add(hModEdgeLength); // register the edge length module
decimater.module(hModEdgeLength).set_binary(false); // if the edge length module is not the primary module set binary to true;
decimater.module(hModEdgeLength).set_edge_length (4.0); // choose the maximum length of edges to be collapsed
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModHausdorffT<Mesh>::Handle HModHausdorff;
typedef Decimater::ModNormalDeviationT<Mesh>::Handle HModNormalDeviation;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModHausdorff hModHausdorff; // use a hausdorff distance module
decimater.add(hModHausdorff); // register the hausdorff distance module
decimater.module(hModHausdorff).set_tolerance(10.0); // set max Hausdorff distance tollerance
//note that ModHausdorff only supports binary mode and has to be used in combination with a non-binary module
HModNormalDeviation hModNormalDeviation; // use a non-binary module primarily
decimater.add(hModNormalDeviation); // register the module at the decimater
decimater.module(hModNormalDeviation).set_binary(false); // choose non-binary mode
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModIndependentT<Mesh>::Handle HModIndependent;
typedef Decimater::ModNormalDeviationT<Mesh>::Handle HModNormalDeviation;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModIndependent hModIndependent; // use a independence module
//note that ModIndependent only supports binary mode and has to be used in combination with a non-binary module
HModNormalDeviation hModNormalDeviation; // use a non-binary module primarily
decimater.add(hModNormalDeviation); // register the module at the decimater
decimater.module(hModNormalDeviation).set_binary(false); // choose non-binary mode
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModNormalDeviationT<Mesh>::Handle HModNormalDeviation;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModNormalDeviation hModNormalDeviation; // use a normal deviation module
decimater.add(hModNormalDeviation); // register deviation module at the decimater
decimater.module(hModNormalDeviation).set_binary(false); // if the normal deviation module is not the primary module set binary to true;
decimater.module(hModNormalDeviation).set_normal_deviation(15.0); // set max angle between normals in degrees
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModNormalFlippingT<Mesh>::Handle HModNormalFlipping;
typedef Decimater::ModNormalDeviationT<Mesh>::Handle HModNormalDeviation;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModNormalFlipping hModNormalFlipping; // use a normal flipping module
decimater.add(hModNormalFlipping); // register the normal flipping module
decimater.module(hModNormalFlipping).set_max_normal_deviation(45.0); // set the maximum normal deviation after collapse
//note that ModNormalFlipping only supports binary mode and has to be used in combination with a non-binary module
HModNormalDeviation hModNormalDeviation; // use a non-binary module primarily
decimater.add(hModNormalDeviation); // register the module at the decimater
decimater.module(hModNormalDeviation).set_binary(false); // choose non-binary mode
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModQuadricT<Mesh>::Handle HModQuadric;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModQuadric hModQuadric; // use a quadric module
decimater.add(hModQuadric); // register module at the decimater
std::cout << decimater.module(hModQuadric).name() << std::endl; // module access
/*
* since we need exactly one priority module (non-binary)
* we have to call set_binary(false) for our priority module
* in the case of HModQuadric, unset_max_err() calls set_binary(false) internally
*/
decimater.module(hModQuadric).unset_max_err();
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
using namespace OpenMesh;
typedef TriMesh_ArrayKernelT<> Mesh;
typedef Decimater::DecimaterT<Mesh> Decimater;
typedef Decimater::ModRoundnessT<Mesh>::Handle HModRoundness;
Mesh mesh; // a mesh object
Decimater decimater(mesh); // a decimater object, connected to a mesh
HModRoundness hModRoundness; // use a roundness module
decimater.add(hModRoundness); // register the roundness module
//in non-binary mode set OR unset minimal roundness
decimater.module(hModRoundness).set_min_roundness(0.5, false); // choose a minimal roundness value between 0 and 1.0 and set binary mode to false
decimater.module(hModRoundness).unset_min_roundness(); // or unset minimal roundness
//in binary mode choose a minimal roundness OR angle
decimater.module(hModRoundness).set_min_roundness(0.5, true); // choose a minimal roundness value between 0 and 1.0 and set binary mode to true
decimater.module(hModRoundness).set_min_angle(15.0, true); // or choose a minimal angle in degrees. second argument gets ignored
decimater.initialize();
decimater.decimate();
// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment