Skip to content

simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3dT_simplify_object_model_3d🔗

Short description🔗

simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3dT_simplify_object_model_3d — Simplify a triangulated 3D object model.

Signature🔗

simplify_object_model_3d( object_model_3d ObjectModel3D, string Method, number Amount, attribute.name GenParamName, attribute.value GenParamValue, out object_model_3d SimplifiedObjectModel3D )void SimplifyObjectModel3d( const HTuple& ObjectModel3D, const HTuple& Method, const HTuple& Amount, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* SimplifiedObjectModel3D )static void HOperatorSet.SimplifyObjectModel3d( HTuple objectModel3D, HTuple method, HTuple amount, HTuple genParamName, HTuple genParamValue, out HTuple simplifiedObjectModel3D )def simplify_object_model_3d( object_model_3d: MaybeSequence[HHandle], method: str, amount: Union[int, float], gen_param_name: Sequence[str], gen_param_value: Sequence[Union[str, float]] ) -> Sequence[HHandle]

def simplify_object_model_3d_s( object_model_3d: MaybeSequence[HHandle], method: str, amount: Union[int, float], gen_param_name: Sequence[str], gen_param_value: Sequence[Union[str, float]] ) -> HHandleHerror T_simplify_object_model_3d( const Htuple ObjectModel3D, const Htuple Method, const Htuple Amount, const Htuple GenParamName, const Htuple GenParamValue, Htuple* SimplifiedObjectModel3D )

static HObjectModel3DArray HObjectModel3D::SimplifyObjectModel3d( const HObjectModel3DArray& ObjectModel3D, const HString& Method, const HTuple& Amount, const HTuple& GenParamName, const HTuple& GenParamValue )

