Main Page Class Hierarchy Alphabetical List Compound List File List Compound Members File Members Related Pages
vtkQuadricClustering Class Reference
reduce the number of triangles in a mesh.
More...
#include <vtkQuadricClustering.h>
Inheritance diagram for vtkQuadricClustering:
[legend]Collaboration diagram for vtkQuadricClustering:
[legend]List of all members.
Public Methods |
virtual const char * | GetClassName () |
virtual int | IsA (const char *type) |
void | PrintSelf (ostream &os, vtkIndent indent) |
virtual void | SetUseFeatureEdges (int) |
virtual int | GetUseFeatureEdges () |
virtual void | UseFeatureEdgesOn () |
virtual void | UseFeatureEdgesOff () |
vtkFeatureEdges * | GetFeatureEdges () |
void | SetNumberOfXDivisions (int num) |
void | SetNumberOfYDivisions (int num) |
void | SetNumberOfZDivisions (int num) |
virtual int | GetNumberOfXDivisions () |
virtual int | GetNumberOfYDivisions () |
virtual int | GetNumberOfZDivisions () |
void | SetNumberOfDivisions (int div[3]) |
int * | GetNumberOfDivisions () |
void | GetNumberOfDivisions (int div[3]) |
void | SetDivisionOrigin (float x, float y, float z) |
void | SetDivisionOrigin (float o[3]) |
virtual float * | GetDivisionOrigin () |
virtual void | GetDivisionOrigin (float &, float &, float &) |
virtual void | GetDivisionOrigin (float[3]) |
void | SetDivisionSpacing (float x, float y, float z) |
void | SetDivisionSpacing (float s[3]) |
virtual float * | GetDivisionSpacing () |
virtual void | GetDivisionSpacing (float &, float &, float &) |
virtual void | GetDivisionSpacing (float[3]) |
virtual void | SetUseInputPoints (int) |
virtual int | GetUseInputPoints () |
virtual void | UseInputPointsOn () |
virtual void | UseInputPointsOff () |
void | StartAppend (float *bounds) |
void | StartAppend (float x0, float x1, float y0, float y1, float z0, float z1) |
void | Append (vtkPolyData *piece) |
void | EndAppend () |
Static Public Methods |
int | IsTypeOf (const char *type) |
vtkQuadricClustering * | SafeDownCast (vtkObject *o) |
vtkQuadricClustering * | New () |
Protected Methods |
| vtkQuadricClustering () |
| ~vtkQuadricClustering () |
| vtkQuadricClustering (const vtkQuadricClustering &) |
void | operator= (const vtkQuadricClustering &) |
void | Execute () |
int | HashPoint (float point[3]) |
void | ComputeRepresentativePoint (float quadric[9], int binId, float point[3]) |
void | AddTriangles (vtkCellArray *edges, vtkPoints *points, int geometryFlag) |
void | AddTriangle (int *binIds, float *pt0, float *pt1, float *pt2, int geometeryFlag) |
void | AddEdges (vtkCellArray *edges, vtkPoints *points, int geometryFlag) |
void | AddEdge (int *binIds, float *pt0, float *pt1, int geometeryFlag) |
void | AddVerticies (vtkCellArray *verts, vtkPoints *points, int geometryFlag) |
void | AddVertex (int binId, float *pt, int geometeryFlag) |
void | InitializeQuadric (float quadric[9]) |
void | AddQuadric (int binId, float quadric[9]) |
void | EndAppendUsingPoints (vtkPolyData *input) |
void | AppendFeatureQuadrics (vtkPolyData *pd) |
Protected Attributes |
int | UseInputPoints |
int | UseFeatureEdges |
int | NumberOfXDivisions |
int | NumberOfYDivisions |
int | NumberOfZDivisions |
int | ComputeNumberOfDivisions |
float | DivisionOrigin [3] |
float | DivisionSpacing [3] |
float | Bounds [6] |
float | XBinSize |
float | YBinSize |
float | ZBinSize |
VTK_POINT_QUADRIC * | QuadricArray |
int | NumberOfBinsUsed |
vtkCellArray * | OutputTriangleArray |
vtkCellArray * | OutputLines |
vtkCellArray * | OutputVerts |
vtkFeatureEdges * | FeatureEdges |
Detailed Description
reduce the number of triangles in a mesh.
-
Date:
-
2000/12/10 20:08:48
-
Revision:
-
1.16
vtkQuadricClustering is a filter to reduce the number of triangles in a triangle mesh, forming a good approximation to the original geometry. The input to vtkQuadricClustering is a vtkPolyData object, and only triangles are treated. If you desire to decimate polygonal meshes, first triangulate the polygons with vtkTriangleFilter object.
The algorithm used is the one described by Peter Lindstrom in his Siggraph 2000 paper, "Out-of-Core Simplification of Large Polygonal Models." The general approach of the algorithm is to cluster vertices in a uniform binning of space, accumulating the quadric of each triangle (pushed out to the triangles vertices) within each bin, and then determining an optimal position for a single vertex in a bin by using the accumulated quadric. In more detail, the algorithm first gets the bounds of the input poly data. It then breaks this bounding volume into a user-specified number of spatial bins. It then reads each triangle from the input and hashes its vertices into these bins. (If this is the first time a bin has been visited, initialize its quadric to the 0 matrix.) The algorithm computes the error quadric for this triangle and adds it to the existing quadric of the bin in which each vertex is contained. Then, if 2 or more vertices of the triangle fall in the same bin, the triangle is dicarded. If the triangle is not discarded, it adds the triangle to the list of output triangles as a list of vertex identifiers. (There is one vertex id per bin.) After all the triangles have been read, the representative vertex for each bin is computed (an optimal location is found) using the quadric for that bin. This determines the spatial location of the vertices of each of the triangles in the output.
To use this filter, specify the divisions defining the spatial subdivision in the x, y, and z directions. You must also specify an input vtkPolyData.
This filter can take multiple inputs. To do this, the user must explicity call StartAppend, Append (once for each input), and EndAppend. StartAppend sets up the data structure to hold the quadric matrices. Append processes each triangle in the input poly data it was called on, hashes its vertices to the appropriate bins, determines whether to keep this triangle, and updates the appropriate quadric matrices. EndAppend determines the spatial location of each of the representative vertices for the visited bins.
-
Warning:
-
This filter can drastically affect topology, i.e., topology is not preserved.
-
See also:
-
vtkDecimatePro vtkDecimate
-
Examples:
-
vtkQuadricClustering (examples)
Definition at line 110 of file vtkQuadricClustering.h.
Constructor & Destructor Documentation
vtkQuadricClustering::vtkQuadricClustering |
( |
|
) |
[protected] |
|
vtkQuadricClustering::~vtkQuadricClustering |
( |
|
) |
[protected] |
|
vtkQuadricClustering::vtkQuadricClustering |
( |
const vtkQuadricClustering & |
|
) |
[inline, protected] |
|
Member Function Documentation
virtual const char* vtkQuadricClustering::GetClassName |
( |
|
) |
[virtual] |
|
int vtkQuadricClustering::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 vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkPolyDataToPolyDataFilter. |
virtual int vtkQuadricClustering::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 vtkTypeMacro found in vtkSetGet.h.
Reimplemented from vtkPolyDataToPolyDataFilter. |
vtkQuadricClustering* vtkQuadricClustering::SafeDownCast |
( |
vtkObject * |
o |
) |
[static] |
|
void vtkQuadricClustering::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 vtkSource. |
vtkQuadricClustering* vtkQuadricClustering::New |
( |
|
) |
[static] |
|
|
Instantiate object with no start, end, or progress methods.
Reimplemented from vtkPolyDataSource. |
virtual void vtkQuadricClustering::SetUseFeatureEdges |
( |
int |
|
) |
[virtual] |
|
|
By default, this flag is off. When "UseFeatureEdges" is on, then quadrics are computed for boundary edges/feature edges. The influence the quadrics (position of points), but not the mesh. Which features to use can be controlled buy the filter "FeatureEdges". |
virtual int vtkQuadricClustering::GetUseFeatureEdges |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::UseFeatureEdgesOn |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::UseFeatureEdgesOff |
( |
|
) |
[virtual] |
|
void vtkQuadricClustering::SetNumberOfXDivisions |
( |
int |
num |
) |
|
|
|
Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. |
void vtkQuadricClustering::SetNumberOfYDivisions |
( |
int |
num |
) |
|
|
void vtkQuadricClustering::SetNumberOfZDivisions |
( |
int |
num |
) |
|
|
virtual int vtkQuadricClustering::GetNumberOfXDivisions |
( |
|
) |
[virtual] |
|
virtual int vtkQuadricClustering::GetNumberOfYDivisions |
( |
|
) |
[virtual] |
|
virtual int vtkQuadricClustering::GetNumberOfZDivisions |
( |
|
) |
[virtual] |
|
void vtkQuadricClustering::SetNumberOfDivisions |
( |
int |
div[3] |
) |
|
|
int* vtkQuadricClustering::GetNumberOfDivisions |
( |
|
) |
|
|
void vtkQuadricClustering::GetNumberOfDivisions |
( |
int |
div[3] |
) |
|
|
void vtkQuadricClustering::SetDivisionOrigin |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
|
|
|
This is an alternative way to set up the bins. If you are trying to match boundaries between pieces, then you should use these methods rather than SetNumberOfDivisions. |
void vtkQuadricClustering::SetDivisionOrigin |
( |
float |
o[3] |
) |
[inline] |
|
virtual float* vtkQuadricClustering::GetDivisionOrigin |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::GetDivisionOrigin |
( |
float & |
, |
|
|
float & |
, |
|
|
float & |
|
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::GetDivisionOrigin |
( |
float |
[3] |
) |
[virtual] |
|
void vtkQuadricClustering::SetDivisionSpacing |
( |
float |
x, |
|
|
float |
y, |
|
|
float |
z |
|
) |
|
|
void vtkQuadricClustering::SetDivisionSpacing |
( |
float |
s[3] |
) |
[inline] |
|
virtual float* vtkQuadricClustering::GetDivisionSpacing |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::GetDivisionSpacing |
( |
float & |
, |
|
|
float & |
, |
|
|
float & |
|
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::GetDivisionSpacing |
( |
float |
[3] |
) |
[virtual] |
|
virtual void vtkQuadricClustering::SetUseInputPoints |
( |
int |
|
) |
[virtual] |
|
|
Normally the point that minimizes the quadric error function is used as the output of the bin. When this flag is on, the bin point is forced to be one of the points from the input (the one with the smallest error). This option does not work when the append methods are being called directly. |
virtual int vtkQuadricClustering::GetUseInputPoints |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::UseInputPointsOn |
( |
|
) |
[virtual] |
|
virtual void vtkQuadricClustering::UseInputPointsOff |
( |
|
) |
[virtual] |
|
void vtkQuadricClustering::StartAppend |
( |
float * |
bounds |
) |
|
|
|
These methods provide an alternative way of executing the filter. PolyData can be added to the result in pieces (append). In this mode, the user must specify the bounds of the entire model as an argument to the "StartAppend" method. |
void vtkQuadricClustering::StartAppend |
( |
float |
x0, |
|
|
float |
x1, |
|
|
float |
y0, |
|
|
float |
y1, |
|
|
float |
z0, |
|
|
float |
z1 |
|
) |
[inline] |
|
void vtkQuadricClustering::Append |
( |
vtkPolyData * |
piece |
) |
|
|
void vtkQuadricClustering::EndAppend |
( |
|
) |
|
|
void vtkQuadricClustering::operator= |
( |
const vtkQuadricClustering & |
|
) |
[inline, protected] |
|
void vtkQuadricClustering::Execute |
( |
|
) |
[protected, virtual] |
|
int vtkQuadricClustering::HashPoint |
( |
float |
point[3] |
) |
[protected] |
|
|
Given a point, determine what bin it falls into. |
void vtkQuadricClustering::ComputeRepresentativePoint |
( |
float |
quadric[9], |
|
|
int |
binId, |
|
|
float |
point[3] |
|
) |
[protected] |
|
|
Determine the representative point for this bin. |
void vtkQuadricClustering::AddTriangles |
( |
vtkCellArray * |
edges, |
|
|
vtkPoints * |
points, |
|
|
int |
geometryFlag |
|
) |
[protected] |
|
|
Add triangles to the quadric array. If geometry flag is on then triangles are added to the output. |
void vtkQuadricClustering::AddTriangle |
( |
int * |
binIds, |
|
|
float * |
pt0, |
|
|
float * |
pt1, |
|
|
float * |
pt2, |
|
|
int |
geometeryFlag |
|
) |
[protected] |
|
void vtkQuadricClustering::AddEdges |
( |
vtkCellArray * |
edges, |
|
|
vtkPoints * |
points, |
|
|
int |
geometryFlag |
|
) |
[protected] |
|
|
Add edges to the quadric array. If geometry flag is on then edges are added to the output. |
void vtkQuadricClustering::AddEdge |
( |
int * |
binIds, |
|
|
float * |
pt0, |
|
|
float * |
pt1, |
|
|
int |
geometeryFlag |
|
) |
[protected] |
|
void vtkQuadricClustering::AddVerticies |
( |
vtkCellArray * |
verts, |
|
|
vtkPoints * |
points, |
|
|
int |
geometryFlag |
|
) |
[protected] |
|
|
Add verticies to the quadric array. If geometry flag is on then verticies are added to the output. |
void vtkQuadricClustering::AddVertex |
( |
int |
binId, |
|
|
float * |
pt, |
|
|
int |
geometeryFlag |
|
) |
[protected] |
|
void vtkQuadricClustering::InitializeQuadric |
( |
float |
quadric[9] |
) |
[protected] |
|
|
Initialize the quadric matrix to 0's. |
void vtkQuadricClustering::AddQuadric |
( |
int |
binId, |
|
|
float |
quadric[9] |
|
) |
[protected] |
|
|
Add this quadric to the quadric already associated with this bin. |
void vtkQuadricClustering::EndAppendUsingPoints |
( |
vtkPolyData * |
input |
) |
[protected] |
|
|
This method will rep[lace the quadric generated points with the input points with the lowest error. |
void vtkQuadricClustering::AppendFeatureQuadrics |
( |
vtkPolyData * |
pd |
) |
[protected] |
|
Member Data Documentation
int vtkQuadricClustering::UseInputPoints [protected]
|
|
int vtkQuadricClustering::UseFeatureEdges [protected]
|
|
int vtkQuadricClustering::NumberOfXDivisions [protected]
|
|
int vtkQuadricClustering::NumberOfYDivisions [protected]
|
|
int vtkQuadricClustering::NumberOfZDivisions [protected]
|
|
int vtkQuadricClustering::ComputeNumberOfDivisions [protected]
|
|
float vtkQuadricClustering::DivisionOrigin[3] [protected]
|
|
float vtkQuadricClustering::DivisionSpacing[3] [protected]
|
|
float vtkQuadricClustering::Bounds[6] [protected]
|
|
float vtkQuadricClustering::XBinSize [protected]
|
|
float vtkQuadricClustering::YBinSize [protected]
|
|
float vtkQuadricClustering::ZBinSize [protected]
|
|
int vtkQuadricClustering::NumberOfBinsUsed [protected]
|
|
vtkCellArray* vtkQuadricClustering::OutputTriangleArray [protected]
|
|
The documentation for this class was generated from the following file:
Generated on Wed Nov 21 12:58:16 2001 for VTK by
1.2.11.1 written by Dimitri van Heesch,
© 1997-2001