neuray API Programmer's Manual

mi::neuraylib::IWelder Class Reference

[Functors]

Description

Functor to weld a triangle mesh. This functor merges possibly multiple meshes and welds identical or almost identical points into one point.

The input meshes may be non-manifold and non-orientable, and they may contain boundary edges. The output mesh may contain all such features, even if the input meshes did not contain them, since the welding of points may connect things that were disconnected before.

All attribute vectors from the input meshes will be copied and acquired by the resulting mesh. The new attribute vectors will have zero values for places where the corresponding input meshes did not provide attribute values.

The algorithm is offered in two variants: variant one processes a single mesh while variant two processes an array of meshes.

As an option the distance threshold above which no points and no attributes should be merged can be controlled. The merging of geometrical points in space can be prevented by attribute discontinuities.

Note that, due to the fact that two or more points of the same face may collapse into one, the number of triangles may decrease. Degenerate faces are eliminated automatically.

Option key

Value type

Default value

Description

"point_tolerance"

mi::Float64

0

Tolerance default value used for geometry welding, i.e., the maximum allowed distance of points to be merged into a single point.

"point_representative"

const char*

"best_fit"

This option defines how representative of a cluster should be computed. If set to "centroid", all points falling into the cluster are averaged. If set to "best_fit", the welder aims at minimizing the integrated geometric error and preserving the enclosed volume. The first variant is slightly faster, but should only be used for very small tolerance values. If the tolerance is set to zero, this option will be ignored.

Public Member Functions

virtual ITriangle_meshrun( const ITriangle_mesh* mesh, const IDictionary* options) =0
Welds points of a single input mesh up to a given distance threshold, i.e., points of similar coordinates are merged into a single representation. More...
virtual IArrayrun( const IArray* meshes, const IArray* obj_to_world_trans, const IDictionary* options) =0
Welds points of an array of input meshes up to a given distance threshold, i.e., points of similar coordinates are merged into a single representation. More...

Member Functions

virtual ITriangle_mesh* mi::​neuraylib::​IWelder::run( const ITriangle_mesh* mesh, const IDictionary* options) [pure virtual]

Welds points of a single input mesh up to a given distance threshold, i.e., points of similar coordinates are merged into a single representation.

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 welded mesh containing all merged and welded input meshes.

virtual IArray* mi::​neuraylib::​IWelder::run( const IArray* meshes, const IArray* obj_to_world_trans, const IDictionary* options) [pure virtual]

Welds points of an array of input meshes up to a given distance threshold, i.e., points of similar coordinates are merged into a single representation. Returns an array of welded meshes.

Parameters

meshes
The array of input meshes. Boundaries, non-manifold, and non-orientable situations are allowed. The input mesh will not be modified.
obj_to_world_trans
The array of object-to-world transformations of type mi::IFloat64_4_4, corresponding to the input meshes.
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

An array of welded mesh containing all merged and welded input meshes. This array can contain more than one mesh, if not all the input meshes are pairwise compatible for merging, for example, because they have different flags or different types of attributes. These meshes live in world space.