simplify_object_model_3dT_simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d (Operator)
Name
simplify_object_model_3dT_simplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
— Simplify a triangulated 3D object model.
Signature
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
HObjectModel3D HObjectModel3D::SimplifyObjectModel3d(const wchar_t* Method, double Amount, const HTuple& GenParamName, const HTuple& GenParamValue) const
(
Windows only)
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)
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]]) -> HHandle
Description
simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
simplifies the triangulated 3D object model
ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3Dobject_model_3d
by removing model points and
returns the result in SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d
. Note that in
contrast to sample_object_model_3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3dsample_object_model_3d
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_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3dsample_object_model_3d
, which samples surfaces to
equidistant unconnected 3D points.
Currently, the operator offers only a single simplification method
('preserve_point_coordinates'"preserve_point_coordinates""preserve_point_coordinates""preserve_point_coordinates""preserve_point_coordinates""preserve_point_coordinates"), which can be set in
MethodMethodMethodMethodmethodmethod
. This method ensures that the points in the
simplified object model SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d
have the same
coordinates as the respective points in the input object model
ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3Dobject_model_3d
.
simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
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_paramsGetObjectModel3dParamsGetObjectModel3dParamsGetObjectModel3dParamsget_object_model_3d_params
(GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
='has_triangles'"has_triangles""has_triangles""has_triangles""has_triangles""has_triangles"). Object models that
do not contain a triangulation must be triangulated beforehand, e.g., by
using triangulate_object_model_3dtriangulate_object_model_3dTriangulateObjectModel3dTriangulateObjectModel3dTriangulateObjectModel3dtriangulate_object_model_3d
or prepare_object_model_3dprepare_object_model_3dPrepareObjectModel3dPrepareObjectModel3dPrepareObjectModel3dprepare_object_model_3d
(PurposePurposePurposePurposepurposepurpose
='segmentation'"segmentation""segmentation""segmentation""segmentation""segmentation").
The degree of simplification can be set with AmountAmountAmountAmountamountamount
. By default,
AmountAmountAmountAmountamountamount
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 AmountAmountAmountAmountamountamount
in this case is chosen the
stronger the object model will be simplified.
Alternatively, the meaning of the parameter AmountAmountAmountAmountamountamount
can be
modified. For this, the generic parameter 'amount_type'"amount_type""amount_type""amount_type""amount_type""amount_type" can
be set to one of the following values:
- 'percentage_remaining' (default):
-
AmountAmountAmountAmountamountamount
specifies the percentage of points of the input object
model that should be contained in the output object model.
Value range:
[0.0 ... 100.0].
- 'percentage_to_remove':
-
AmountAmountAmountAmountamountamount
specifies the percentage of points of the input object
model that should be removed.
Value range:
[0.0 ... 100.0].
- 'num_points_remaining':
-
AmountAmountAmountAmountamountamount
specifies the number of points of the input object model
that should be contained in the output object model.
Value range:
[0 ... number of points in the input object model].
- 'num_points_to_remove':
-
AmountAmountAmountAmountamountamount
specifies the number of points of the input object model
that should be removed.
Value range:
[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""avoid_triangle_flips" can be set to 'true'"true""true""true""true""true"
(the default is 'false'"false""false""false""false""false"). Note that in this case, the run-time of
simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
will increase.
Note that multiple calls of simplify_object_model_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
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
SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d
that slightly deviates from the degree of
simplification that is specified in AmountAmountAmountAmountamountamount
.
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
ObjectModel3DObjectModel3DObjectModel3DObjectModel3DobjectModel3Dobject_model_3d
(input_control) object_model_3d(-array) →
HObjectModel3D, HTupleMaybeSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (handle)
Handle of the 3D object model that should be
simplified.
MethodMethodMethodMethodmethodmethod
(input_control) string →
HTuplestrHTupleHtuple (string) (string) (HString) (char*)
Method that should be used for simplification.
Default:
'preserve_point_coordinates'
"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""preserve_point_coordinates"
AmountAmountAmountAmountamountamount
(input_control) number →
HTupleUnion[int, float]HTupleHtuple (real / integer) (double / int / long) (double / Hlong) (double / Hlong)
Degree of simplification (default: percentage
of remaining model points).
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name
(input_control) attribute.name-array →
HTupleSequence[str]HTupleHtuple (string) (string) (HString) (char*)
Names of the generic parameters.
Default:
[]
List of values:
'amount_type'"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""avoid_triangle_flips"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value
(input_control) attribute.value-array →
HTupleSequence[Union[str, float]]HTupleHtuple (string / real) (string / double) (HString / double) (char* / double)
Values of the generic parameters.
Default:
[]
Suggested values:
'percentage_remaining'"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""percentage_to_remove", 'num_points_remaining'"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""num_points_to_remove", 'true'"true""true""true""true""true", 'false'"false""false""false""false""false"
SimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DSimplifiedObjectModel3DsimplifiedObjectModel3Dsimplified_object_model_3d
(output_control) object_model_3d(-array) →
HObjectModel3D, HTupleSequence[HHandle]HTupleHtuple (handle) (IntPtr) (HHandle) (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_3dsimplify_object_model_3dSimplifyObjectModel3dSimplifyObjectModel3dSimplifyObjectModel3dsimplify_object_model_3d
returns 2 (
H_MSG_TRUE)
if all parameters are
correct. If necessary, an exception is raised.
Possible Predecessors
prepare_object_model_3dprepare_object_model_3dPrepareObjectModel3dPrepareObjectModel3dPrepareObjectModel3dprepare_object_model_3d
,
read_object_model_3dread_object_model_3dReadObjectModel3dReadObjectModel3dReadObjectModel3dread_object_model_3d
,
triangulate_object_model_3dtriangulate_object_model_3dTriangulateObjectModel3dTriangulateObjectModel3dTriangulateObjectModel3dtriangulate_object_model_3d
,
xyz_to_object_model_3dxyz_to_object_model_3dXyzToObjectModel3dXyzToObjectModel3dXyzToObjectModel3dxyz_to_object_model_3d
Possible Successors
disp_object_model_3ddisp_object_model_3dDispObjectModel3dDispObjectModel3dDispObjectModel3ddisp_object_model_3d
,
smallest_bounding_box_object_model_3dsmallest_bounding_box_object_model_3dSmallestBoundingBoxObjectModel3dSmallestBoundingBoxObjectModel3dSmallestBoundingBoxObjectModel3dsmallest_bounding_box_object_model_3d
Alternatives
sample_object_model_3dsample_object_model_3dSampleObjectModel3dSampleObjectModel3dSampleObjectModel3dsample_object_model_3d
,
smooth_object_model_3dsmooth_object_model_3dSmoothObjectModel3dSmoothObjectModel3dSmoothObjectModel3dsmooth_object_model_3d
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