三边测量和定位点 (x,y,z) [英] Trilateration and locating the point (x,y,z)

查看:23
本文介绍了三边测量和定位点 (x,y,z)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到一个未知节点的坐标,它位于空间中的某个位置,其参考距离远离 3 个或更多节点,这些节点都具有已知坐标.

I want to find the coordinate of an unknown node which lie somewhere in the space which has its reference distance away from 3 or more nodes which all of them have known coordinate.

这个问题与此处描述的三边测量完全相同三边测量.

This problem is exactly like Trilateration as described here Trilateration.

但是,我不明白关于初步和最终计算"的部分(请参阅维基百科网站).我不知道在哪里可以找到 P1、P2 和 P3,以便我可以代入这些等式?

However, I don't understand the part about "Preliminary and final computations" (refer to the wikipedia site). I don't get where I could find P1, P2 and P3 just so I can put to those equation?

谢谢

推荐答案

三边测量是寻找三个球体相交区域中心的过程.必须知道三个球体的中心点和半径.

Trilateration is the process of finding the center of the area of intersection of three spheres. The center point and radius of each of the three spheres must be known.

让我们考虑您的三个示例中心点 P1 [-1,1]、P2 [1,1] 和 P3 [-1,-1].第一个要求是 P1' 在原点,所以让我们通过向所有三个添加偏移向量 V [1,-1] 来相应地调整点:

Let's consider your three example centerpoints P1 [-1,1], P2 [1,1], and P3 [-1,-1]. The first requirement is that P1' be at the origin, so let us adjust the points accordingly by adding an offset vector V [1,-1] to all three:

P1' = P1 + V = [0, 0]
P2' = P2 + V = [2, 0]
P3' = P3 + V = [0,-2]

注意:调整后的点由 '(素数)注释表示.

Note: Adjusted points are denoted by the ' (prime) annotation.

P2' 也必须位于 x 轴上.在这种情况下,它已经存在,因此无需调整.

P2' must also lie on the x-axis. In this case it already does, so no adjustment is necessary.

我们将假设每个球体的半径为 2.

We will assume the radius of each sphere to be 2.

现在我们有 3 个方程(给定)和 3 个未知数(交点中心的 X、Y、Z).

Now we have 3 equations (given) and 3 unknowns (X, Y, Z of center-of-intersection point).

求解 P4'x:

x = (r1^2 - r2^2 + d^2) / 2d  //(d,0) are coords of P2'
x = (2^2 - 2^2 + 2^2) / 2*2
x = 1

求解 P4'y:

y = (r1^2 - r3^2 + i^2 + j^2) / 2j - (i/j)x //(i,j) are coords of P3'
y = (2^2 - 2^2 + 0 + -2^2) / 2*-2 - 0
y = -1

对于 2D 问题忽略 z.

Ignore z for 2D problems.

P4' = [1,-1]

P4' = [1,-1]

现在我们通过减去偏移向量 V 转换回原始坐标空间:

Now we translate back to original coordinate space by subtracting the offset vector V:

P4 = P4' - V = [0,0]

P4 = P4' - V = [0,0]

解点 P4 与预期一样位于原点.

The solution point, P4, lies at the origin as expected.

文章的后半部分描述了一种表示一组点的方法,其中 P1 不在原点或 P2 不在 x 轴上,以便它们符合这些约束.我更愿意将其视为翻译,但两种方法都会产生相同的解决方案.

The second half of the article is describing a method of representing a set of points where P1 is not at the origin or P2 is not on the x-axis such that they fit those constraints. I prefer to think of it instead as a translation, but both methods will result in the same solution.

将 P2' 旋转到 x 轴

如果将 P1 平移到原点后 P2' 不在 x 轴上,我们必须对视图执行旋转.

If P2' does not lie on the x-axis after translating P1 to the origin, we must perform a rotation on the view.

首先,让我们创建一些新向量作为示例:P1 = [2,3]P2 = [3,4]P3 = [5,2]

