我一直在使用Vector-based geodesy上提到的精彩的写作和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);
}
我上面提到的功能似乎在我目前的实验中对于我正在处理的小区域进行了视觉上的工作但是我不确定我是否只是无法区分并且当应用于更大的距离或在不同的方向周围时它仍将按预期工作。
更新
添加图片以显示我想要完成的任务。两个已知点位于红色和绿色针脚处。我想确定紫色方框角落的坐标。