Я пытаюсь нарисовать перпендикулярные линии и использую методы destination и rhumbDestination.
let home = turf.point([43.12831626497193, 1.259286403656006]);
L.circle(home.geometry.coordinates, {
color: 'purple',
fillColor: 'purple',
fillOpacity: 0.5,
radius: 20
}).addTo(map);
let destination;
destination = turf.rhumbDestination(home.geometry.coordinates, 400, 45, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'green', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, -135, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'green', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, 135, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'red', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, -45, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'red', weight: 5}).addTo(map);
Но полученные линии не перпендикулярны
Не перпендикулярно
Я использую буклет для визуализации. Я также проверил с методом назначения, тот же результат.
Хотя подшипник кратен 90, результат правильный.
destination = turf.rhumbDestination(home.geometry.coordinates, 400, 0, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'green', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, -180, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'green', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, 90, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'red', weight: 5}).addTo(map);
destination = turf.rhumbDestination(home.geometry.coordinates, 400, -90, {units: 'meters'});
L.polyline([destination.geometry.coordinates, home.geometry.coordinates]).setStyle({color: 'red', weight: 5}).addTo(map);
Перпендикуляр
Что я делаю не так? Как я могу рисовать перпендикулярные линии, используя листовки и газон js?