First, let's create some new vectors to use as an example: P1 = [2,3] P2 = [3,4] P3 = [5,2]

请记住,我们必须首先将 P1 转换为原点.与往常一样,偏移矢量 V 为 -P1.在这种情况下,V = [-2,-3]

Remember, we must first translate P1 to the origin. As always, the offset vector, V, is -P1. In this case, V = [-2,-3]

P1' = P1 + V = [2,3] + [-2,-3] = [0, 0]
P2' = P2 + V = [3,4] + [-2,-3] = [1, 1]
P3' = P3 + V = [5,2] + [-2,-3] = [3,-1]

要确定旋转角度,我们必须找到 P2' 和 [1,0](x 轴)之间的角度.

To determine the angle of rotation, we must find the angle between P2' and [1,0] (the x-axis).

我们可以使用点积等式:

A dot B = ||A|| ||B|| cos(theta)

当 B 为 [1,0] 时,可以简化为:A 点 B 始终只是 A 的 X 分量,||B||(B 的大小)总是乘以 1,因此可以忽略.

When B is [1,0], this can be simplified: A dot B is always just the X component of A, and ||B|| (the magnitude of B) is always a multiplication by 1, and can therefore be ignored.

我们现在有 Ax = ||A||cos(theta),我们可以将其重新排列为我们的最终方程:

We now have Ax = ||A|| cos(theta), which we can rearrange to our final equation:

theta = acos(Ax / ||A||)

或者在我们的例子中:

theta = acos(P2'x / ||P2'||)

我们使用 ||A|| 计算 P2' 的大小.= sqrt(Ax + Ay + Az)

We calculate the magnitude of P2' using ||A|| = sqrt(Ax + Ay + Az)

||P2'|| = sqrt(1 + 1 + 0) = sqrt(2)

将其插入我们可以解决 theta

Plugging that in we can solve for theta

theta = acos(1 / sqrt(2)) = 45 degrees

现在让我们使用旋转矩阵将场景旋转-45度.由于 P2'y 为正,并且旋转矩阵逆时针旋转,我们将使用负旋转将 P2 与 x 轴对齐(如果 P2'y 为负,则不要否定 theta).

Now let's use the rotation matrix to rotate the scene by -45 degrees. Since P2'y is positive, and the rotation matrix rotates counter-clockwise, we'll use a negative rotation to align P2 to the x-axis (if P2'y is negative, don't negate theta).

R(theta) = [cos(theta) -sin(theta)]
           [sin(theta)  cos(theta)]

  R(-45) = [cos(-45) -sin(-45)]
           [sin(-45)  cos(-45)]

我们将使用双撇号'"来表示已平移和旋转的向量.

We'll use double prime notation, '', to denote vectors which have been both translated and rotated.

P1'' = [0,0] (no need to calculate this one)

P2'' = [1 cos(-45) - 1 sin(-45)] = [sqrt(2)] = [1.414]
       [1 sin(-45) + 1 cos(-45)] = [0]       = [0]

P3'' = [3 cos(-45) - (-1) sin(-45)] = [sqrt(2)]    = [ 1.414]
       [3 sin(-45) + (-1) cos(-45)] = [-2*sqrt(2)] = [-2.828]

现在您可以使用 P1''、P2'' 和 P3'' 来求解 P4''.对 P4'' 应用反向旋转得到 P4',然后反向平移得到 P4,即您的中心点.

Now you can use P1'', P2'', and P3'' to solve for P4''. Apply the reverse rotation to P4'' to get P4', then the reverse translation to get P4, your center point.

要撤消旋转,请将 P4'' 乘以 R(-theta),在本例中为 R(45).要撤消平移,请减去偏移向量 V,这与添加 P1 相同(假设您最初使用 -P1 作为 V).

To undo the rotation, multiply P4'' by R(-theta), in this case R(45). To undo the translation, subtract the offset vector V, which is the same as adding P1 (assuming you used -P1 as your V originally).

这篇关于三边测量和定位点 (x,y,z)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