Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

vtkQuadricDecimation Class Reference

#include <vtkQuadricDecimation.h>

Inheritance diagram for vtkQuadricDecimation:

vtkPolyDataToPolyDataFilter vtkPolyDataSource vtkSource vtkProcessObject vtkObject vtkObjectBase List of all members.

Detailed Description

reduce the number of triangles in a mesh

Date
2003/11/07 16:07:10
Revision
1.15.2.1

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

The algorithm is based on repeated edge collapses until the requested mesh reduction is achieved. Edges are placed in a priority queue based on the "cost" to delete the edge. The cost is an approximate measure of error (distance to the original surface)--described by the so-called quadric error measure. The quadric error measure is associated with each vertex of the mesh and represents a matrix of planes incident on that vertex. The distance of the planes to the vertex is the error in the position of the vertex (originally the vertex error iz zero). As edges are deleted, the quadric error measure associated with the two end points of the edge are summed (this combines the plane equations) and an optimal collapse point can be computed. Edges connected to the collapse point are then reinserted into the queue after computing the new cost to delete them. The process continues until the desired reduction level is reached or topological constraints prevent further reduction. Note that this basic algorithm can be extended to higher dimensions by taking into account variation in attributes (i.e., scalars, vectors, and so on).

This paper is based on the work of Garland and Heckbert who first presented the quadric error measure at Siggraph '97 "Surface Simplification Using Quadric Error Metrics". For details of the algorithm Michael Garland's Ph.D. thesis is also recommended. Hughues Hoppe's Vis '99 paper, "New Quadric Metric for Simplifying Meshes with Appearance Attributes" is also a good take on the subject especially as it pertains to the error metric applied to attributes.

Thanks:
Thanks to Bradley Lowekamp of the National Library of Medicine/NIH for contributing this class.
Tests:
vtkQuadricDecimation (Tests)

Definition at line 73 of file vtkQuadricDecimation.h.

Public Types

typedef vtkPolyDataToPolyDataFilter Superclass

Public Member Functions

virtual const char * GetClassName ()
virtual int IsA (const char *type)
void PrintSelf (ostream &os, vtkIndent indent)
virtual void SetTargetReduction (float)
virtual float GetTargetReduction ()
virtual void SetAttributeErrorMetric (int)
virtual int GetAttributeErrorMetric ()
virtual void AttributeErrorMetricOn ()
virtual void AttributeErrorMetricOff ()
virtual void SetScalarsAttribute (int)
virtual int GetScalarsAttribute ()
virtual void ScalarsAttributeOn ()
virtual void ScalarsAttributeOff ()
virtual void SetVectorsAttribute (int)
virtual int GetVectorsAttribute ()
virtual void VectorsAttributeOn ()
virtual void VectorsAttributeOff ()
virtual void SetNormalsAttribute (int)
virtual int GetNormalsAttribute ()
virtual void NormalsAttributeOn ()
virtual void NormalsAttributeOff ()
virtual void SetTCoordsAttribute (int)
virtual int GetTCoordsAttribute ()
virtual void TCoordsAttributeOn ()
virtual void TCoordsAttributeOff ()
virtual void SetTensorsAttribute (int)
virtual int GetTensorsAttribute ()
virtual void TensorsAttributeOn ()
virtual void TensorsAttributeOff ()
virtual void SetScalarsWeight (float)
virtual void SetVectorsWeight (float)
virtual void SetNormalsWeight (float)
virtual void SetTCoordsWeight (float)
virtual void SetTensorsWeight (float)
virtual float GetScalarsWeight ()
virtual float GetVectorsWeight ()
virtual float GetNormalsWeight ()
virtual float GetTCoordsWeight ()
virtual float GetTensorsWeight ()
virtual float GetActualReduction ()

Static Public Member Functions

static int IsTypeOf (const char *type)
static vtkQuadricDecimationSafeDownCast (vtkObject *o)
static vtkQuadricDecimationNew ()

Protected Member Functions

 vtkQuadricDecimation ()
 ~vtkQuadricDecimation ()
