vtkDecimatePro Class Reference

#include <vtkDecimatePro.h>

Inheritance diagram for vtkDecimatePro:

Inheritance graph
[legend]
Collaboration diagram for vtkDecimatePro:

Collaboration graph
[legend]

List of all members.


Detailed Description

reduce the number of triangles in a mesh

vtkDecimatePro is a filter to reduce the number of triangles in a triangle mesh, forming a good approximation to the original geometry. The input to vtkDecimatePro is a vtkPolyData object, and only triangles are treated. If you desire to decimate polygonal meshes, first triangulate the polygons with vtkTriangleFilter object.

The implementation of vtkDecimatePro is similar to the algorithm originally described in "Decimation of Triangle Meshes", Proc Siggraph `92, with three major differences. First, this algorithm does not necessarily preserve the topology of the mesh. Second, it is guaranteed to give the a mesh reduction factor specified by the user (as long as certain constraints are not set - see Caveats). Third, it is set up generate progressive meshes, that is a stream of operations that can be easily transmitted and incrementally updated (see Hugues Hoppe's Siggraph '96 paper on progressive meshes).

The algorithm proceeds as follows. Each vertex in the mesh is classified and inserted into a priority queue. The priority is based on the error to delete the vertex and retriangulate the hole. Vertices that cannot be deleted or triangulated (at this point in the algorithm) are skipped. Then, each vertex in the priority queue is processed (i.e., deleted followed by hole triangulation using edge collapse). This continues until the priority queue is empty. Next, all remaining vertices are processed, and the mesh is split into separate pieces along sharp edges or at non-manifold attachment points and reinserted into the priority queue. Again, the priority queue is processed until empty. If the desired reduction is still not achieved, the remaining vertices are split as necessary (in a recursive fashion) so that it is possible to eliminate every triangle as necessary.

To use this object, at a minimum you need to specify the ivar TargetReduction. The algorithm is guaranteed to generate a reduced mesh at this level as long as the following four conditions are met: 1) topology modification is allowed (i.e., the ivar PreserveTopology is off); 2) mesh splitting is enabled (i.e., the ivar Splitting is on); 3) the algorithm is allowed to modify the boundary of the mesh (i.e., the ivar BoundaryVertexDeletion is on); and 4) the maximum allowable error (i.e., the ivar MaximumError) is set to VTK_DOUBLE_MAX. Other important parameters to adjust include the FeatureAngle and SplitAngle ivars, since these can impact the quality of the final mesh. Also, you can set the ivar AccumulateError to force incremental error update and distribution to surrounding vertices as each vertex is deleted. The accumulated error is a conservative global error bounds and decimation error, but requires additional memory and time to compute.

Warning:
To guarantee a given level of reduction, the ivar PreserveTopology must be off; the ivar Splitting is on; the ivar BoundaryVertexDeletion is on; and the ivar MaximumError is set to VTK_DOUBLE_MAX.

If PreserveTopology is off, and SplitEdges is off; the mesh topology may be modified by closing holes.

Once mesh splitting begins, the feature angle is set to the split angle.

See also:
vtkDecimate vtkQuadricClustering vtkQuadricDecimation
Tests:
vtkDecimatePro (Tests)

Definition at line 92 of file vtkDecimatePro.h.


Public Types

typedef vtkPolyDataAlgorithm Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
vtkIdType GetNumberOfInflectionPoints ()
void GetInflectionPoints (double *inflectionPoints)
double * GetInflectionPoints ()
virtual void SetTargetReduction (double)
virtual double GetTargetReduction ()
virtual void SetPreserveTopology (int)
virtual int GetPreserveTopology ()
virtual void PreserveTopologyOn ()
virtual void PreserveTopologyOff ()
virtual void SetFeatureAngle (double)
virtual double GetFeatureAngle ()
virtual void SetSplitting (int)
virtual int GetSplitting ()
virtual void SplittingOn ()
virtual void SplittingOff ()
virtual void SetSplitAngle (double)
virtual double GetSplitAngle ()
virtual void SetPreSplitMesh (int)
virtual int GetPreSplitMesh ()
virtual void PreSplitMeshOn ()
virtual void PreSplitMeshOff ()
virtual void SetMaximumError (double)
virtual double GetMaximumError ()
virtual void SetAccumulateError (int)
virtual int GetAccumulateError ()
virtual void AccumulateErrorOn ()
virtual void AccumulateErrorOff ()
virtual void SetErrorIsAbsolute (int)
virtual int GetErrorIsAbsolute ()
virtual void SetAbsoluteError (double)
virtual double GetAbsoluteError ()
virtual void SetBoundaryVertexDeletion (int)
virtual int GetBoundaryVertexDeletion ()
virtual void BoundaryVertexDeletionOn ()
virtual void BoundaryVertexDeletionOff ()
virtual void SetDegree (int)
virtual int GetDegree ()
virtual void SetInflectionPointRatio (double)
virtual double GetInflectionPointRatio ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkDecimateProSafeDownCast (vtkObject *o)
static vtkDecimateProNew ()

Protected Types

typedef LocalVertexLocalVertexPtr
typedef LocalTriLocalTriPtr

Protected Member Functions

 vtkDecimatePro ()
 ~vtkDecimatePro ()
int RequestData (vtkInformation *, vtkInformationVector **, vtkInformationVector *)
void SplitMesh ()
int EvaluateVertex (vtkIdType ptId, unsigned short int numTris, vtkIdType *tris, vtkIdType fedges[2])
vtkIdType FindSplit (int type, vtkIdType fedges[2], vtkIdType &pt1, vtkIdType &pt2, vtkIdList *CollapseTris)
int IsValidSplit (int index)
void SplitLoop (vtkIdType fedges[2], vtkIdType &n1, vtkIdType *l1, vtkIdType &n2, vtkIdType *l2)
void SplitVertex (vtkIdType ptId, int type, unsigned short int numTris, vtkIdType *tris, int insert)
int CollapseEdge (int type, vtkIdType ptId, vtkIdType collapseId, vtkIdType pt1, vtkIdType pt2, vtkIdList *CollapseTris)
void DistributeError (double error)

Protected Attributes

double TargetReduction
double FeatureAngle
double MaximumError
double AbsoluteError
int ErrorIsAbsolute
int AccumulateError
double SplitAngle
int Splitting
int PreSplitMesh
int BoundaryVertexDeletion
int PreserveTopology
int Degree
double InflectionPointRatio
vtkDoubleArrayInflectionPoints
vtkIdListNeighbors
vtkPriorityQueueEdgeLengths

Friends

class VertexArray
class TriArray

Classes

class  LocalTri
class  LocalVertex
class  TriArray
class  VertexArray

Member Typedef Documentation

Reimplemented from vtkPolyDataAlgorithm.

Definition at line 95 of file vtkDecimatePro.h.

Definition at line 301 of file vtkDecimatePro.h.

typedef LocalTri* vtkDecimatePro::LocalTriPtr [protected]

Definition at line 311 of file vtkDecimatePro.h.


Constructor & Destructor Documentation

vtkDecimatePro::vtkDecimatePro (  )  [protected]

vtkDecimatePro::~vtkDecimatePro (  )  [protected]


Member Function Documentation

virtual const char* vtkDecimatePro::GetClassName (  )  [virtual]

Reimplemented from vtkPolyDataAlgorithm.

static int vtkDecimatePro::IsTypeOf ( const char *  name  )  [static]

Return 1 if this class type is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkPolyDataAlgorithm.

virtual int vtkDecimatePro::IsA ( const char *  name  )  [virtual]

Return 1 if this class is the same type of (or a subclass of) the named class. Returns 0 otherwise. This method works in combination with vtkTypeRevisionMacro found in vtkSetGet.h.

Reimplemented from vtkPolyDataAlgorithm.

static vtkDecimatePro* vtkDecimatePro::SafeDownCast ( vtkObject o  )  [static]

Reimplemented from vtkPolyDataAlgorithm.

void vtkDecimatePro::PrintSelf ( ostream &  os,
vtkIndent  indent 
) [virtual]

Methods invoked by print to print information about the object including superclasses. Typically not called by the user (use Print() instead) but used in the hierarchical print process to combine the output of several classes.

Reimplemented from vtkPolyDataAlgorithm.

static vtkDecimatePro* vtkDecimatePro::New (  )  [static]

Create object with specified reduction of 90% and feature angle of 15 degrees. Edge splitting is on, defer splitting is on, and the split angle is 75 degrees. Topology preservation is off, delete boundary vertices is on, and the maximum error is set to VTK_DOUBLE_MAX. The inflection point ratio is 10 and the vertex degree is 25. Error accumulation is turned off.

Reimplemented from vtkPolyDataAlgorithm.

virtual void vtkDecimatePro::SetTargetReduction ( double   )  [virtual]

Specify the desired reduction in the total number of polygons (e.g., if TargetReduction is set to 0.9, this filter will try to reduce the data set to 10% of its original size). Because of various constraints, this level of reduction may not be realized. If you want to guarantee a particular reduction, you must turn off PreserveTopology, turn on SplitEdges and BoundaryVertexDeletion, and set the MaximumError to VTK_DOUBLE_MAX (these ivars are initialized this way when the object is instantiated).

virtual double vtkDecimatePro::GetTargetReduction (  )  [virtual]

Specify the desired reduction in the total number of polygons (e.g., if TargetReduction is set to 0.9, this filter will try to reduce the data set to 10% of its original size). Because of various constraints, this level of reduction may not be realized. If you want to guarantee a particular reduction, you must turn off PreserveTopology, turn on SplitEdges and BoundaryVertexDeletion, and set the MaximumError to VTK_DOUBLE_MAX (these ivars are initialized this way when the object is instantiated).

virtual void vtkDecimatePro::SetPreserveTopology ( int   )  [virtual]

Turn on/off whether to preserve the topology of the original mesh. If on, mesh splitting and hole elimination will not occur. This may limit the maximum reduction that may be achieved.

virtual int vtkDecimatePro::GetPreserveTopology (  )  [virtual]

Turn on/off whether to preserve the topology of the original mesh. If on, mesh splitting and hole elimination will not occur. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::PreserveTopologyOn (  )  [virtual]

Turn on/off whether to preserve the topology of the original mesh. If on, mesh splitting and hole elimination will not occur. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::PreserveTopologyOff (  )  [virtual]

Turn on/off whether to preserve the topology of the original mesh. If on, mesh splitting and hole elimination will not occur. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::SetFeatureAngle ( double   )  [virtual]

Specify the mesh feature angle. This angle is used to define what an edge is (i.e., if the surface normal between two adjacent triangles is >= FeatureAngle, an edge exists).

virtual double vtkDecimatePro::GetFeatureAngle (  )  [virtual]

Specify the mesh feature angle. This angle is used to define what an edge is (i.e., if the surface normal between two adjacent triangles is >= FeatureAngle, an edge exists).

virtual void vtkDecimatePro::SetSplitting ( int   )  [virtual]

Turn on/off the splitting of the mesh at corners, along edges, at non-manifold points, or anywhere else a split is required. Turning splitting off will better preserve the original topology of the mesh, but you may not obtain the requested reduction.

virtual int vtkDecimatePro::GetSplitting (  )  [virtual]

Turn on/off the splitting of the mesh at corners, along edges, at non-manifold points, or anywhere else a split is required. Turning splitting off will better preserve the original topology of the mesh, but you may not obtain the requested reduction.

virtual void vtkDecimatePro::SplittingOn (  )  [virtual]

Turn on/off the splitting of the mesh at corners, along edges, at non-manifold points, or anywhere else a split is required. Turning splitting off will better preserve the original topology of the mesh, but you may not obtain the requested reduction.

virtual void vtkDecimatePro::SplittingOff (  )  [virtual]

Turn on/off the splitting of the mesh at corners, along edges, at non-manifold points, or anywhere else a split is required. Turning splitting off will better preserve the original topology of the mesh, but you may not obtain the requested reduction.

virtual void vtkDecimatePro::SetSplitAngle ( double   )  [virtual]

Specify the mesh split angle. This angle is used to control the splitting of the mesh. A split line exists when the surface normals between two edge connected triangles are >= SplitAngle.

virtual double vtkDecimatePro::GetSplitAngle (  )  [virtual]

Specify the mesh split angle. This angle is used to control the splitting of the mesh. A split line exists when the surface normals between two edge connected triangles are >= SplitAngle.

virtual void vtkDecimatePro::SetPreSplitMesh ( int   )  [virtual]

In some cases you may wish to split the mesh prior to algorithm execution. This separates the mesh into semi-planar patches, which are disconnected from each other. This can give superior results in some cases. If the ivar PreSplitMesh ivar is enabled, the mesh is split with the specified SplitAngle. Otherwise mesh splitting is deferred as long as possible.

virtual int vtkDecimatePro::GetPreSplitMesh (  )  [virtual]

In some cases you may wish to split the mesh prior to algorithm execution. This separates the mesh into semi-planar patches, which are disconnected from each other. This can give superior results in some cases. If the ivar PreSplitMesh ivar is enabled, the mesh is split with the specified SplitAngle. Otherwise mesh splitting is deferred as long as possible.

virtual void vtkDecimatePro::PreSplitMeshOn (  )  [virtual]

In some cases you may wish to split the mesh prior to algorithm execution. This separates the mesh into semi-planar patches, which are disconnected from each other. This can give superior results in some cases. If the ivar PreSplitMesh ivar is enabled, the mesh is split with the specified SplitAngle. Otherwise mesh splitting is deferred as long as possible.

virtual void vtkDecimatePro::PreSplitMeshOff (  )  [virtual]

In some cases you may wish to split the mesh prior to algorithm execution. This separates the mesh into semi-planar patches, which are disconnected from each other. This can give superior results in some cases. If the ivar PreSplitMesh ivar is enabled, the mesh is split with the specified SplitAngle. Otherwise mesh splitting is deferred as long as possible.

virtual void vtkDecimatePro::SetMaximumError ( double   )  [virtual]

Set the largest decimation error that is allowed during the decimation process. This may limit the maximum reduction that may be achieved. The maximum error is specified as a fraction of the maximum length of the input data bounding box.

virtual double vtkDecimatePro::GetMaximumError (  )  [virtual]

Set the largest decimation error that is allowed during the decimation process. This may limit the maximum reduction that may be achieved. The maximum error is specified as a fraction of the maximum length of the input data bounding box.

virtual void vtkDecimatePro::SetAccumulateError ( int   )  [virtual]

The computed error can either be computed directly from the mesh or the error may be accumulated as the mesh is modified. If the error is accumulated, then it represents a global error bounds, and the ivar MaximumError becomes a global bounds on mesh error. Accumulating the error requires extra memory proportional to the number of vertices in the mesh. If AccumulateError is off, then the error is not accumulated.

virtual int vtkDecimatePro::GetAccumulateError (  )  [virtual]

The computed error can either be computed directly from the mesh or the error may be accumulated as the mesh is modified. If the error is accumulated, then it represents a global error bounds, and the ivar MaximumError becomes a global bounds on mesh error. Accumulating the error requires extra memory proportional to the number of vertices in the mesh. If AccumulateError is off, then the error is not accumulated.

virtual void vtkDecimatePro::AccumulateErrorOn (  )  [virtual]

The computed error can either be computed directly from the mesh or the error may be accumulated as the mesh is modified. If the error is accumulated, then it represents a global error bounds, and the ivar MaximumError becomes a global bounds on mesh error. Accumulating the error requires extra memory proportional to the number of vertices in the mesh. If AccumulateError is off, then the error is not accumulated.

virtual void vtkDecimatePro::AccumulateErrorOff (  )  [virtual]

The computed error can either be computed directly from the mesh or the error may be accumulated as the mesh is modified. If the error is accumulated, then it represents a global error bounds, and the ivar MaximumError becomes a global bounds on mesh error. Accumulating the error requires extra memory proportional to the number of vertices in the mesh. If AccumulateError is off, then the error is not accumulated.

virtual void vtkDecimatePro::SetErrorIsAbsolute ( int   )  [virtual]

The MaximumError is normally defined as a fraction of the dataset bounding diagonal. By setting ErrorIsAbsolute to 1, the error is instead defined as that specified by AbsoluteError. By default ErrorIsAbsolute=0.

virtual int vtkDecimatePro::GetErrorIsAbsolute (  )  [virtual]

The MaximumError is normally defined as a fraction of the dataset bounding diagonal. By setting ErrorIsAbsolute to 1, the error is instead defined as that specified by AbsoluteError. By default ErrorIsAbsolute=0.

virtual void vtkDecimatePro::SetAbsoluteError ( double   )  [virtual]

Same as MaximumError, but to be used when ErrorIsAbsolute is 1

virtual double vtkDecimatePro::GetAbsoluteError (  )  [virtual]

Same as MaximumError, but to be used when ErrorIsAbsolute is 1

virtual void vtkDecimatePro::SetBoundaryVertexDeletion ( int   )  [virtual]

Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.

virtual int vtkDecimatePro::GetBoundaryVertexDeletion (  )  [virtual]

Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::BoundaryVertexDeletionOn (  )  [virtual]

Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::BoundaryVertexDeletionOff (  )  [virtual]

Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.

virtual void vtkDecimatePro::SetDegree ( int   )  [virtual]

If the number of triangles connected to a vertex exceeds "Degree", then the vertex will be split. (NOTE: the complexity of the triangulation algorithm is proportional to Degree^2. Setting degree small can improve the performance of the algorithm.)

virtual int vtkDecimatePro::GetDegree (  )  [virtual]

If the number of triangles connected to a vertex exceeds "Degree", then the vertex will be split. (NOTE: the complexity of the triangulation algorithm is proportional to Degree^2. Setting degree small can improve the performance of the algorithm.)

virtual void vtkDecimatePro::SetInflectionPointRatio ( double   )  [virtual]

Specify the inflection point ratio. An inflection point occurs when the ratio of reduction error between two iterations is greater than or equal to the InflectionPointRatio.

virtual double vtkDecimatePro::GetInflectionPointRatio (  )  [virtual]

Specify the inflection point ratio. An inflection point occurs when the ratio of reduction error between two iterations is greater than or equal to the InflectionPointRatio.

vtkIdType vtkDecimatePro::GetNumberOfInflectionPoints (  ) 

Get the number of inflection points. Only returns a valid value after the filter has executed. The values in the list are mesh reduction values at each inflection point. Note: the first inflection point always occurs right before non-planar triangles are decimated (i.e., as the error becomes non-zero).

void vtkDecimatePro::GetInflectionPoints ( double *  inflectionPoints  ) 

Get a list of inflection points. These are double values 0 < r <= 1.0 corresponding to reduction level, and there are a total of NumberOfInflectionPoints() values. You must provide an array (of the correct size) into which the inflection points are written.

double* vtkDecimatePro::GetInflectionPoints (  ) 

Get a list of inflection points. These are double values 0 < r <= 1.0 corresponding to reduction level, and there are a total of NumberOfInflectionPoints() values. You must provide an array (of the correct size) into which the inflection points are written. This method returns a pointer to a list of inflection points.

int vtkDecimatePro::RequestData ( vtkInformation request,
vtkInformationVector **  inputVector,
vtkInformationVector outputVector 
) [protected, virtual]

This is called by the superclass. This is the method you should override.

Reimplemented from vtkPolyDataAlgorithm.

void vtkDecimatePro::SplitMesh (  )  [protected]

int vtkDecimatePro::EvaluateVertex ( vtkIdType  ptId,
unsigned short int  numTris,
vtkIdType tris,
vtkIdType  fedges[2] 
) [protected]

vtkIdType vtkDecimatePro::FindSplit ( int  type,
vtkIdType  fedges[2],
vtkIdType pt1,
vtkIdType pt2,
vtkIdList CollapseTris 
) [protected]

int vtkDecimatePro::IsValidSplit ( int  index  )  [protected]

void vtkDecimatePro::SplitLoop ( vtkIdType  fedges[2],
vtkIdType n1,
vtkIdType l1,
vtkIdType n2,
vtkIdType l2 
) [protected]

void vtkDecimatePro::SplitVertex ( vtkIdType  ptId,
int  type,
unsigned short int  numTris,
vtkIdType tris,
int  insert 
) [protected]

int vtkDecimatePro::CollapseEdge ( int  type,
vtkIdType  ptId,
vtkIdType  collapseId,
vtkIdType  pt1,
vtkIdType  pt2,
vtkIdList CollapseTris 
) [protected]

void vtkDecimatePro::DistributeError ( double  error  )  [protected]


Friends And Related Function Documentation

friend class VertexArray [friend]

Definition at line 313 of file vtkDecimatePro.h.

friend class TriArray [friend]

Definition at line 336 of file vtkDecimatePro.h.


Member Data Documentation

double vtkDecimatePro::TargetReduction [protected]

Definition at line 255 of file vtkDecimatePro.h.

double vtkDecimatePro::FeatureAngle [protected]

Definition at line 256 of file vtkDecimatePro.h.

double vtkDecimatePro::MaximumError [protected]

Definition at line 257 of file vtkDecimatePro.h.

double vtkDecimatePro::AbsoluteError [protected]

Definition at line 258 of file vtkDecimatePro.h.

Definition at line 259 of file vtkDecimatePro.h.

Definition at line 260 of file vtkDecimatePro.h.

double vtkDecimatePro::SplitAngle [protected]

Definition at line 261 of file vtkDecimatePro.h.

int vtkDecimatePro::Splitting [protected]

Definition at line 262 of file vtkDecimatePro.h.

Definition at line 263 of file vtkDecimatePro.h.

Definition at line 264 of file vtkDecimatePro.h.

Definition at line 265 of file vtkDecimatePro.h.

int vtkDecimatePro::Degree [protected]

Definition at line 266 of file vtkDecimatePro.h.

Definition at line 267 of file vtkDecimatePro.h.

Definition at line 268 of file vtkDecimatePro.h.

Definition at line 271 of file vtkDecimatePro.h.

Definition at line 272 of file vtkDecimatePro.h.


The documentation for this class was generated from the following file:

Generated on Wed Jun 3 18:59:44 2009 for VTK by  doxygen 1.5.6