micromissiles-unity/Assets/Scripts/Constants.cs

17 lines
764 B
C#
Raw Normal View History

2024-09-12 00:17:21 -07:00
using System;
2024-09-13 22:45:25 -07:00
public static class Constants {
// Constants (these should be defined with appropriate values)
public const double kAirDensity = 1.204; // Sea level air density in kg/m^3
public const double kAirDensityScaleHeight = 10.4; // Scale height in km
public const double kGravity = 9.80665; // Standard gravity in m/s^2
public const double kEarthMeanRadius = 6378137; // Earth's mean radius in meters
2024-09-12 00:17:21 -07:00
2024-09-13 22:45:25 -07:00
public static double CalculateAirDensityAtAltitude(double altitude) {
return kAirDensity * Math.Exp(-altitude / (kAirDensityScaleHeight * 1000));
}
2024-09-12 00:17:21 -07:00
2024-09-13 22:45:25 -07:00
public static double CalculateGravityAtAltitude(double altitude) {
return kGravity * Math.Pow(kEarthMeanRadius / (kEarthMeanRadius + altitude), 2);
}
2024-09-12 00:17:21 -07:00
}