问题描述
我想找到一个未知节点在某个地方有它的参考距离,所有的人都知协调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.
不过,我不理解preliminary和最后的计算(参见维基百科)的一部分。我不明白我在哪里能找到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:
Solve for 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
忽略z代表2D问题。
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.
本文的后半部分描述重新$ P $方法psenting一组点的其中P1不是在原点或P2不在x轴上,使得它们适合这些约束。我preFER想它,而不是作为一个翻译,但是这两种方法将导致相同的解决方案。
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轴
如果P 2'不翻译P1到原点之后趴在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],这可以简化:一个B点始终是一个刚刚X分量,而||乙|| (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 = ||一|| COS(THETA),我们可以重新安排我们的最终公式:
We now have Ax = ||A|| cos(theta), which we can rearrange to our final equation:
theta = acos(Ax / ||A||)
或在我们的案例:
or in our case:
theta = acos(P2'x / ||P2'||)
我们计算P2'的幅度用||一|| =开方(AX +好哦+ 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.
要由R撤消旋转,乘P4''(-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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!