geodetic computations
[debian/openrocket] / src / net / sf / openrocket / models / gravity / BasicGravityModel.java
1 package net.sf.openrocket.models.gravity;
2
3 import net.sf.openrocket.util.WorldCoordinate;
4
5 @Deprecated
6
7 /**
8  * A gravity model based on the International Gravity Formula of 1967.  The gravity
9  * value is computed when the object is constructed and later returned as a static
10  * value.
11  * 
12  * @author Sampo Niskanen <sampo.niskanen@iki.fi>
13  */
14
15 public class BasicGravityModel implements GravityModel {
16         
17         private final double g;
18         
19         /**
20          * Construct the static gravity model at the specific latitude (in degrees).
21          * @param latitude      the latitude in degrees (-90 ... 90)
22          */
23         public BasicGravityModel(double latitude) {
24                 // TODO: HIGH: This model is wrong!!  Increases monotonically from -90 to 90
25                 double sin = Math.sin(latitude * Math.PI / 180);
26                 double sin2 = Math.sin(2 * latitude * Math.PI / 180);
27                 g = 9.780327 * (1 + 0.0053024 * sin - 0.0000058 * sin2);
28         }
29         
30         //@Override
31         public double getGravity(double altitude) {
32                 return g;
33         }
34         
35         //@Override
36         public int getModID() {
37                 // Return constant mod ID
38                 return (int) (g * 1000000);
39         }
40
41         @Override
42         public double getGravity(WorldCoordinate wc) {
43                 // TODO Auto-generated method stub
44                 return 0;
45         }
46         
47 }