astro.Function.bulkDensity - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki

@elite-dangerous-almanac/core / astro / bulkDensity

Function: bulkDensity()

bulkDensity(body): number | null

Defined in: src/astro/body-physics.ts:133

A body's mean density, in kg/m³ — its mass spread evenly through a sphere of its radius.

Parameters

body

BodyProperties

The body. Needs a mass (bodyMass) and Radius.

Returns

number | null

Density in kg/m³, or null when either is missing. The scale is wide: an icy moon reads near 1000, rock and metal a few thousand, a neutron star around 10¹⁷.

Throws

If body is not an object.

Example

import { bulkDensity } from '@elite-dangerous-almanac/core/astro/body-physics';

// Earth: one Earth mass in a 6371 km sphere.
bulkDensity({ MassEM: 1, Radius: 6_371_000 }); // -> 5513.2…
⚠️ **GitHub.com Fallback** ⚠️