Contenu connexe
Similaire à Geohex v2 at GMS_nagoya
Similaire à Geohex v2 at GMS_nagoya (20)
Geohex v2 at GMS_nagoya
- 1. GeoHex v2
@sa2da
2010.7.30
http://geohex.net/
- 11. Easy to calculate distance
function getDistance(_x1,_y1, _x2,_y2)
{
_x2 = _x2 * Math.PI / 180.0;
_y2 = _y2 * Math.PI / 180.0;
_x1 = _x1 * Math.PI / 180.0;
_y1 = _y1 * Math.PI / 180.0;
var dx=_x2-_x1;
var dy=_y2-_y1;
var A = 6378137; // (6378137m)
A.x - B.x
var x = A * (dx) * Math.cos( _y1 );
var y = A * (dy);
var old_exp = exp;
dy=Math.log(Math.tan(Math.PI/4+_y2/2))-Math.log(Math.tan(Math.PI/4+_y1/2));
var rad=((dy>=0) ? 1:-1)*Math.acos(dx/Math.sqrt(dx*dx+dy*dy))*180.0/Math.PI;
var tmpdist = Math.round(Math.sqrt(x*x + y*y));
totaldist = totaldist + tmpdist;
distcnt();
}
- 19. GeoHex is Open Project
Creative Commons License
Join github
Perl
kokogiko
Ruby / GitHub
hal_sk
AS3
calcul_omikan
http://github.com/geohex/