novaphy.compute_inertia_mesh¶
Newton-aligned solid-mesh inertia integrator. Sums per-triangle tetrahedral integrals (apex at origin) to recover mass, center of mass, inertia tensor about the COM, and signed volume of a closed triangle mesh.
def compute_inertia_mesh(
density: float,
vertices,
indices,
is_solid: bool = True,
) -> tuple[float, np.ndarray, np.ndarray, float]
Parameters¶
| Parameter | Description |
|---|---|
density |
Material density [kg / m^3]. |
vertices |
(N, 3) array-like vertex positions [m]. |
indices |
Flat length = 3 * T int32 array, or (T, 3) triplets. |
is_solid |
Solid (closed-surface) integration. Must currently be True. See note below. |
is_solid=False not implemented yet
The hollow-shell integrator is a planned follow-up; passing
is_solid=False raises RuntimeError("compute_inertia_mesh: hollow-shell
path is a follow-up; pass is_solid=True for now."). Today only the
solid (closed-surface) path is wired.
Returns¶
(mass, com, inertia, volume) as (float, Vec3, Mat33, float).
Notes¶
Triangle indices must use counter-clockwise winding when viewed from outside the surface (Newton convention). Inward winding is detected and signs flipped.
Compatibility Notes¶
Newton's general compute_inertia_shape(type, scale, src, density) (which
covers boxes / spheres / capsules / cylinders / cones / meshes uniformly) is
not provided. Use Mesh — it wraps compute_inertia_mesh
at construction with unit density.