Skip to content

Conversation

@jiacode777
Copy link

Added the function mjd_inertiaBoxFluid to compute the moment of inertia of a rectangular box of fluid (or solid) along its principal axes.

Includes a Python test script (test_inertiaBoxFluid.py) to verify correctness.
Necessary for MuJoCo simulations involving fluid-filled or box-shaped objects to have accurate inertia calculations.

Provides a foundation for eventual C integration in the MuJoCo engine.
how
Inputs: mass, x, y, z (dimensions of the box)

Outputs: Ixx, Iyy, Izz — moments of inertia about X, Y, Z axes.

Formula:

Ixx = mass * (y^2 + z^2) / 12
Iyy = mass * (x^2 + z^2) / 12
Izz = mass * (x^2 + y^2) / 12

Implemented in Python for testing and verification.

Python test script demonstrates correctness; integration into the MuJoCo C codebase can be done once a proper build environment is available.

Compatible with MuJoCo physics conventions and ready for review.

@google-cla
Copy link

google-cla bot commented Dec 3, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant