feat: move stuff to numerics

This commit is contained in:
Anatoly Antonov 2026-05-30 06:38:38 +09:00
parent 465ad00f7b
commit b7fd7046ff
5 changed files with 119 additions and 29 deletions

View file

@ -23,3 +23,16 @@ func NasaDensity(alt float64) float64 {
}
return pressure / (0.2869 * (temp + 273.1))
}
// DragTerminalVelocity returns the vertical velocity (m/s, negative = downward)
// of a parachute descent at the given altitude. seaLevelRate is the descent
// speed at sea level (positive m/s); the rate grows with altitude as the
// thinner air provides less drag:
//
// v = -k / sqrt(rho(alt)), k = seaLevelRate * 1.1045
//
// Matches Tawhiri's drag_descent.
func DragTerminalVelocity(seaLevelRate, alt float64) float64 {
k := seaLevelRate * 1.1045
return -k / math.Sqrt(NasaDensity(alt))
}