#mass #cli #inertia #trimesh

app mass-props

CLI to calculate mass properties of triangle meshes

3 unstable releases

0.2.0 Aug 15, 2024
0.1.2 Aug 15, 2024
0.1.1 Aug 13, 2024
0.1.0 Aug 13, 2024

#286 in Command line utilities

Download history 272/week @ 2024-08-12

272 downloads per month

AGPL-3.0

29KB
309 lines

mass-props

CLI to calculate the mass properties (mass, center of mass and inertia matrix/tensor) of triangle meshes.

Built on the library polyhedral_mass_properties.

Currently, only gltf and glb files are supported.

Installation

cargo install mass-props

Usage

Usage: mass-props [OPTIONS] <PATH>

Arguments:
  <PATH>  Path to a gltf/glb file

Options:
  -d, --density <DENSITY>  Default: 1.0
  -m, --mesh <MESH>        The mesh index in the glTF file [default: 0]
  -h, --help               Print help

Output

The output is in JSON.

Example:

{
  "density": 0.001,
  "mass": 9.445518773048825,
  "center_of_mass": [
    9.28871623915268e-7,
    -0.00313705591303723,
    -1.067953785584565e-6
  ],
  "inertia": {
    "xx": 1373.3185987256663,
    "yy": 1198.2310241502155,
    "zz": 1373.318537829056,
    "xy": 0.00003549312284551729,
    "xz": 0.00003393459310569918,
    "yz": -0.000040233995830622396
  }
}

Dependencies

~6.5MB
~122K SLoC