FreeMat: vtkQuadricClustering

FreeMat

- Main Page
- Related Pages

vtkQuadricClustering

Section: Visualization Toolkit Graphics Classes

# Usage

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 all types of polygonal data are handled.

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. Then choose to either 1) use the original points that minimize the quadric error to produce the output triangles or 2) compute an optimal position in each bin to produce the output triangles (recommended and default behavior).

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. While this approach does not fit into the visualization architecture and requires manual control, it has the advantage that extremely large data can be processed in pieces and appended to the filter piece-by-piece.

To create an instance of class vtkQuadricClustering, simply invoke its constructor as follows

      obj = vtkQuadricClustering

# Methods

The class vtkQuadricClustering has several methods that can be used. They are listed below. Note that the documentation is translated automatically from the VTK sources, and may not be completely intelligible. When in doubt, consult the VTK website. In the methods listed below, `obj` is an instance of the vtkQuadricClustering class.

- `string = obj.GetClassName ()` - Standard instantition, type and print methods.
- `int = obj.IsA (string name)` - Standard instantition, type and print methods.
- `vtkQuadricClustering = obj.NewInstance ()` - Standard instantition, type and print methods.
- `vtkQuadricClustering = obj.SafeDownCast (vtkObject o)` - Standard instantition, type and print methods.
- `obj.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. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.SetNumberOfYDivisions (int num)` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.SetNumberOfZDivisions (int num)` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `int = obj.GetNumberOfXDivisions ()` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `int = obj.GetNumberOfYDivisions ()` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `int = obj.GetNumberOfZDivisions ()` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.SetNumberOfDivisions (int div[3])` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.SetNumberOfDivisions (int div0, int div1, int div2)` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `int = obj.GetNumberOfDivisions ()` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.GetNumberOfDivisions (int div[3])` - Set/Get the number of divisions along each axis for the spatial bins. The number of spatial bins is NumberOfXDivisions*NumberOfYDivisions* NumberOfZDivisions. The filter may choose to ignore large numbers of divisions if the input has few points and AutoAdjustNumberOfDivisions is enabled.
- `obj.SetAutoAdjustNumberOfDivisions (int )` - Enable automatic adjustment of number of divisions. If off, the number of divisions specified by the user is always used (as long as it is valid). The default is On
- `int = obj.GetAutoAdjustNumberOfDivisions ()` - Enable automatic adjustment of number of divisions. If off, the number of divisions specified by the user is always used (as long as it is valid). The default is On
- `obj.AutoAdjustNumberOfDivisionsOn ()` - Enable automatic adjustment of number of divisions. If off, the number of divisions specified by the user is always used (as long as it is valid). The default is On
- `obj.AutoAdjustNumberOfDivisionsOff ()` - Enable automatic adjustment of number of divisions. If off, the number of divisions specified by the user is always used (as long as it is valid). The default is On
- `obj.SetDivisionOrigin (double x, double y, double 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. To use these methods, specify the origin and spacing of the spatial binning.
- `obj.SetDivisionOrigin (double o[3])` - 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. To use these methods, specify the origin and spacing of the spatial binning.
- `double = obj. GetDivisionOrigin ()` - 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. To use these methods, specify the origin and spacing of the spatial binning.
- `obj.SetDivisionSpacing (double x, double y, double 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. To use these methods, specify the origin and spacing of the spatial binning.
- `obj.SetDivisionSpacing (double s[3])` - 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. To use these methods, specify the origin and spacing of the spatial binning.
- `double = obj. GetDivisionSpacing ()` - 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. To use these methods, specify the origin and spacing of the spatial binning.
- `obj.SetUseInputPoints (int )` - 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 (i.e., input points cannot be used) when the append methods (StartAppend(), Append(), EndAppend()) are being called directly.
- `int = obj.GetUseInputPoints ()` - 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 (i.e., input points cannot be used) when the append methods (StartAppend(), Append(), EndAppend()) are being called directly.
- `obj.UseInputPointsOn ()` - 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 (i.e., input points cannot be used) when the append methods (StartAppend(), Append(), EndAppend()) are being called directly.
- `obj.UseInputPointsOff ()` - 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 (i.e., input points cannot be used) when the append methods (StartAppend(), Append(), EndAppend()) are being called directly.
- `obj.SetUseFeatureEdges (int )` - By default, this flag is off. When "UseFeatureEdges" is on, then quadrics are computed for boundary edges/feature edges. They influence the quadrics (position of points), but not the mesh. Which features to use can be controlled by the filter "FeatureEdges".
- `int = obj.GetUseFeatureEdges ()` - By default, this flag is off. When "UseFeatureEdges" is on, then quadrics are computed for boundary edges/feature edges. They influence the quadrics (position of points), but not the mesh. Which features to use can be controlled by the filter "FeatureEdges".
- `obj.UseFeatureEdgesOn ()` - By default, this flag is off. When "UseFeatureEdges" is on, then quadrics are computed for boundary edges/feature edges. They influence the quadrics (position of points), but not the mesh. Which features to use can be controlled by the filter "FeatureEdges".
- `obj.UseFeatureEdgesOff ()` - By default, this flag is off. When "UseFeatureEdges" is on, then quadrics are computed for boundary edges/feature edges. They influence the quadrics (position of points), but not the mesh. Which features to use can be controlled by the filter "FeatureEdges".
- `vtkFeatureEdges = obj.GetFeatureEdges ()` - By default, this flag is off. It only has an effect when "UseFeatureEdges" is also on. When "UseFeaturePoints" is on, then quadrics are computed for boundary / feature points used in the boundary / feature edges. They influence the quadrics (position of points), but not the mesh.
- `obj.SetUseFeaturePoints (int )` - By default, this flag is off. It only has an effect when "UseFeatureEdges" is also on. When "UseFeaturePoints" is on, then quadrics are computed for boundary / feature points used in the boundary / feature edges. They influence the quadrics (position of points), but not the mesh.
- `int = obj.GetUseFeaturePoints ()` - By default, this flag is off. It only has an effect when "UseFeatureEdges" is also on. When "UseFeaturePoints" is on, then quadrics are computed for boundary / feature points used in the boundary / feature edges. They influence the quadrics (position of points), but not the mesh.
- `obj.UseFeaturePointsOn ()` - By default, this flag is off. It only has an effect when "UseFeatureEdges" is also on. When "UseFeaturePoints" is on, then quadrics are computed for boundary / feature points used in the boundary / feature edges. They influence the quadrics (position of points), but not the mesh.
- `obj.UseFeaturePointsOff ()` - By default, this flag is off. It only has an effect when "UseFeatureEdges" is also on. When "UseFeaturePoints" is on, then quadrics are computed for boundary / feature points used in the boundary / feature edges. They influence the quadrics (position of points), but not the mesh.
- `obj.SetFeaturePointsAngle (double )` - Set/Get the angle to use in determining whether a point on a boundary / feature edge is a feature point.
- `double = obj.GetFeaturePointsAngleMinValue ()` - Set/Get the angle to use in determining whether a point on a boundary / feature edge is a feature point.
- `double = obj.GetFeaturePointsAngleMaxValue ()` - Set/Get the angle to use in determining whether a point on a boundary / feature edge is a feature point.
- `double = obj.GetFeaturePointsAngle ()` - Set/Get the angle to use in determining whether a point on a boundary / feature edge is a feature point.
- `obj.SetUseInternalTriangles (int )` - When this flag is on (and it is on by default), then triangles that are completely contained in a bin are added to the bin quadrics. When the the flag is off the filter operates faster, but the surface may not be as well behaved.
- `int = obj.GetUseInternalTriangles ()` - When this flag is on (and it is on by default), then triangles that are completely contained in a bin are added to the bin quadrics. When the the flag is off the filter operates faster, but the surface may not be as well behaved.
- `obj.UseInternalTrianglesOn ()` - When this flag is on (and it is on by default), then triangles that are completely contained in a bin are added to the bin quadrics. When the the flag is off the filter operates faster, but the surface may not be as well behaved.
- `obj.UseInternalTrianglesOff ()` - When this flag is on (and it is on by default), then triangles that are completely contained in a bin are added to the bin quadrics. When the the flag is off the filter operates faster, but the surface may not be as well behaved.
- `obj.StartAppend (double 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.
- `obj.StartAppend (double x0, double x1, double y0, double y1, double z0, double z1)` - 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.
- `obj.Append (vtkPolyData piece)` - 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.
- `obj.EndAppend ()` - 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.
- `obj.SetCopyCellData (int )` - This flag makes the filter copy cell data from input to output (the best it can). It uses input cells that trigger the addition of output cells (no averaging). This is off by default, and does not work when append is being called explicitely (non-pipeline usage).
- `int = obj.GetCopyCellData ()` - This flag makes the filter copy cell data from input to output (the best it can). It uses input cells that trigger the addition of output cells (no averaging). This is off by default, and does not work when append is being called explicitely (non-pipeline usage).
- `obj.CopyCellDataOn ()` - This flag makes the filter copy cell data from input to output (the best it can). It uses input cells that trigger the addition of output cells (no averaging). This is off by default, and does not work when append is being called explicitely (non-pipeline usage).
- `obj.CopyCellDataOff ()` - This flag makes the filter copy cell data from input to output (the best it can). It uses input cells that trigger the addition of output cells (no averaging). This is off by default, and does not work when append is being called explicitely (non-pipeline usage).
- `obj.SetPreventDuplicateCells (int )` - Specify a boolean indicating whether to remove duplicate cells (i.e. triangles). This is a little slower, and takes more memory, but in some cases can reduce the number of cells produced by an order of magnitude. By default, this flag is true.
- `int = obj.GetPreventDuplicateCells ()` - Specify a boolean indicating whether to remove duplicate cells (i.e. triangles). This is a little slower, and takes more memory, but in some cases can reduce the number of cells produced by an order of magnitude. By default, this flag is true.
- `obj.PreventDuplicateCellsOn ()` - Specify a boolean indicating whether to remove duplicate cells (i.e. triangles). This is a little slower, and takes more memory, but in some cases can reduce the number of cells produced by an order of magnitude. By default, this flag is true.
- `obj.PreventDuplicateCellsOff ()` - Specify a boolean indicating whether to remove duplicate cells (i.e. triangles). This is a little slower, and takes more memory, but in some cases can reduce the number of cells produced by an order of magnitude. By default, this flag is true.