Skip to content

volume_object_model_3d_relative_to_planevolume_object_model_3d_relative_to_planeVolumeObjectModel3dRelativeToPlaneVolumeObjectModel3dRelativeToPlanevolume_object_model_3d_relative_to_planeT_volume_object_model_3d_relative_to_planeπŸ”—

Short descriptionπŸ”—

volume_object_model_3d_relative_to_planevolume_object_model_3d_relative_to_planeVolumeObjectModel3dRelativeToPlaneVolumeObjectModel3dRelativeToPlanevolume_object_model_3d_relative_to_planeT_volume_object_model_3d_relative_to_plane β€” Calculate the volume of a 3D object model.

SignatureπŸ”—

volume_object_model_3d_relative_to_plane( object_model_3d ObjectModel3D, pose Plane, string Mode, string UseFaceOrientation, out number Volume )volume_object_model_3d_relative_to_plane( : : ObjectModel3D, Plane, Mode, UseFaceOrientation : Volume )void VolumeObjectModel3dRelativeToPlane( const HTuple& ObjectModel3D, const HTuple& Plane, const HTuple& Mode, const HTuple& UseFaceOrientation, HTuple* Volume )static void HOperatorSet.VolumeObjectModel3dRelativeToPlane( HTuple objectModel3D, HTuple plane, HTuple mode, HTuple useFaceOrientation, out HTuple volume )def volume_object_model_3d_relative_to_plane( object_model_3d: MaybeSequence[HHandle], plane: Sequence[Union[int, float]], mode: MaybeSequence[str], use_face_orientation: MaybeSequence[str] ) -> Sequence[float]

def volume_object_model_3d_relative_to_plane_s( object_model_3d: MaybeSequence[HHandle], plane: Sequence[Union[int, float]], mode: MaybeSequence[str], use_face_orientation: MaybeSequence[str] ) -> floatHerror T_volume_object_model_3d_relative_to_plane( const Htuple ObjectModel3D, const Htuple Plane, const Htuple Mode, const Htuple UseFaceOrientation, Htuple* Volume )

static HTuple HObjectModel3D::VolumeObjectModel3dRelativeToPlane( const HObjectModel3DArray& ObjectModel3D, const HPoseArray& Plane, const HTuple& Mode, const HTuple& UseFaceOrientation )

double HObjectModel3D::VolumeObjectModel3dRelativeToPlane( const HPose& Plane, const HString& Mode, const HString& UseFaceOrientation ) const

double HObjectModel3D::VolumeObjectModel3dRelativeToPlane( const HPose& Plane, const char* Mode, const char* UseFaceOrientation ) const

double HObjectModel3D::VolumeObjectModel3dRelativeToPlane( const HPose& Plane, const wchar_t* Mode, const wchar_t* UseFaceOrientation ) const (Windows only)

static HTuple HObjectModel3D.VolumeObjectModel3dRelativeToPlane( HObjectModel3D[] objectModel3D, HPose[] plane, HTuple mode, HTuple useFaceOrientation )

double HObjectModel3D.VolumeObjectModel3dRelativeToPlane( HPose plane, string mode, string useFaceOrientation )

DescriptionπŸ”—

volume_object_model_3d_relative_to_planeVolumeObjectModel3dRelativeToPlane calculates the volume under the faces of a 3D object model relative to a plane. The plane is defined by the x-y plane of the pose given in Planeplaneplane.

For ObjectModel3DobjectModel3Dobject_model_3d, a triangulation or a list of polygons must be available. With default settings, if the mesh is watertight and ordered, the operator calculates the actual volume of the 3D object model. To also cover cases where the mesh is not closed or the faces are not ordered consistently, the calculation of the volume can be influenced with the parameters Modemodemode and UseFaceOrientationuseFaceOrientationuse_face_orientation.

How the volume is calculated:

First, the operator calculates the volume of the prisms that are constructed by projecting each face onto the plane.

The individual volumes of the prisms can be positive or negative depending on the orientation of the face (away or towards the plane) or the location of the face (above or below the plane). This can be controlled with the parameter UseFaceOrientationuseFaceOrientationuse_face_orientation.

After that, the volumes of the prisms are added up depending on the parameter Modemodemode.

