NAME
vtkDecimate - reduce the number of triangles in a mesh
SYNOPSIS
#include "/opt/vtk-c++/patented/vtkDecimate.h"
class VTK_EXPORT vtkDecimate : public vtkPolyDataToPolyDataFilter
vtkDecimate();
static vtkDecimate *New() {return new vtkDecimate;};
const char *GetClassName() {return "vtkDecimate";};
void PrintSelf(ostream& os, vtkIndent indent);
void SetInitialError(float);
float GetInitialError();
void SetErrorIncrement(float);
float GetErrorIncrement();
void SetMaximumError(float);
float GetMaximumError();
void SetTargetReduction(float);
float GetTargetReduction();
void SetMaximumIterations(int);
int GetMaximumIterations();
void SetMaximumSubIterations(int);
int GetMaximumSubIterations();
void SetInitialFeatureAngle(float);
float GetInitialFeatureAngle();
void SetFeatureAngleIncrement(float);
float GetFeatureAngleIncrement();
void SetMaximumFeatureAngle(float);
float GetMaximumFeatureAngle();
void SetPreserveEdges(int);
int GetPreserveEdges();
void PreserveEdgesOn();
void PreserveEdgesOff();
void SetBoundaryVertexDeletion(int);
int GetBoundaryVertexDeletion();
void BoundaryVertexDeletionOn();
void BoundaryVertexDeletionOff();
void SetAspectRatio(float);
float GetAspectRatio();
void SetPreserveTopology(int);
int GetPreserveTopology();
void PreserveTopologyOn();
void PreserveTopologyOff();
void SetDegree(int);
int GetDegree();
void SetMaximumNumberOfSquawks(int);
int GetMaximumNumberOfSquawks();
DESCRIPTION
vtkDecimate is a filter to reduce the number of triangles in a triangle mesh, while preserving the original topology and a forming good approximation to the original geometry. The input to vtkDecimate is a vtkPolyData object, and only triangles are treated. If you desire to decimate polygonal meshes, first triangulate the polygons with the vtkTriangleFilter object.
The algorithm proceeds as follows. Each vertex in the triangle list is evaluated for local planarity (i.e., the triangles using the vertex are gathered and compared to an "average" plane). If the region is locally planar, that is if the target vertex is within a certain distance of the average plane (i.e., the error), and there are no edges radiating from the vertex that have a dihedral angle greater than a user-specified edge angle (i.e., feature angle), and topology is not altered, then that vertex is deleted. The resulting hole is then patched by re-triangulation. The process continues over the entire vertex list (this constitutes an iteration). Iterations proceed until a target reduction is reached or a maximum iteration count is exceeded.
There are a number of additional parameters you can set to control the decimation algorithm. The Error ivar may be increased over each iteration with the ErrorIncrement. (These two variables have the largest effect.) Edge preservation (i.e., PreserveEdges ivar) may be disabled or
enabled. You can turn on/off edge vertex deletion (i.e., BoundaryVertexDeletion ivar). (Edge vertices are vertices that lie along boundaries of meshes.) Sub iterations are iterations that are performed without changing the decimation criterion. The AspectRatio ivar controls the shape of the triangles that are created, and is the ratio of maximum edge length to minimum edge length. The Degree is the number of triangles using a single vertex. Vertices of high degree are considered "complex" and are never deleted.
CAVEATS
This implementation has been adapted for a global error bound decimation criterion. That is, the error is a global bound on distance to original surface. This is an improvement over the original Siggraph paper ("Decimation of Triangle Meshes", Proc Siggraph `92.)
The algorithm has been extended with a special flag to allow topology modification. When the PreserveTopology flag is on, then the algorithm will preserve the topology of the original mesh. If off, the algorithm may close holes and/or collapse tunnels (i.e., form non-manifold attachments).
TYPE DEFINITIONS
struct _vtkLocalVertex
struct _vtkLocalTri
DEFINED MACROS
VTK_NUMBER_STATISTICS 12
SUMMARY
void SetInitialError(float)
Set the decimation error bounds. Expressed as a fraction of the longest side of the input data's bounding box.
void SetErrorIncrement(float)
Set the value of the increment by which to increase the decimation error after each iteration.
void SetMaximumError(float)
Set the largest decimation error that can be achieved by incrementing the error.
void SetTargetReduction(float)
Specify the desired reduction in the total number of polygons. Because of various constraints, this level of reduction may not be realizable.
void SetMaximumIterations(int)
Specify the maximum number of iterations to attempt. If decimation target is reached first, this value will not be reached.
void SetMaximumSubIterations(int)
Specify the maximum sub-iterations to perform. If no triangles are deleted in a sub-iteration, the subiteration process is stopped.
void SetInitialFeatureAngle(float)
Specify the mesh feature angles.
void SetFeatureAngleIncrement(float)
Set/Get the angle by which to increase feature angle over each iteration.
void SetMaximumFeatureAngle(float)
Set the largest permissible feature angle.
void SetPreserveEdges(int)
Turn on/off the preservation of feature edges.
void SetBoundaryVertexDeletion(int)
Turn on/off the deletion of vertices on the boundary of a mesh.
void SetAspectRatio(float)
Specify the maximum allowable aspect ratio during triangulation.
void SetDegree(int)
If the number of triangles connected to a vertex exceeds "Degree", then the vertex is considered complex and is never deleted. (NOTE: the complexity of the triangulation algorithm is proportional to Degree^2.)
void SetMaximumNumberOfSquawks(int)
Control the printout of warnings. This flag limits the number of warnings regarding non-manifold geometry and complex vertices. If set to zero, no warnings will appear.
vtkDecimate()
Create object with target reduction of 90%, feature angle of 30 degrees, initial error of 0.0, error increment of 0.005, maximum error of 0.1, and maximum iterations of 6.