Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何计算路径上的点?_C#_Algorithm - Fatal编程技术网

C# 如何计算路径上的点?

C# 如何计算路径上的点?,c#,algorithm,C#,Algorithm,我有一组纬度/经度点,它们形成了路径 上述路径由5个点组成。我想要的是创建一个函数,该函数将获取一些速度值,每次调用该函数时,它都将基于速度返回新的高级点。无需平滑拐角或其他东西,只需在给定路径上获取点即可 在创建这样的函数时需要一些帮助…计算一组两点的角度方向 var y = Math.sin(dLon) * Math.cos(lat2); var x = Math.cos(lat1)*Math.sin(lat2) - Math.sin(lat1)*Math.cos(lat

我有一组纬度/经度点,它们形成了路径

上述路径由5个点组成。我想要的是创建一个函数,该函数将获取一些速度值,每次调用该函数时,它都将基于速度返回新的高级点。无需平滑拐角或其他东西,只需在给定路径上获取点即可


在创建这样的函数时需要一些帮助…

计算一组两点的角度方向

var y = Math.sin(dLon) * Math.cos(lat2);
var x = Math.cos(lat1)*Math.sin(lat2) -
        Math.sin(lat1)*Math.cos(lat2)*Math.cos(dLon);
var brng = Math.atan2(y, x).toDeg();
然后计算“从起点到终点的给定距离和方位”

更多信息请点击这里,
我认为你需要使用弧度作为角度输入。

对于P0和P1:
yj=m*xj+h
m=((y1-y0)/(x1-x0))
h
可能是你拥有的最小的
yi
。@L.B:沉重的东西,如OP所述:“不需要平滑角落”。我以上评论的背景:(德语版,根据地图的位置:)是的,这正是我在等待回复时完成这项工作的方式。。。thx@Pablo如果你有你的答案,你应该是一个好的用户,并关闭你的问题,接受我的答案或张贴你自己的,并接受。
var lat2 = Math.asin( Math.sin(lat1)*Math.cos(d/R) + 
              Math.cos(lat1)*Math.sin(d/R)*Math.cos(brng) );
var lon2 = lon1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(lat1), 
                     Math.cos(d/R)-Math.sin(lat1)*Math.sin(lat2));