void Execute ()
int CollapseEdge (vtkIdType pt0Id, vtkIdType pt1Id)
void InitializeQuadrics (vtkIdType numPts)
void AddBoundaryConstraints (void)
void ComputeQuadric (vtkIdType pointId)
void AddQuadric (vtkIdType oldPtId, vtkIdType newPtId)
void FindAffectedEdges (vtkIdType p1Id, vtkIdType p2Id, vtkIdList *edges)
vtkIdType GetEdgeCellId (vtkIdType p1Id, vtkIdType p2Id)
int IsGoodPlacement (vtkIdType pt0Id, vtkIdType pt1Id, const double *x)
int TrianglePlaneCheck (const float t0[3], const float t1[3], const float t2[3], const double *x)
void ComputeNumberOfComponents (void)
void UpdateEdgeData (vtkIdType ptoId, vtkIdType pt1Id)
void GetAttributeComponents ()
double ComputeCost (vtkIdType edgeId, double *x)
double ComputeCost2 (vtkIdType edgeId, double *x)
void SetPointAttributeArray (vtkIdType ptId, const double *x)
void GetPointAttributeArray (vtkIdType ptId, double *x)

Protected Attributes

float TargetReduction
float ActualReduction
int AttributeErrorMetric
int ScalarsAttribute
int VectorsAttribute
int NormalsAttribute
int TCoordsAttribute
int TensorsAttribute
float ScalarsWeight
float VectorsWeight
float NormalsWeight
float TCoordsWeight
float TensorsWeight
int NumberOfEdgeCollapses
vtkEdgeTableEdges
vtkIdListEndPoint1List
vtkIdListEndPoint2List
vtkPriorityQueueEdgeCosts
vtkFloatArrayTargetPoints
int NumberOfComponents
vtkPolyDataMesh
ErrorQuadricErrorQuadrics
int AttributeComponents [6]
double AttributeScale [6]
vtkIdListCollapseCellIds
double * TempX
double * TempQuad
double * TempB
double ** TempA
double * TempData

Classes

struct  ErrorQuadric


Member Typedef Documentation

typedef vtkPolyDataToPolyDataFilter vtkQuadricDecimation::Superclass
 

Reimplemented from vtkPolyDataToPolyDataFilter.

Definition at line 76 of file vtkQuadricDecimation.h.


Constructor & Destructor Documentation

vtkQuadricDecimation::vtkQuadricDecimation  )  [protected]
 

vtkQuadricDecimation::~vtkQuadricDecimation  )  [protected]
 


Member Function Documentation

virtual const char* vtkQuadricDecimation::GetClassName  )  [virtual]
 

Reimplemented from vtkPolyDataToPolyDataFilter.

static int vtkQuadricDecimation::IsTypeOf const char *  type  )  [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 vtkPolyDataToPolyDataFilter.

virtual int vtkQuadricDecimation::IsA const char *  type  )  [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 vtkPolyDataToPolyDataFilter.

static vtkQuadricDecimation* vtkQuadricDecimation::SafeDownCast vtkObject o  )  [static]
 

Reimplemented from vtkPolyDataToPolyDataFilter.

void vtkQuadricDecimation::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 vtkPolyDataToPolyDataFilter.

static vtkQuadricDecimation* vtkQuadricDecimation::New  )  [static]
 

Create an object with Debug turned off, modified time initialized to zero, and reference counting on.

Reimplemented from vtkObject.

virtual void vtkQuadricDecimation::SetTargetReduction float   )  [virtual]
 

Set/Get the desired reduction (expressed as a fraction of the original number of triangles). The actual reduction may be less depending on triangulation and topological constraints.

virtual float vtkQuadricDecimation::GetTargetReduction  )  [virtual]
 

Set/Get the desired reduction (expressed as a fraction of the original number of triangles). The actual reduction may be less depending on triangulation and topological constraints.

virtual void vtkQuadricDecimation::SetAttributeErrorMetric int   )  [virtual]
 

Decide whether to include data attributes in the error metric. If off, then only geometric error is used to control the decimation. By default the attribute errors are off.

virtual int vtkQuadricDecimation::GetAttributeErrorMetric  )  [virtual]
 

Decide whether to include data attributes in the error metric. If off, then only geometric error is used to control the decimation. By default the attribute errors are off.

