trimesh.inertia module

inertia.py

Functions for dealing with inertia tensors.

Results validated against known geometries and checked for internal consistency.

Functions

cylinder_inertia(mass, radius, height[, …])

Return the inertia tensor of a cylinder.

principal_axis(inertia)

Find the principal components and principal axis of inertia from the inertia tensor.

radial_symmetry(mesh)

Check whether a mesh has radial symmetry.

sphere_inertia(mass, radius)

Return the inertia tensor of a sphere.

transform_inertia(transform, inertia_tensor)

Transform an inertia tensor to a new frame.

trimesh.inertia.cylinder_inertia(mass, radius, height, transform=None)

Return the inertia tensor of a cylinder.

Parameters
  • mass (float) – Mass of cylinder

  • radius (float) – Radius of cylinder

  • height (float) – Height of cylinder

  • transform ((4, 4) float) – Transformation of cylinder

Returns

inertia – Inertia tensor

Return type

(3, 3) float

trimesh.inertia.principal_axis(inertia)

Find the principal components and principal axis of inertia from the inertia tensor.

Parameters

inertia ((3, 3) float) – Inertia tensor

Returns

  • components ((3,) float) – Principal components of inertia

  • vectors ((3, 3) float) – Row vectors pointing along the principal axes of inertia

trimesh.inertia.radial_symmetry(mesh)

Check whether a mesh has radial symmetry.

Returns

  • symmetry (None or str) – None No rotational symmetry ‘radial’ Symmetric around an axis ‘spherical’ Symmetric around a point

  • axis (None or (3,) float) – Rotation axis or point

  • section (None or (3, 2) float) – If radial symmetry provide vectors to get cross section

trimesh.inertia.sphere_inertia(mass, radius)

Return the inertia tensor of a sphere.

Parameters
  • mass (float) – Mass of sphere

  • radius (float) – Radius of sphere

Returns

inertia – Inertia tensor

Return type

(3, 3) float

trimesh.inertia.transform_inertia(transform, inertia_tensor)

Transform an inertia tensor to a new frame.

More details in OCW PDF: MIT16_07F09_Lec26.pdf

Parameters
  • transform ((3, 3) or (4, 4) float) – Transformation matrix

  • inertia_tensor ((3, 3) float) – Inertia tensor

Returns

transformed – Inertia tensor in new frame

Return type

(3, 3) float