我正在尝试学习如何使用原点的 XYZ 坐标、水平和垂直角度以及 3d 距离来计算点的 XYZ 坐标。我可以简单地通过将点投影到 2D 平面上来进行计算,但是有没有更直接的方法可以在 3D 中做到这一点?
我试图了解测量全站仪如何根据其测量位置、它测量到新点的 3d(斜率)距离以及测量到的新点位置的水平和垂直角度来计算新点位置。
谢谢,
乙
最佳答案
关于约定的说明: 2D polar coordinates 经常使用 (radius, theta)
,其中 theta
是“水平”或“方位角”角。它的范围从: theta=0
,X 轴上的 2D 点 (x,y) = (radius,0)
到: XY 平面上的 theta=2*PI
- 随着 theta
增加,逆时针方向。现在混淆问题...
3D spherical coordinates(保持右手坐标系)经常使用坐标: (radius, theta, phi)
。在这种情况下,theta
用于“垂直”或“天顶”角度,范围从 theta=0
(Z 轴)到 theta=PI
(-Z 轴)。 phi
用于方位角。
其他文本将使用不同的约定 - 但这似乎受到物理学家和(某些)数学文本的青睐。重要的是您选择一个约定并始终如一地使用它。
在此之后:radius
: 到点的距离。给定笛卡尔坐标中的一个点 (x,y,z)
,我们有(勾股)半径: r = sqrt(x * x + y * y + z * z)
,例如, 0 <= radius < +infinity
theta
:天顶角,其中 theta=0
位于正上方(+Z 轴),theta=PI
位于正下方(-Z 轴),而 theta=PI/2
是您认为 0 度的“高度”,例如,
0 <= theta <= PI
phi
:方位角,其中 phi=0
是“右”(+X 轴),当您“逆时针”转动时,phi=PI/2
(+Y 轴)、phi=PI
(-X 轴)、phi=3*PI/2
(-Y轴)和 phi=2*PI
- 相当于 phi=0
(回到 +X 轴)。例如, 0 <= phi < 2*PI
伪代码:(标准数学库三角函数)
从 (radius, theta, phi)
您可以找到点 (x,y,z)
:x = radius * sin(theta) * cos(phi);
y = radius * sin(theta) * sin(phi);
z = radius * cos(theta);
相反,您可以从 (radius, theta, phi)
中找到 (x,y,z)
:radius = sqrt(x * x + y * y + z * z);
theta = acos(z / radius);
phi = atan2(y, x);
注意:在最终方程中使用 atan2
很重要,而不是 atan
!
关于3d - 使用水平和垂直角度和斜距计算 3D 点坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30619901/