我一直在使用基于矢量的大地测量学中提到的出色的编写和 JavaScript 库, 用于基于矢量的球面 LatLong 点和距离计算。它几乎具有我需要的所有功能和属性,除了(据我所知)在给定已知方位的情况下确定垂直方位的能力。当我知道通过同一给定点的初始方位时,我希望能够在与给定点垂直的方位上识别一个新点。
想要确定垂直点的背景是我正在处理地面上的区域,我知道地面上两个点的纬度/经度,并且我想在两个已知点之间的地图上绘制一个矩形多边形(它们分别位于矩形的两个相对边缘的中点 - 矩形的开始和结束边缘),使用需要计算的 4 个角点和为矩形提供的 X 宽度。我需要确定 4 个角点坐标是什么。从中找到垂线的原始方位角只是两个原点之间的方位角。
我已经确定了一些“我认为”是必要的函数签名,但我不确定这是否不仅仅是我目前拥有的简单的角度减法/加法,或者是否需要基于某种调整地球上给定点的位置以及通过该点的方位。
/**
* Determine bearing at a rotational angle from a known bearing and from ‘this’ point
*
* @param {number} bearing - Initial bearing in degrees from north.
* @param {number} angle - Rotation angle in degrees (i.e. 90 or -90)
* @returns {number} Bearing at rotation angle to provided bearing
*
*/
LatLon.prototype.bearingAtAngle(bearing,angle) {
# Is this simply bearing + angle and no adjustments are needed?
return bearing + angle;
# Or do we need to adjust for where the point is located and the original bearing?
}
/**
* Determine perpendicular bearing from a known bearing and rotation direction from ‘this’ point
*
* @param {number} bearing - Initial bearing in degrees from north.
* @param {string} rotation - “+” or “-“ (or could be “positive”/“negative”, “clockwise”/“counterClockwise”,0/1 or something to indicate which rotational direction to use to determine the perpendicular bearing)
* @returns {number} Bearing perpendicular to provided bearing and direction
*
*/
LatLon.prototype.perpendicularBearing(bearing,rotation) {
var angle = rotation == “+” ? 90 : -90;
return this.bearingAtAngle(bearing,angle);
}
/**
* Determine a point at a distance from ’this’ point along bearing that is perpendicular to a known bearing through the same point
*
* @param {number} bearing - Initial bearing in degrees from north
* @param {string} rotation - “+” or “-“ (or could be “positive”/“negative”, “clockwise”/“counterclockwise”,0/1 or something to indicate which rotational direction to use to determine the perpendicular bearing)
* @param {number} distance - Distance travelled, in same units as earth radius (default: metres).
* @returns {number} Bearing perpendicular to provided bearing and direction
*
*/
LatLon.prototype.perpendicularPoint(bearing, rotation, distance) {
var perpendicularBearing = this.perpendicularBearing(bearing,rotation);
# use distance along this newly determined perpendicularBearing
return this.destinationPoint(distance, perpendicularBearing);
}
我上面的功能似乎在我目前的实验中处理的小区域视觉上有效,但我不确定我是否只是无法区分差异,当应用于更大的距离或全球不同方向时会不会仍然按预期工作。
更新
添加图像以显示我要完成的工作。两个已知点位于红色和绿色引脚处。我想确定紫色框角的坐标。