Skip to content

Instantly share code, notes, and snippets.

View simonbogh's full-sized avatar
🚀

simonbogh

🚀
View GitHub Profile
@awesomebytes
awesomebytes / inertia_matrix.py
Last active December 7, 2023 13:39
Compute inertia matrix for simple solids: cube, sphere and cylinder
#/usr/bin/env python
# Based on:
# http://mathworld.wolfram.com/MomentofInertia.html
def get_cube_inertia_matrix(mass, x, y, z):
"""Given mass and dimensions of a cube return intertia matrix.
:return: ixx, ixy, ixz, ixy, iyy, iyz, ixz, iyz, izz
From https://www.wolframalpha.com/input/?i=moment+of+inertia+cube"""