File Exchange

image thumbnail

Rigid body parameters of closed surface meshes

version (858 KB) by Anton Semechko
Fast computation of exact rigid body parameters of closed triangular surface meshes using divergence theorem


Updated 04 Sep 2020

View Version History

GitHub view license on GitHub

In order to simulate dynamic behaviour of a rigid-body, one requires knowledge of a set of rigid-body parameters such as the total mass of the rigid-body, the center of mass, as well as the moments and products of inertia. The purpose of this submission is to provide a function that can compute exact rigid-body parameters of objects represented by closed, triangular surface meshes. The principles underlying all computations are based on the divergence theorem and are explained in detail in the attached document.

This submission also includes two functions that take as input an arbitrary mesh and output parameters of a primitive object, such as an ellipsoid or a cuboid, with exactly the same inertial parameters as the input object.

Finally, ‘VisualizeLocaFrame’ function can be used for visualizing local frames of reference constructed from principal axes of inertia.

To get started, un-zip the folder titled 'Rigid Body Parameters' and add it to your MATLAB path. Then enter the following code into your command prompt:


If you run into problems using submitted functions, please report them here:

Cite As

Anton Semechko (2020). Rigid body parameters of closed surface meshes (, GitHub. Retrieved .

Comments and Ratings (8)

Oriol Frigola

Anton Semechko

Assuming uniform material density, to add back dependence on mass, multiply inertia tensor in the RBP structure by density (i.e., object mass / object volume)

Anton Semechko

@ Lewis Walker, please read the attached 'Rigid-body Parameters Using Divergence Theorem' document. All calculations are based on the assumption of constant density of 1 (mass unit)/(whatever units your mesh is represented)^3. If you scale the mesh by a factor s, the corresponding 0-th, 1-st, and 2-nd moments will change by respective factors of s^3, s^4, and s^5.

Lewis Walker

How can I add back density dependence in the calculation of inertia tensor? If I rescale the input object while maintaining the same mass, the inertia tensor does not match the change. When I use the new tensor to calculate a moment of inertia it does not scale properly

Giuseppe Coppola

Great program! But the InertiaBasedLocalFrame function miss..

Andre Paixao

Andre Paixao

guanhao shao

Excellent program.Thank you very much!

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!