1 |
torben |
2211 |
package dk.daoas.fulddaekning; |
2 |
|
|
|
3 |
|
|
public class GeoPoint { |
4 |
|
|
|
5 |
|
|
public double latitude; |
6 |
|
|
public double longitude; |
7 |
|
|
|
8 |
|
|
public GeoPoint() { //Default |
9 |
|
|
} |
10 |
|
|
|
11 |
|
|
public GeoPoint(double lat, double lng) { //Default |
12 |
|
|
latitude=lat; |
13 |
|
|
longitude=lng; |
14 |
|
|
} |
15 |
|
|
|
16 |
|
|
public static double beregnAfstand(GeoPoint point1, GeoPoint point2) { |
17 |
|
|
//(62.8*sqrt(3.1*(Power(a.Latitude-x.Latitude,2)+Power(a.Longitude-x.Longitude,2)))) as Afstand, |
18 |
|
|
|
19 |
|
|
|
20 |
|
|
double pwrLat = Math.pow(point1.latitude - point2.latitude, 2); |
21 |
|
|
double pwrLng = Math.pow(point1.longitude - point2.longitude, 2); |
22 |
|
|
|
23 |
|
|
return 62.8 * Math.sqrt( 3.1 * (pwrLat + pwrLng) ); |
24 |
|
|
} |
25 |
|
|
} |