1 package net.sf.openrocket.models.gravity;
4 * A gravity model based on the International Gravity Formula of 1967. The gravity
5 * value is computed when the object is constructed and later returned as a static
8 * @author Sampo Niskanen <sampo.niskanen@iki.fi>
10 public class BasicGravityModel implements GravityModel {
12 private final double g;
15 * Construct the static gravity model at the specific latitude (in degrees).
16 * @param latitude the latitude in degrees (-90 ... 90)
18 public BasicGravityModel(double latitude) {
19 double sin = Math.sin(latitude * Math.PI / 180);
20 double sin2 = Math.sin(2 * latitude * Math.PI / 180);
21 g = 9.780327 * (1 + 0.0053024 * sin - 0.0000058 * sin2);
25 public double getGravity(double altitude) {
30 public int getModID() {
31 // Return constant mod ID
32 return (int) (g * 1000000);