Родитель
09f6c76329
Коммит
759947a2ad
|
@ -6774,10 +6774,15 @@ d3 = function() {
|
|||
}
|
||||
d3.geo.rotation = function(rotate) {
|
||||
rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
|
||||
return function(coordinates) {
|
||||
function forward(coordinates) {
|
||||
coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
|
||||
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
|
||||
}
|
||||
forward.invert = function(coordinates) {
|
||||
coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
|
||||
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
|
||||
};
|
||||
return forward;
|
||||
};
|
||||
function d3_geo_rotation(δλ, δφ, δγ) {
|
||||
return δλ ? δφ || δγ ? d3_geo_compose(d3_geo_rotationλ(δλ), d3_geo_rotationφγ(δφ, δγ)) : d3_geo_rotationλ(δλ) : δφ || δγ ? d3_geo_rotationφγ(δφ, δγ) : d3_geo_equirectangular;
|
||||
|
|
Различия файлов скрыты, потому что одна или несколько строк слишком длинны
|
@ -1,9 +1,17 @@
|
|||
d3.geo.rotation = function(rotate) {
|
||||
rotate = d3_geo_rotation(rotate[0] % 360 * d3_radians, rotate[1] * d3_radians, rotate.length > 2 ? rotate[2] * d3_radians : 0);
|
||||
return function(coordinates) {
|
||||
|
||||
function forward(coordinates) {
|
||||
coordinates = rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
|
||||
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
|
||||
}
|
||||
|
||||
forward.invert = function(coordinates) {
|
||||
coordinates = rotate.invert(coordinates[0] * d3_radians, coordinates[1] * d3_radians);
|
||||
return coordinates[0] *= d3_degrees, coordinates[1] *= d3_degrees, coordinates;
|
||||
};
|
||||
|
||||
return forward;
|
||||
};
|
||||
|
||||
// Note: |δλ| must be < 2π
|
||||
|
|
|
@ -23,6 +23,9 @@ suite.addBatch({
|
|||
},
|
||||
"rotates longitude and latitude": function(rotation) {
|
||||
assert.inDelta(rotation([0, 0]), [-54.73561, 30], 1e-6);
|
||||
},
|
||||
"inverse rotation of longitude and latitude": function(rotation) {
|
||||
assert.inDelta(rotation.invert([-54.73561, 30]), [0, 0], 1e-6);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче