FreeMat

- Main Page
- Related Pages

vtkGreedyTerrainDecimation

Section: Visualization Toolkit Hybrid Classes

# Usage

vtkGreedyTerrainDecimation approximates a height field with a triangle mesh (triangulated irregular network - TIN) using a greedy insertion algorithm similar to that described by Garland and Heckbert in their paper "Fast Polygonal Approximations of Terrain and Height Fields" (Technical Report CMU-CS-95-181). The input to the filter is a height field (represented by a image whose scalar values are height) and the output of the filter is polygonal data consisting of triangles. The number of triangles in the output is reduced in number as compared to a naive tessellation of the input height field. This filter copies point data from the input to the output for those points present in the output.

An brief description of the algorithm is as follows. The algorithm uses a top-down decimation approach that initially represents the height field with two triangles (whose vertices are at the four corners of the image). These two triangles form a Delaunay triangulation. In an iterative fashion, the point in the image with the greatest error (as compared to the original height field) is injected into the triangulation. (Note that the single point with the greatest error per triangle is identified and placed into a priority queue. As the triangulation is modified, the errors from the deleted triangles are removed from the queue, error values from the new triangles are added.) The point whose error is at the top of the queue is added to the triangulaion modifying it using the standard incremental Delaunay point insertion (see vtkDelaunay2D) algorithm. Points are repeatedly inserted until the appropriate (user-specified) error criterion is met.

To use this filter, set the input and specify the error measure to be used. The error measure options are 1) the absolute number of triangles to be produced; 2) a fractional reduction of the mesh (numTris/maxTris) where maxTris is the largest possible number of triangles 2*(dims[0]-1)*(dims[1]-1); 3) an absolute measure on error (maximum difference in height field to reduced TIN); and 4) relative error (the absolute error is normalized by the diagonal of the bounding box of the height field).

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

      obj = vtkGreedyTerrainDecimation

# Methods

The class vtkGreedyTerrainDecimation 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 vtkGreedyTerrainDecimation class.

- `string = obj.GetClassName ()`
- `int = obj.IsA (string name)`
- `vtkGreedyTerrainDecimation = obj.NewInstance ()`
- `vtkGreedyTerrainDecimation = obj.SafeDownCast (vtkObject o)`
- `obj.SetErrorMeasure (int )` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `int = obj.GetErrorMeasureMinValue ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `int = obj.GetErrorMeasureMaxValue ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `int = obj.GetErrorMeasure ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `obj.SetErrorMeasureToNumberOfTriangles ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `obj.SetErrorMeasureToSpecifiedReduction ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `obj.SetErrorMeasureToAbsoluteError ()` - Specify how to terminate the algorithm: either as an absolute number of triangles, a relative number of triangles (normalized by the full resolution mesh), an absolute error (in the height field), or relative error (normalized by the length of the diagonal of the image).
- `obj.SetErrorMeasureToRelativeError ()` - Specify the number of triangles to produce on output. (It is a good idea to make sure this is less than a tessellated mesh at full resolution.) You need to set this value only when the error measure is set to NumberOfTriangles.
- `obj.SetNumberOfTriangles (vtkIdType )` - Specify the number of triangles to produce on output. (It is a good idea to make sure this is less than a tessellated mesh at full resolution.) You need to set this value only when the error measure is set to NumberOfTriangles.
- `vtkIdType = obj.GetNumberOfTrianglesMinValue ()` - Specify the number of triangles to produce on output. (It is a good idea to make sure this is less than a tessellated mesh at full resolution.) You need to set this value only when the error measure is set to NumberOfTriangles.
- `vtkIdType = obj.GetNumberOfTrianglesMaxValue ()` - Specify the number of triangles to produce on output. (It is a good idea to make sure this is less than a tessellated mesh at full resolution.) You need to set this value only when the error measure is set to NumberOfTriangles.
- `vtkIdType = obj.GetNumberOfTriangles ()` - Specify the number of triangles to produce on output. (It is a good idea to make sure this is less than a tessellated mesh at full resolution.) You need to set this value only when the error measure is set to NumberOfTriangles.
- `obj.SetReduction (double )` - Specify the reduction of the mesh (represented as a fraction). Note that a value of 0.10 means a 10% reduction. You need to set this value only when the error measure is set to SpecifiedReduction.
- `double = obj.GetReductionMinValue ()` - Specify the reduction of the mesh (represented as a fraction). Note that a value of 0.10 means a 10% reduction. You need to set this value only when the error measure is set to SpecifiedReduction.
- `double = obj.GetReductionMaxValue ()` - Specify the reduction of the mesh (represented as a fraction). Note that a value of 0.10 means a 10% reduction. You need to set this value only when the error measure is set to SpecifiedReduction.
- `double = obj.GetReduction ()` - Specify the reduction of the mesh (represented as a fraction). Note that a value of 0.10 means a 10% reduction. You need to set this value only when the error measure is set to SpecifiedReduction.
- `obj.SetAbsoluteError (double )` - Specify the absolute error of the mesh; that is, the error in height between the decimated mesh and the original height field. You need to set this value only when the error measure is set to AbsoluteError.
- `double = obj.GetAbsoluteErrorMinValue ()` - Specify the absolute error of the mesh; that is, the error in height between the decimated mesh and the original height field. You need to set this value only when the error measure is set to AbsoluteError.
- `double = obj.GetAbsoluteErrorMaxValue ()` - Specify the absolute error of the mesh; that is, the error in height between the decimated mesh and the original height field. You need to set this value only when the error measure is set to AbsoluteError.
- `double = obj.GetAbsoluteError ()` - Specify the absolute error of the mesh; that is, the error in height between the decimated mesh and the original height field. You need to set this value only when the error measure is set to AbsoluteError.
- `obj.SetRelativeError (double )` - Specify the relative error of the mesh; that is, the error in height between the decimated mesh and the original height field normalized by the diagonal of the image. You need to set this value only when the error measure is set to RelativeError.
- `double = obj.GetRelativeErrorMinValue ()` - Specify the relative error of the mesh; that is, the error in height between the decimated mesh and the original height field normalized by the diagonal of the image. You need to set this value only when the error measure is set to RelativeError.
- `double = obj.GetRelativeErrorMaxValue ()` - Specify the relative error of the mesh; that is, the error in height between the decimated mesh and the original height field normalized by the diagonal of the image. You need to set this value only when the error measure is set to RelativeError.
- `double = obj.GetRelativeError ()` - Specify the relative error of the mesh; that is, the error in height between the decimated mesh and the original height field normalized by the diagonal of the image. You need to set this value only when the error measure is set to RelativeError.
- `obj.SetBoundaryVertexDeletion (int )` - Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.
- `int = obj.GetBoundaryVertexDeletion ()` - Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.
- `obj.BoundaryVertexDeletionOn ()` - Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.
- `obj.BoundaryVertexDeletionOff ()` - Turn on/off the deletion of vertices on the boundary of a mesh. This may limit the maximum reduction that may be achieved.
- `obj.SetComputeNormals (int )` - Compute normals based on the input image. Off by default.
- `int = obj.GetComputeNormals ()` - Compute normals based on the input image. Off by default.
- `obj.ComputeNormalsOn ()` - Compute normals based on the input image. Off by default.
- `obj.ComputeNormalsOff ()` - Compute normals based on the input image. Off by default.