Initial commit
[debian/openrocket] / src / net / sf / openrocket / aerodynamics / GravityModel.java
1 package net.sf.openrocket.aerodynamics;
2
3 /**
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
6  * value.
7  * 
8  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
9  */
10 public class GravityModel {
11         
12         private final double g;
13         
14         /**
15          * Construct the static gravity model at the specific latitude (in degrees).
16          * @param latitude      the latitude in degrees (-90 ... 90)
17          */
18         public GravityModel(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);
22         }
23
24         public double getGravity() {
25                 return g;
26         }
27
28 }