HObjectModel3D HObjectModel3D::SimplifyObjectModel3d( const HString& Method, double Amount, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HObjectModel3D HObjectModel3D::SimplifyObjectModel3d( const char* Method, double Amount, const HTuple& GenParamName, const HTuple& GenParamValue ) const

HObjectModel3D HObjectModel3D::SimplifyObjectModel3d( const wchar_t* Method, double Amount, const HTuple& GenParamName, const HTuple& GenParamValue ) const (Windows only)

static HObjectModel3D[] HObjectModel3D.SimplifyObjectModel3d( HObjectModel3D[] objectModel3D, string method, HTuple amount, HTuple genParamName, HTuple genParamValue )

HObjectModel3D HObjectModel3D.SimplifyObjectModel3d( string method, double amount, HTuple genParamName, HTuple genParamValue )

Description🔗

simplify_object_model_3dSimplifyObjectModel3d simplifies the triangulated 3D object model ObjectModel3DobjectModel3Dobject_model_3d by removing model points and returns the result in SimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d. Note that in contrast to sample_object_model_3dSampleObjectModel3d points are removed such that the original geometry of the object model is represented as good as possible. Typically, this means that edges are preserved while the point density within smooth parts is reduced. This might be helpful, for example, to speed up subsequent operator calls by using a 3D object model of reduced complexity.

The triangulation of the input 3D object model is preserved as opposed to the operator sample_object_model_3dSampleObjectModel3d, which samples surfaces to equidistant unconnected 3D points.

Currently, the operator offers only a single simplification method ('preserve_point_coordinates'"preserve_point_coordinates"), which can be set in Methodmethodmethod. This method ensures that the points in the simplified object model SimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d have the same coordinates as the respective points in the input object model ObjectModel3DobjectModel3Dobject_model_3d.

simplify_object_model_3dSimplifyObjectModel3d only works for triangulated object models. Whether an object model contains a triangulation can be queried with get_object_model_3d_paramsGetObjectModel3dParams (GenParamNamegenParamNamegen_param_name='has_triangles'"has_triangles"). Object models that do not contain a triangulation must be triangulated beforehand, e.g., by using triangulate_object_model_3dTriangulateObjectModel3d or prepare_object_model_3dPrepareObjectModel3d (Purposepurposepurpose='segmentation'"segmentation").

The degree of simplification can be set with Amountamountamount. By default, Amountamountamount specifies the percentage of points of the input object model that should be contained in the output object model. Thus, the smaller the value of Amountamountamount in this case is chosen the stronger the object model will be simplified.

Alternatively, the meaning of the parameter Amountamountamount can be modified. For this, the generic parameter 'amount_type'"amount_type" can be set to one of the following values:

  • ‘percentage_remaining’ (default): Amountamountamount specifies the percentage of points of the input object model that should be contained in the output object model.

    Value range: [0.00.0 … 100.0100.0].

  • ‘percentage_to_remove’: Amountamountamount specifies the percentage of points of the input object model that should be removed.

    Value range: [0.00.0 … 100.0100.0].

  • ‘num_points_remaining’: Amountamountamount specifies the number of points of the input object model that should be contained in the output object model.

    Value range: [00 … number of points in the input object model].

  • ‘num_points_to_remove’: Amountamountamount specifies the number of points of the input object model that should be removed.

    Value range: [00 … number of points in the input object model].

Sometimes triangular meshes flip during the simplification, i.e., the direction of their normal vectors changes by 180 degrees. This especially happens for artificially created CAD models that consist of planar parts. To avoid this flipping, the generic parameter 'avoid_triangle_flips'"avoid_triangle_flips" can be set to 'true'"true" (the default is 'false'"false"). Note that in this case, the run-time of simplify_object_model_3dSimplifyObjectModel3d will increase.

Note that multiple calls of simplify_object_model_3dSimplifyObjectModel3d with a lower degree of simplification might result in a different simplified object model compared to a single call with a higher degree of simplification. Also note that isolated (i.e., non-triangulated) points will be removed. This might result in a number of points in SimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d that slightly deviates from the degree of simplification that is specified in Amountamountamount.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

ObjectModel3DobjectModel3Dobject_model_3d (input_control) object_model_3d(-array) → (handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

Handle of the 3D object model that should be simplified.

Methodmethodmethod (input_control) string → (string)HTuple (HString)HTuple (string)strHtuple (char*)

Method that should be used for simplification.

Default: 'preserve_point_coordinates'"preserve_point_coordinates"
List of values: 'preserve_point_coordinates'"preserve_point_coordinates"

Amountamountamount (input_control) number → (real / integer)HTuple (double / Hlong)HTuple (double / int / long)Union[int, float]Htuple (double / Hlong)

Degree of simplification (default: percentage of remaining model points).

GenParamNamegenParamNamegen_param_name (input_control) attribute.name-array → (string)HTuple (HString)HTuple (string)Sequence[str]Htuple (char*)

Names of the generic parameters.

Default: [][]
List of values: 'amount_type', 'avoid_triangle_flips'"amount_type", "avoid_triangle_flips"

GenParamValuegenParamValuegen_param_value (input_control) attribute.value-array → (string / real)HTuple (HString / double)HTuple (string / double)Sequence[Union[str, float]]Htuple (char* / double)

Values of the generic parameters.

Default: [][]
Suggested values: 'percentage_remaining', 'percentage_to_remove', 'num_points_remaining', 'num_points_to_remove', 'true', 'false'"percentage_remaining", "percentage_to_remove", "num_points_remaining", "num_points_to_remove", "true", "false"

SimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d (output_control) object_model_3d(-array) → (handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)Sequence[HHandle]Htuple (handle)

Handle of the simplified 3D object model.

Example🔗

(HDevelop)

read_object_model_3d ('mvtec_bunny.om3', 'm', [], [], ObjectModel3D, Status)
visualize_object_model_3d (WindowHandle, ObjectModel3D, [], [], [], [], \
                           [], [], [], Pose)
simplify_object_model_3d (ObjectModel3D, 'preserve_point_coordinates', \
                          5.0, 'amount_type', 'percentage_remaining', \
                          SimplifiedObjectModel3D)
visualize_object_model_3d (WindowHandle, SimplifiedObjectModel3D, [], \
                           Pose, [], [], [], [], [], Pose)

Result🔗

simplify_object_model_3dSimplifyObjectModel3d returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

prepare_object_model_3dPrepareObjectModel3d, read_object_model_3dReadObjectModel3d, triangulate_object_model_3dTriangulateObjectModel3d, xyz_to_object_model_3dXyzToObjectModel3d

Possible successors

disp_object_model_3dDispObjectModel3d, smallest_bounding_box_object_model_3dSmallestBoundingBoxObjectModel3d

Alternatives

sample_object_model_3dSampleObjectModel3d, smooth_object_model_3dSmoothObjectModel3d

References🔗

Michael Garland, Paul S. Heckbert: Surface Simplification Using Quadric Error Metrics, Proceedings of the 24th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH ‘97), 209-216, ACM Press, 1997

Module🔗

3D Metrology