Skip to content

Instantly share code, notes, and snippets.

View simonbogh's full-sized avatar
🚀

simonbogh

🚀
View GitHub Profile
@simonbogh
simonbogh / inertia_matrix.py
Last active July 25, 2024 08:16 — forked from awesomebytes/inertia_matrix.py
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"""