WIP
This commit is contained in:
parent
5947ea7eb8
commit
0dd1468112
@ -28,19 +28,19 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
function moveFrom(coords, angle, distance) {
|
function moveFrom(coords, angle, distance) {
|
||||||
let radianAngle = (angle * Math.PI) / 180;
|
var radianAngle = (angle * Math.PI) / 180;
|
||||||
let x = 0 + distance * Math.cos(radianAngle);
|
var x = 0 + distance * Math.cos(radianAngle);
|
||||||
let y = 0 + distance * Math.sin(radianAngle);
|
var y = 0 + distance * Math.sin(radianAngle);
|
||||||
let newLat = coords.lat + y * M;
|
var newLat = coords.lat + y * M;
|
||||||
let newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180));
|
var newLng = coords.lng + (x * M) / Math.cos(coords.lat * (Math.PI / 180));
|
||||||
return { lat: newLat, lng: newLng };
|
return { lat: newLat, lng: newLng };
|
||||||
}
|
}
|
||||||
function getSurroundings (location) {
|
function getSurroundings (location) {
|
||||||
const meters = 100;
|
const meters = 100;
|
||||||
const R_EARTH = 6378.137;
|
const R_EARTH = 6378.137;
|
||||||
const M = 1 / (((2 * Math.PI) / 360) * R_EARTH) / 1000;
|
const M = 1 / (((2 * Math.PI) / 360) * R_EARTH) / 1000;
|
||||||
let coordinates = [location];
|
var coordinates = [location];
|
||||||
for (let angle = 0; angle < 360; angle += 45) {
|
for (var angle = 0; angle < 360; angle += 45) {
|
||||||
coordinates.push(moveFrom({ lat: location.lat, lng: location.lng }, angle, meters));
|
coordinates.push(moveFrom({ lat: location.lat, lng: location.lng }, angle, meters));
|
||||||
}
|
}
|
||||||
return coordinates;
|
return coordinates;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user