virtual void vtkQuadricDecimation::AttributeErrorMetricOn  )  [virtual]
 

Decide whether to include data attributes in the error metric. If off, then only geometric error is used to control the decimation. By default the attribute errors are off.

virtual void vtkQuadricDecimation::AttributeErrorMetricOff  )  [virtual]
 

Decide whether to include data attributes in the error metric. If off, then only geometric error is used to control the decimation. By default the attribute errors are off.

virtual void vtkQuadricDecimation::SetScalarsAttribute int   )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual int vtkQuadricDecimation::GetScalarsAttribute  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::ScalarsAttributeOn  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::ScalarsAttributeOff  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::SetVectorsAttribute int   )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual int vtkQuadricDecimation::GetVectorsAttribute  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::VectorsAttributeOn  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::VectorsAttributeOff  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::SetNormalsAttribute int   )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual int vtkQuadricDecimation::GetNormalsAttribute  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::NormalsAttributeOn  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::NormalsAttributeOff  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::SetTCoordsAttribute int   )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual int vtkQuadricDecimation::GetTCoordsAttribute  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::TCoordsAttributeOn  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::TCoordsAttributeOff  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::SetTensorsAttribute int   )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual int vtkQuadricDecimation::GetTensorsAttribute  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::TensorsAttributeOn  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::TensorsAttributeOff  )  [virtual]
 

If attribute errors are to be included in the metric (i.e., AttributeErrorMetric is on), then the following flags control which attributes are to be included in the error calculation. By default all of these are on.

virtual void vtkQuadricDecimation::SetScalarsWeight float   )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual void vtkQuadricDecimation::SetVectorsWeight float   )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual void vtkQuadricDecimation::SetNormalsWeight float   )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual void vtkQuadricDecimation::SetTCoordsWeight float   )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual void vtkQuadricDecimation::SetTensorsWeight float   )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetScalarsWeight  )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetVectorsWeight  )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetNormalsWeight  )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetTCoordsWeight  )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetTensorsWeight  )  [virtual]
 

Set/Get the scaling weight contribution of the attribute. These values are used to weight the contribution of the attributes towards the error metric.

virtual float vtkQuadricDecimation::GetActualReduction  )  [virtual]
 

Get the actual reduction. This value is only valid after the filter has executed.

void vtkQuadricDecimation::Execute  )  [protected, virtual]
 

This method is the old style execute method

Reimplemented from vtkSource.

int vtkQuadricDecimation::CollapseEdge vtkIdType  pt0Id,
vtkIdType  pt1Id
[protected]
 

Do the dirty work of eliminating the edge; return the number of triangles deleted.

void vtkQuadricDecimation::InitializeQuadrics vtkIdType  numPts  )  [protected]
 

Compute quadric for all vertices

void vtkQuadricDecimation::AddBoundaryConstraints void   )  [protected]
 

Free boundary edges are weighted

void vtkQuadricDecimation::ComputeQuadric vtkIdType  pointId  )  [protected]
 

Compute quadric for this vertex.

void vtkQuadricDecimation::AddQuadric vtkIdType  oldPtId,
vtkIdType  newPtId
[protected]
 

Add the quadrics for these 2 points since the edge between them has been collapsed.

double vtkQuadricDecimation::ComputeCost vtkIdType  edgeId,
double *  x
[protected]
 

Compute cost for contracting this edge and the point that gives us this cost.

double vtkQuadricDecimation::ComputeCost2 vtkIdType  edgeId,
double *  x
[protected]
 

Compute cost for contracting this edge and the point that gives us this cost.

void vtkQuadricDecimation::FindAffectedEdges vtkIdType  p1Id,
vtkIdType  p2Id,
vtkIdList edges
[protected]
 

Find all edges that will have an endpoint change ids because of an edge collapse. p1Id and p2Id are the endpoints of the edge. p2Id is the pointId being removed.

vtkIdType vtkQuadricDecimation::GetEdgeCellId vtkIdType  p1Id,
vtkIdType  p2Id
[protected]
 

Find a cell that uses this edge.

