mi::neuraylib::IGeometry_simplifier Class Reference
[Functors]
Description
Functor to simplify a triangle mesh.
Options to customize the simplification algorithm.
The geometric simplification algorithm offers several options to customize its behavior, the resulting mesh quality, and its processing time. All combinations of the options listed here are allowed.
Option key |
Value type |
Default value |
Description |
---|---|---|---|
"target_fraction" |
mi::Float32 |
0.0f |
Specifies the resulting target mesh size in number of triangles as a relative fraction of the input mesh size. Values outside the range of [0, 1] are clamped. The algorithm simplifies the mesh to at most the target size. Other criteria, such as "target_quality" and topological restrictions may stop the simplification earlier. The default setting of 0.0 thus asks the simplification to simplify as much as possible given the other quality constraints. |
"target_quality" |
mi::Float32 |
0.0f |
Specifies the quality of the simplified mesh. Increasing this value reduces the amount of simplification, i.e., increases fidelity compared to the input model. Useful values are in the range of 0.0 and 1.0, but also higher values might be used in rare cases. Values below 0.0 are clamped. This parameter is independent of the size of the object. The algorithm simplifies the mesh to at most the given quality bound. Other criteria, such as "target_fraction" and topological restrictions may stop the simplification earlier. The default setting of 0.0 thus asks the simplification to simplify as much as possible given the other constraints. |
"keep_boundary" |
bool |
true |
By default topological boundaries are strictly preserved. If this option is turned off, boundaries may be simplified as well. |
"boundary_approx_weight" |
mi::Float32 |
1.0f |
Specifies a positive weight of the cost for the approximation of the mesh boundary. The higher the value, the better the shape of the boundary will be preserved compared to the inner parts of the mesh. This option has no effect if keep_boundary is set to true. |
"boundary_feature_weight" |
mi::Float32 |
1.0f |
This option allows to control the sensitivity of the decimator with respect to sharp corners on the boundary. Increasing this value will tell the algorithm to preserve these features more precisely. Its value has to be positive. This option has no effect if keep_boundary is set to true. |
"feature_angle_threshold" |
mi::Float32 |
0.31415927f |
This option specifies an angular threshold for feature edges. If the dihedral angle of two faces incident to an edge is smaller than this value, the edge is treated as a feature edge, which prohibits simplification operations across the edge. Coarsing operations along the edge are however still allowed. |
Public Member Functions
- virtual ITriangle_mesh* run( const ITriangle_mesh* mesh, const IDictionary* options) =0
- Simplifies a mesh to a smaller, similar looking mesh. More...
- virtual ITriangle_mesh* run( const ITriangle_mesh* mesh, const IDictionary* options, const Float32_3_struct& bbox_min, const Float32_3_struct& bbox_max) =0
- Simplifies a mesh to a smaller, similar looking mesh. More...
Member Functions
- virtual ITriangle_mesh* mi::neuraylib::IGeometry_simplifier::run( const ITriangle_mesh* mesh, const IDictionary* options) [pure virtual]
-
Simplifies a mesh to a smaller, similar looking mesh. Simplifies a triangle mesh to a triangle mesh with less triangles. The resulting target mesh size in number of triangles is given as a relative fraction of the original input mesh triangle count. The algorithm will not reach the target size if an internal quality criterion will be exceeded during simplification. Instead, the algorithm will then report the (larger) mesh it has been able to simplify up to this approximation tolerance.
The input mesh may be non-manifold and non-orientable, and it may contain boundary edges. However, the simplification algorithm produces an orientable two-manifold mesh, possibly with boundary edges. Non-manifold and non-orientable configurations will be preserved. Note, that this implies that by default only inner, manifold parts of the mesh will be simplified. If neighboring triangles are not correctly referencing the vertices on their common edge, it is recommended to weld the mesh first.
Point attribute vectors acquired by the mesh are handled automatically. Their values are interpolated accordingly to the successive edge collapse operations. The resulting target mesh acquires the interpolated attribute vectors. Interpolation is performed component-wise, thus being valid for any attribute dimension. Triangle attribute vectors are handled as well so that the entries corresponding to collapsed triangles are removed. The resulting target mesh acquires these reduced copies of the original triangle attribute vectors.
Runtime:
O(n log n ) where n is the size of the input mesh, i.e., its number of vertices. In practice, the logarithmic component can be almost neglected and the runtime grows almost linearly.
Memory:
Linear in the size of the input.
Parameters
- mesh
- The input mesh. Boundaries, non-manifold, and non-orientable situations are allowed. The input mesh will not be modified.
- options
- An option set to customize the algorithms behavior. A default options set can be obtained from mi::neuraylib::IFunctor_base::get_default_options() const.
Returns
The simplified mesh.
- virtual ITriangle_mesh* mi::neuraylib::IGeometry_simplifier::run( const ITriangle_mesh* mesh, const IDictionary* options, const Float32_3_struct& bbox_min, const Float32_3_struct& bbox_max) [pure virtual]
-
Simplifies a mesh to a smaller, similar looking mesh. Same version as run( const ITriangle_mesh*, const IDictionary*), but allows to override the local bounding box by a scene bounding box. This is useful when simplifying multiple objects in the same scene to a given target quality, since the mesh quality is measured relative to the extent of this bounding box.
Runtime:
O(n log n ) where n is the size of the input mesh, i.e., its number of vertices. In practice, the logarithmic component can be almost neglected and the runtime grows almost linearly.
Memory:
Linear in the size of the input.
Parameters
- mesh
- The input mesh. Boundaries, non-manifold, and non-orientable situations are allowed. The input mesh will not be modified.
- options
- An option set to customize the algorithms behavior. A default options set can be obtained from mi::neuraylib::IFunctor_base::get_default_options() const.
- bbox_min
- The minimal corner of the bounding box.
- bbox_max
- The maximal corner of the bounding box.
Returns
The simplified mesh.