image thumbnail

Rigid body parameters of closed surface meshes

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


Updated 24 Sep 2021

From GitHub

View license on GitHub

Rigid Body Parameters

View Rigid body parameters of closed surface meshes on File Exchange

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 which computes exact rigid-body parameters of objects represented by closed, triangular surface meshes. The principles underlying the calculations are based on the divergence theorem and are explained in detail in the attached .pdf 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.m function can be used for visualizing local frames of reference constructed from principal axes of inertia.

Quick Demo


Enforcing Consistent and Proper Face Orientation

All calculations are based on the assumption that the input mesh is closed, manifold, and has outward pointing normals. To obtain outward point normals, the vertices of all faces must have counterclockwise ordering. If you know or suspect the input the mesh has either inconsistent or improper face orientation use function ConsistentNormalOrientation prior to computing the rigid-body parameters. Here is an example:


% Randomly mix-up orientations of the faces to simulate the problem above
fprintf('\nNumber of inverted faces: %d\n',nnz(idx))
% Enforce proper face orientation
fprintf('Number of faces corrected: %d\n\n',cnt)

% Verify that the output is identical to RBP for the original mesh

fprintf('Corrected mesh:\n')

fprintf('Original (reference) mesh:\n')

% Result you would have gotten without ensuring proper face orientation:
fprintf('Uncorrected mesh:\n')


MIT © 2019 Anton Semechko

Cite As

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

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!
To view or report issues in this GitHub add-on, visit the GitHub Repository.
To view or report issues in this GitHub add-on, visit the GitHub Repository.