Iray SDK API nvidia_logo_transpbg.gif Up
mi::neuraylib::IGeometry_simplifier Class Referenceabstract

Functor to simplify a triangle mesh. More...

#include <igeometry_simplifier.h>

Inheritance diagram for mi::neuraylib::IGeometry_simplifier:

Public Member Functions

virtual ITriangle_meshrun (const ITriangle_mesh *mesh, const IDictionary *options)=0
 Simplifies a mesh to a smaller, similar looking mesh. More...
 
virtual ITriangle_meshrun (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...
 
- Public Member Functions inherited from mi::neuraylib::IFunctor_base
virtual IDictionaryget_default_options () const =0
 Returns the default options for this functor. More...
 
virtual bool options_valid (const IDictionary *options)=0
 Checks whether the options are valid for the functor. More...
 
virtual const IDictionaryget_options_type () const =0
 Returns the types of all options. More...
 
virtual const IDictionaryget_options_description () const =0
 Returns the descriptions of all options. More...
 
virtual const char * error_text () const =0
 Returns a descriptive string for the last error. More...
 
- Public Member Functions inherited from mi::base::IInterface
virtual Uint32 retain () const =0
 Increments the reference count. More...
 
virtual Uint32 release () const =0
 Decrements the reference count. More...
 
virtual const IInterfaceget_interface (const Uuid &interface_id) const =0
 Acquires a const interface from another. More...
 
template<class T>
const T * get_interface () const
 Acquires a const interface from another. More...
 
virtual IInterfaceget_interface (const Uuid &interface_id)=0
 Acquires a mutable interface from another. More...
 
template<class T>
T * get_interface ()
 Acquires a mutable interface from another. More...
 
virtual Uuid get_iid () const =0
 Returns the interface ID of the most derived interface. More...
 

Additional Inherited Members

- Public Types inherited from mi::base::Interface_declare< 0xc2afb90e, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::Interface_declare< 0xee412b14, ... >
typedef Interface_declare< id1, ... > Self
 Own type. More...
 
typedef Uuid_t< id1, ... > IID
 Declares the interface ID (IID) of this interface. More...
 
- Public Types inherited from mi::base::IInterface
typedef Uuid_t<0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0> IID
 Declares the interface ID (IID) of this interface. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xc2afb90e, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::Interface_declare< 0xee412b14, ... >
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface and of its ancestors. More...
 
- Static Public Member Functions inherited from mi::base::IInterface
static bool compare_iid (const Uuid &iid)
 Compares the interface ID iid against the interface ID of this interface. More...
 

Detailed 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.

Member Function Documentation

 run() [1/2]

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.

Parameters
meshThe input mesh. Boundaries, non-manifold, and non-orientable situations are allowed. The input mesh will not be modified.
optionsAn 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.
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.

 run() [2/2]

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.

Parameters
meshThe input mesh. Boundaries, non-manifold, and non-orientable situations are allowed. The input mesh will not be modified.
optionsAn option set to customize the algorithms behavior. A default options set can be obtained from mi::neuraylib::IFunctor_base::get_default_options() const.
bbox_minThe minimal corner of the bounding box.
bbox_maxThe maximal corner of the bounding box.
Returns
The simplified mesh.
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.