### SimplifySurface

Category

Transformation

Function

Simplifies a triangulated surface and resamples data attached to the surface.

Syntax

    simplified = SimplifySurface(original_surface, max_error, max_data_error,
                                 volume, boundary, length, data, stats);

Inputs

Name | Type | Default | Description
--- | --- | --- | ---
`original_surface` | field | (none) | triangulated surface
`max_error` | scalar | input dependent | maximum positional error
`max_data_error` | scalar | input dependent | maximum data error
`volume` | flag | 1 | 1: move vertices to preserve volume 0: do not move vertices
`boundary` | flag | 0 | 1: simplify surface boundaries 0: do not simplify surface boundaries
`length` | flag | 1 | 1: move vertices to preserve the length of boundaries 0: do not move vertices
`data` | flag | 1 | 1: use data dependent on "positions" to constrain simplification 0: ignore data for simplification
`stats` | flag | 0 | 1: provide simple statistics. 0: do not provide statistics

Outputs

Name | Type | Description
--- | --- | ---
`simplified` | field | simplified triangulated surface

Functional Details

SimplifySurface builds a `simplified` surface that is guaranteed to deviate from `original_surface` by less than `max_error`. This means that each vertex of `simplified` as well as each point inside a triangle of `simplified` is at a Euclidean distance no further than `max_error` from `original_surface`. Similarly, each vertex of `original_surface` as well as each point inside a triangle of `original_surface` is at a distance no further than `max_error` from the simplified surface.

In addition, if a "data" component of `original_surface` is dependent on the "positions" component and is not `TYPE_STRING`, SimplifySurface will perform a data dependent simplification: SimplifySurface will resample "data" on the simplified surface and guarantee that the maximum deviation between the original and re-sampled data is less than `max_error_data`. For efficiency reasons, the dimensionality of the "data" component is currently limited to 3: for instance, it will work for RGB colors or for gradient values in 3-dimension. Note that data dependent on connections will not constrain simplification.

Vertex normals for the `simplified` surface are automatically computed.

Components dependent on "positions" or "connections" of `original_surface` are added to `simplified` and re-sampled. For components dependent on "connections", the triangle areas are used to weight the resampling.

The following components are not re-sampled: "positions", "connections", "invalid positions", "invalid connections" "normals", "neighbors", and "positional error".

`original_surface` | must have triangular connections. `original_surface` is the field that is being simplified.
`max_error` | maximum distance (in the units of the "position" component) between `simplified` and `original_surface`. The default value for `max_error` is 1% of the diagonal of the bounding box of `original_surface`. You may decide to set `max_error` to a lower or higher value than the default.
`max_data_error` | maximum deviation between data attached to `original_surface` vertices, and the resampling of that data on the `simplified` surface. (Again the maximum deviation also holds for points inside triangles, not just vertices). The default value for the maximum error on the data is set to 10% of the diagonal of the bounding box in data space. If the data is one dimensional, the default error is (max_data-min_data)/10. `max_data_error` is ignored if `data` = 0 or if the data are connection-dependent.
`volume` | specifies whether the volume enclosed by the surface should be preserved or not. If set to 1, SimplifySurface will move the surface vertices in order to preserve the volume while the number of vertices is being reduced. In this case, the volume is preserved to within floating point or higher accuracy. If set to 0, the surface vertices will not be moved. The default is 1. The volume is only truly defined for a surface that does not have a boundary (closed surface). Setting `volume` to 1 on a surface with boundary will have the effect of preventing shrinkage and producing more regular triangles. Note that if several surfaces share the same boundary, as when Isosurface is used on partitioned data, the volume can still be preserved with `volume` set to 1 if the boundary is left intact (`boundary` set to 0). With surfaces that present sharp angles, such as CAD data, setting `volume` to 1 might not work well. In general, we recommend setting `volume` to zero when operating on CAD data.
`boundary` | specifies whether the boundary of a surface should be simplified or left intact. If set to 1, then the boundary is simplified while respecting the same errors `max_error` and `max_data_error`. If set to 0, then the boundary is left intact. The default is 0. If `original_surface` has no boundary, this option is ignored.
`length` | if `boundary` set to 1, specifies whether the length of the simplified boundary should be preserved. If set to 1, in a manner analogous to volume preservation, SimplifySurface will move the boundary vertices in order to preserve the boundary length while the number of boundary vertices is being reduced. If set to 0, the boundary vertices will not be moved. The default is 1. If `boundary` is set to 0 then the value of `length` is ignored.
`data` | if set to 1, instructs SimplifySurface use `max_data_error` to constrain simplification if data are dependent on "positions" and are not `TYPE_STRING`, and if the dimensionality of such data is 3 or lower. If set to 0, simplification will not be constrained by data. In any case, SimplifySurface will resample data after simplification. The default is 1.
`stats` | if set to 1, instructs SimplifySurface to write simple statistics: number of vertices and triangles in original_surface, number of vertices and triangles in simplified, and percentage of original numbers of vertices and triangles. This information will appear in the Message window. If set to 0, SimplifySurface will not provide statistics. The default is 0.
`simplified` | simplified surface.

#### Generating surface levels of detail.

SimplifySurface adds a "positional error" component to the `simplified` surface. "positional error" is a component dependent on "positions" that provides for each vertex of `simplified` a positive number. This positive number, the error value, represents the radius of a sphere centered on the vertex, that is guaranteed to intersect the original surface. The union of such spheres represents the error volume of the simplified surface, which is guaranteed to enclose the original surface. Points inside triangles are assigned an error value that is interpolated from the error values at the triangle vertices using barycentric coordinates.

Using the "positional error" component, a simplified surface can be re-simplified to any `max_error` while still guaranteeing a bound with respect to the original surface. This is useful for generating successive levels of detail.

If the same error bound is used, a marginal additional simplification can be observed: the algorithm implements a greedy method, and does not guarantee to find the minimum number of triangles that respects a given error bound.

The use of the "positional error" component by SimplifySurface is transparent to you, but you may occasionally want to visualize the simplification error, using the Mark module. An example is provided in SimplifySurface.net.

Components

SimplifySurface adds a "positional error" component that is dependent on "positions" (see "Generating surface levels of detail.").

In general `simplified` has the same components as `original_surface` except for "invalid positions", "invalid connections", "neighbors", and components that are `TYPE_STRING`.

Example Visual Programs

    SimplifySurface.net

See Also

Refine, Reduce, Isosurface, Map

[ OpenDX Home at IBM | OpenDX.org ]