escapeVelocity static method

Speed escapeVelocity(
  1. Mass bodyMass,
  2. Length bodyRadius
)

Calculates the escape velocity from the surface of a celestial body.

Returns the velocity as a Speed quantity. Usage: final v = AstronomicalConstants.escapeVelocity(earthMass, earthRadius);

Implementation

static Speed escapeVelocity(Mass bodyMass, Length bodyRadius) {
  final mass = bodyMass.getValue(MassUnit.kilogram);
  final radius = bodyRadius.getValue(LengthUnit.meter);
  const gravConstant = PhysicalConstants.gravitationalConstant;
  final v2 = 2.0 * gravConstant * mass / radius; // v² = 2GM/r
  return Speed(math.sqrt(v2), SpeedUnit.meterPerSecond);
}