The volume returned in Volumevolumevolume is the absolute value of the calculated sum.

How to set the parameters:

Modemodemode can be set to the following options:

  • β€˜signed’ (default) The volumes above and below the plane are added.

  • β€˜unsigned’ The volume below the plane is subtracted from the volume above the plane.

  • β€˜positive’ Only faces above the plane are taken into account.

  • β€˜negative’ Only faces below the plane are taken into account.

UseFaceOrientationuseFaceOrientationuse_face_orientation can be set to the following options:

  • β€˜true’ (default) Use the orientation of the faces relative to the plane. A face points away from the plane if the corner points are ordered clockwise when viewed from the plane. The volume under a face is considered positive if the orientation of the face is away from the plane. In contrast, it is considered negative if the orientation of the face is towards the plane.

  • β€˜false’ The volume under a face is considered positive if the face is located above the plane. In contrast, it is considered negative if the face is located below the plane.

For example, with the default combination (Modemodemode: 'signed'"signed", UseFaceOrientationuseFaceOrientationuse_face_orientation: 'true'"true"), you can approximate the real volume of a closed object. In this case, the Planeplaneplane is still required, but does not change the resulting volume.

Example: (A) Modemodemode: 'signed'"signed", UseFaceOrientationuseFaceOrientationuse_face_orientation: 'true'"true": \(V = (2*3*4) + (-2*3*2) = 24-12 = 12\) (B) Modemodemode: 'signed'"signed", UseFaceOrientationuseFaceOrientationuse_face_orientation: 'false'"false": \(V = (2*3*4) + (2*3*2) = 24+12 = 36\) (C) Modemodemode: 'negative'"negative": \(V = 0\)

AttentionπŸ”—

The calculation of the volume might be numerically unstable in case of a large distance between the plane and the object (approx. distance > 10000 times the object diameter).

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)(handle)HTuple (HHandle)HObjectModel3D, HTuple (IntPtr)MaybeSequence[HHandle]Htuple (handle)

Handle of the 3D object model.

Planeplaneplane (input_control) pose(-array) β†’ (real / integer)(real / integer)HTuple (double / Hlong)HPose, HTuple (double / int / long)Sequence[Union[int, float]]Htuple (double / Hlong)

Pose of the plane.

Default: [0, 0, 0, 0, 0, 0, 0][0, 0, 0, 0, 0, 0, 0]

Modemodemode (input_control) string(-array) β†’ (string)(string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Method to combine volumes laying above and below the reference plane.

Default: 'signed'"signed"
List of values: 'negative', 'positive', 'signed', 'unsigned'"negative", "positive", "signed", "unsigned"

UseFaceOrientationuseFaceOrientationuse_face_orientation (input_control) string(-array) β†’ (string)(string)HTuple (HString)HTuple (string)MaybeSequence[str]Htuple (char*)

Decides whether the orientation of a face should affect the resulting sign of the underlying volume.

Default: 'true'"true"
List of values: 'false', 'true'"false", "true"

Volumevolumevolume (output_control) number(-array) β†’ (real)(real)HTuple (double)HTuple (double)Sequence[float]Htuple (double)

Absolute value of the calculated volume.

Number of elements: Volume == ObjectModel3D

ExampleπŸ”—

(HDevelop)


gen_box_object_model_3d ([0,0,0,0,0,0,0],3,2,1, ObjectModel3D)
convex_hull_object_model_3d (ObjectModel3D, ObjectModel3DConvexHull)
volume_object_model_3d_relative_to_plane (ObjectModel3DConvexHull,\
                                          [0,0,0,0,0,0,0], 'signed',\
                                          'true', Volume)

ResultπŸ”—

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

Combinations with other operatorsπŸ”—

Combinations

Possible predecessors

read_object_model_3dReadObjectModel3d, xyz_to_object_model_3dXyzToObjectModel3d, select_points_object_model_3dSelectPointsObjectModel3d

Possible successors

project_object_model_3dProjectObjectModel3d, object_model_3d_to_xyzObjectModel3dToXyz, select_object_model_3dSelectObjectModel3d

See also

area_object_model_3dAreaObjectModel3d

ModuleπŸ”—

3D Metrology