【问题标题】:How to find the angle between three points with openlayers?如何用openlayers找到三点之间的角度?
【发布时间】:2021-02-03 10:08:01
【问题描述】:

我使用 openlayers 6.5 版。

我想求两条线或三点之间的角度。

是否有图书馆可以参考或如何获取?

enter image description here

未找到相关库。 我应该用数学方法解决它吗?

【问题讨论】:

    标签: javascript openlayers


    【解决方案1】:

    你可以使用dot product:

    两个归一化向量的点积等于它们之间的角度。 一般情况下,当向量未归一化时,方程如下:

    cos(a^b) = dot(a,b) / length(a) / length(b)
    

    因此:

    a^b = arccos(dot(a,b) / length(a) / length(b))
    

    或者:

    a^b = arccos( (a.x*b.x + a.y*b.y + a.z*b.z) / sqrt(a.x^2+a.y^2+a.z^2) / sqrt(b.x^2+b.y^2+b.z^2) )
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-10
      • 1970-01-01
      • 2013-06-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多