ClassesClasses | | Operators

simplify_object_model_3dT_simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3d (Operator)

Name

simplify_object_model_3dT_simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3d — Simplify a triangulated 3D object model.

Signature

simplify_object_model_3d( : : ObjectModel3D, Method, Amount, GenParamName, GenParamValue : SimplifiedObjectModel3D)

Herror T_simplify_object_model_3d(const Htuple ObjectModel3D, const Htuple Method, const Htuple Amount, const Htuple GenParamName, const Htuple GenParamValue, Htuple* SimplifiedObjectModel3D)

void SimplifyObjectModel3d(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

static void HOperatorSet.SimplifyObjectModel3d(HTuple objectModel3D, HTuple method, HTuple amount, HTuple genParamName, HTuple genParamValue, out HTuple simplifiedObjectModel3D)

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_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3d simplifies the triangulated 3D object model ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D by removing model points and returns the result in SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3D. Note that in contrast to sample_object_model_3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3d 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_3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3d, which samples surfaces to equidistant unconnected 3D points.

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

simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3d only works for triangulated object models. Whether an object model contains a triangulation can be queried with get_object_model_3d_paramsget_object_model_3d_paramsGetObjectModel3dParamsGetObjectModel3dParamsGetObjectModel3dParams (GenParamNameGenParamNameGenParamNameGenParamNamegenParamName='has_triangles''has_triangles''has_triangles''has_triangles''hasTriangles'). Object models that do not contain a triangulation must be triangulated beforehand, e.g., by using triangulate_object_model_3dtriangulate_object_model_3dTriangulateObjectModel3dTriangulateObjectModel3dTriangulateObjectModel3d or prepare_object_model_3dprepare_object_model_3dPrepareObjectModel3dPrepareObjectModel3dPrepareObjectModel3d (PurposePurposePurposePurposepurpose='segmentation''segmentation''segmentation''segmentation''segmentation').

The degree of simplification can be set with AmountAmountAmountAmountamount. By default, AmountAmountAmountAmountamount 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 AmountAmountAmountAmountamount in this case is chosen the stronger the object model will be simplified.

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

'percentage_remaining'   AmountAmountAmountAmountamount specifies the percentage of points
             (default)   of the input object model that should be contained
                         in the output object model.
                         Range of values: [0.0 ... 100.0]

'percentage_to_remove'   AmountAmountAmountAmountamount specifies the percentage of points
                         of the input object model that should be removed.
                         Range of values: [0.0 ... 100.0]

'num_points_remaining'   AmountAmountAmountAmountamount specifies the number of points
                         of the input object model that should be contained
                         in the output object model.
                         Range of values:
                         [0 ... number of points in the input object model]

'num_points_to_remove'   AmountAmountAmountAmountamount specifies the number of points
                         of the input object model that should be removed.
                         Range of values:
                         [0 ... 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""avoid_triangle_flips""avoid_triangle_flips""avoid_triangle_flips" can be set to 'true'"true""true""true""true" (the default is 'false'"false""false""false""false"). Note that in this case, the run-time of simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3d will increase.

Note that multiple calls of simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3d 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 SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3D that slightly deviates from the degree of simplification that is specified in AmountAmountAmountAmountamount.

Execution Information

Parameters

ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3D (input_control)  object_model_3d(-array) HObjectModel3D, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

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

MethodMethodMethodMethodmethod (input_control)  string HTupleHTupleHtuple (string) (string) (HString) (char*)

Method that should be used for simplification.

Default value: 'preserve_point_coordinates' "preserve_point_coordinates" "preserve_point_coordinates" "preserve_point_coordinates" "preserve_point_coordinates"

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

AmountAmountAmountAmountamount (input_control)  number HTupleHTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)

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

GenParamNameGenParamNameGenParamNameGenParamNamegenParamName (input_control)  attribute.name-array HTupleHTupleHtuple (string) (string) (HString) (char*)

Names of the generic parameters.

Default value: []

List of values: 'amount_type'"amount_type""amount_type""amount_type""amount_type", 'avoid_triangle_flips'"avoid_triangle_flips""avoid_triangle_flips""avoid_triangle_flips""avoid_triangle_flips"

GenParamValueGenParamValueGenParamValueGenParamValuegenParamValue (input_control)  attribute.value-array HTupleHTupleHtuple (string / real) (string / double) (HString / double) (char* / double)

Values of the generic parameters.

Default value: []

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

SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3D (output_control)  object_model_3d(-array) HObjectModel3D, HTupleHTupleHtuple (integer) (IntPtr) (Hlong) (Hlong)

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_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3d returns 2 (H_MSG_TRUE) if all parameters are correct. If necessary, an exception is raised.

Possible Predecessors

prepare_object_model_3dprepare_object_model_3dPrepareObjectModel3dPrepareObjectModel3dPrepareObjectModel3d, read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3d, triangulate_object_model_3dtriangulate_object_model_3dTriangulateObjectModel3dTriangulateObjectModel3dTriangulateObjectModel3d, xyz_to_object_model_3dxyz_to_object_model_3dXyzToObjectModel3dXyzToObjectModel3dXyzToObjectModel3d

Possible Successors

disp_object_model_3ddisp_object_model_3dDispObjectModel3dDispObjectModel3dDispObjectModel3d, smallest_bounding_box_object_model_3dsmallest_bounding_box_object_model_3dSmallestBoundingBoxObjectModel3dSmallestBoundingBoxObjectModel3dSmallestBoundingBoxObjectModel3d

Alternatives

sample_object_model_3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3d, smooth_object_model_3dsmooth_object_model_3dSmoothObjectModel3dSmoothObjectModel3dSmoothObjectModel3d

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


ClassesClasses | | Operators