int vtkQuadricDecimation::IsGoodPlacement vtkIdType  pt0Id,
vtkIdType  pt1Id,
const double *  x
[protected]
 

int vtkQuadricDecimation::TrianglePlaneCheck const float  t0[3],
const float  t1[3],
const float  t2[3],
const double *  x
[protected]
 

void vtkQuadricDecimation::ComputeNumberOfComponents void   )  [protected]
 

void vtkQuadricDecimation::UpdateEdgeData vtkIdType  ptoId,
vtkIdType  pt1Id
[protected]
 

void vtkQuadricDecimation::SetPointAttributeArray vtkIdType  ptId,
const double *  x
[protected]
 

Helper function to set and get the point and it's attributes as an array

void vtkQuadricDecimation::GetPointAttributeArray vtkIdType  ptId,
double *  x
[protected]
 

Helper function to set and get the point and it's attributes as an array

void vtkQuadricDecimation::GetAttributeComponents  )  [protected]
 

Find out how many components there are for each attribute for this poly data.


Member Data Documentation

float vtkQuadricDecimation::TargetReduction [protected]
 

Definition at line 196 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::ActualReduction [protected]
 

Definition at line 197 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::AttributeErrorMetric [protected]
 

Definition at line 198 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::ScalarsAttribute [protected]
 

Definition at line 200 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::VectorsAttribute [protected]
 

Definition at line 201 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::NormalsAttribute [protected]
 

Definition at line 202 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::TCoordsAttribute [protected]
 

Definition at line 203 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::TensorsAttribute [protected]
 

Definition at line 204 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::ScalarsWeight [protected]
 

Definition at line 206 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::VectorsWeight [protected]
 

Definition at line 207 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::NormalsWeight [protected]
 

Definition at line 208 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::TCoordsWeight [protected]
 

Definition at line 209 of file vtkQuadricDecimation.h.

float vtkQuadricDecimation::TensorsWeight [protected]
 

Definition at line 210 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::NumberOfEdgeCollapses [protected]
 

Definition at line 212 of file vtkQuadricDecimation.h.

vtkEdgeTable* vtkQuadricDecimation::Edges [protected]
 

Definition at line 213 of file vtkQuadricDecimation.h.

vtkIdList* vtkQuadricDecimation::EndPoint1List [protected]
 

Definition at line 214 of file vtkQuadricDecimation.h.

vtkIdList* vtkQuadricDecimation::EndPoint2List [protected]
 

Definition at line 215 of file vtkQuadricDecimation.h.

vtkPriorityQueue* vtkQuadricDecimation::EdgeCosts [protected]
 

Definition at line 216 of file vtkQuadricDecimation.h.

vtkFloatArray* vtkQuadricDecimation::TargetPoints [protected]
 

Definition at line 217 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::NumberOfComponents [protected]
 

Definition at line 218 of file vtkQuadricDecimation.h.

vtkPolyData* vtkQuadricDecimation::Mesh [protected]
 

Definition at line 219 of file vtkQuadricDecimation.h.

ErrorQuadric* vtkQuadricDecimation::ErrorQuadrics [protected]
 

Definition at line 228 of file vtkQuadricDecimation.h.

int vtkQuadricDecimation::AttributeComponents[6] [protected]
 

Definition at line 229 of file vtkQuadricDecimation.h.

double vtkQuadricDecimation::AttributeScale[6] [protected]
 

Definition at line 230 of file vtkQuadricDecimation.h.

vtkIdList* vtkQuadricDecimation::CollapseCellIds [protected]
 

Definition at line 233 of file vtkQuadricDecimation.h.

double* vtkQuadricDecimation::TempX [protected]
 

Definition at line 234 of file vtkQuadricDecimation.h.

double* vtkQuadricDecimation::TempQuad [protected]
 

Definition at line 235 of file vtkQuadricDecimation.h.

double* vtkQuadricDecimation::TempB [protected]
 

Definition at line 236 of file vtkQuadricDecimation.h.

double** vtkQuadricDecimation::TempA [protected]
 

Definition at line 237 of file vtkQuadricDecimation.h.

double* vtkQuadricDecimation::TempData [protected]
 

Definition at line 238 of file vtkQuadricDecimation.h.


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