Hallo allemaal,
Ik heb een set X en Y coordinaten:
46340206 518757060
46347944 518743306
Je moet ze door 1000000 delen om de komma goed te zetten. Nu wil ik de hemelsbrede afstand tussen deze punten hebben. Op http://www.codeguru.com/C...eneral/article.php/c5115/ staat hier een uitleg over. Mijn code is dan:
Dit geeft echter geen goed resultaat. Wie kan mij helpen?
Ik heb een set X en Y coordinaten:
46340206 518757060
46347944 518743306
Je moet ze door 1000000 delen om de komma goed te zetten. Nu wil ik de hemelsbrede afstand tussen deze punten hebben. Op http://www.codeguru.com/C...eneral/article.php/c5115/ staat hier een uitleg over. Mijn code is dan:
Java:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
| public double distanceTo(Node n) { // procedure described on // http://www.codeguru.com/Cpp/Cpp/algorithms/general/article.php/c5115/ double thisX = new Double(this.xCoord).doubleValue() / 10000000; double thisY = new Double(this.yCoord).doubleValue() / 10000000; double thatX = new Double(n.getXCoord()).doubleValue() / 10000000; double thatY = new Double(n.getYCoord()).doubleValue() / 10000000; // got this data from http://en.wikipedia.org/wiki/Earth_radius double earth_radius = new Double(6378).doubleValue(); return (earth_radius) * Math.acos( Math.cos(90 - thatY) * Math.cos(90 - thisY) + Math.sin(90 - thatY) * Math.sin(90 - thisY) * Math.cos(thatX - thisX)); } |
Dit geeft echter geen goed resultaat. Wie kan mij helpen?
Ticking away the moments that make up the dull day