scene_synthesizer.utils.get_mass_properties

scene_synthesizer.utils.get_mass_properties(trimesh_geometry, min_thickness=1e-3)

Calculate mass properties of trimesh geometry; even if not watertight. Uses the density information of the original geometry. If mesh is watertight will return original mass properties. If mesh is not watertight the method will try to approximate via convex hull or - if impossible - via axis-aligned bounding box. The mass properties of the approximations will then be returned (assuming equal density as the original geometry). In case the bounding box has zero length along one of its dimensions, the min_thickness argument will be used.

Parameters:
  • trimesh_geometry (trimesh.Trimesh) – Mesh whose mass properties should be calculated.

  • min_thickness (float, optional) – Minimum thickness of mesh along all bounding box directions. Defaults to 1e-3.

Returns:

Mass. np.ndarray: Center of mass, 3-vector. np.ndarray: Inertia tensor, 3x3 matrix. float: Volume.

Return type:

float