1
0
Fork 0
forked from 0x2620/oxjs

minor cleanup

This commit is contained in:
rolux 2012-05-25 13:42:33 +02:00
commit e47f826329
4 changed files with 15 additions and 18 deletions

View file

@ -145,12 +145,12 @@
{lat: 0, lng: 0}
@*/
Ox.getLatLngByXY = function(xy) {
function getVal(val) {
return (val - 0.5) * 2 * Math.PI;
function getValue(value) {
return (value - 0.5) * 2 * Math.PI;
}
return {
lat: -Ox.deg(Math.atan(Ox.sinh(getVal(xy.y)))),
lng: Ox.deg(getVal(xy.x))
lat: -Ox.deg(Math.atan(Ox.sinh(getValue(xy.y)))),
lng: Ox.deg(getValue(xy.x))
};
};
@ -213,12 +213,12 @@
{x: 0.5, y: 0.5}
@*/
Ox.getXYByLatLng = function(latlng) {
function getVal(val) {
return (val / (2 * Math.PI) + 0.5)
function getValue(value) {
return (value / (2 * Math.PI) + 0.5);
}
return {
x: getVal(Ox.rad(latlng.lng)),
y: getVal(Ox.asinh(Math.tan(Ox.rad(-latlng.lat))))
x: getValue(Ox.rad(latlng.lng)),
y: getValue(Ox.asinh(Math.tan(Ox.rad(-latlng.lat))))
};
};