使用3-D中其他三个点的距离来定位点 [英] Localizing a point using distances to three other points in 3-D
本文介绍了使用3-D中其他三个点的距离来定位点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果这些点的坐标与其第五点P5(r1,r2,r3,r4)的欧几里德距离给出,那么如何计算P5的坐标?
在此帖子中,回答 Don Reba 非常适合二维。但我该如何将它扩展到3D?
这是我的2D代码:
static void localize(double [] P1,double [] P2,double [] P3,double r1,double r2,double r3)
{
double [] ex = normalize (差(P2,P1));
double i = dotProduct(ex,difference(P3,P1));
double [] ey = normalize(difference(difference(P3,P1),scalarProduct(i,ex)));
double d =幅度(差异(P2,P1));
double j = dotProduct(ey,difference(P3,P1));
double x =((r1 * r1) - (r2 * r2)+(d * d))/(2 * d); $(((r1 * r1) - (r3 * r3)+(i * i)+(j * j))/(2 * j)) - ((i * x)/ j) ;
System.out.println(x ++ y);
$ / code>
我想用签名
static void localize(double [] P1,double [] P2,double [] P3,double [] P4,double r1,double r2 ,双r3,双r4)
解决方案
Wikipedia trilateriation < a href =http://en.wikipedia.org/wiki/Trilateration =nofollow> article 描述了答案。计算步骤如下:
$ ol
= z =±sqrt(r1 2 -x-1) sup> 2 - y 2 )
Assume that we have 4 points in 3-D (P1, P2, P3, P4). If the coordinates of those points are given with their euclidian distances to a fifth point P5 (r1, r2, r3, r4), how to calculate the coordinates of P5?
In this post, answer of Don Reba is perfect for 2-D. But how do I extend it to 3-D?
Here is my code for 2D:
static void localize(double[] P1, double[] P2, double[] P3, double r1, double r2, double r3)
{
double[] ex = normalize(difference(P2, P1));
double i = dotProduct(ex, difference(P3, P1));
double[] ey = normalize(difference(difference(P3, P1), scalarProduct(i, ex)));
double d = magnitude(difference(P2, P1));
double j = dotProduct(ey, difference(P3, P1));
double x = ((r1*r1) - (r2*r2) + (d*d)) / (2*d);
double y = (((r1*r1) - (r3*r3) + (i*i) + (j*j)) / (2*j)) - ((i*x) / j);
System.out.println(x + " " + y);
}
I want to overload the function with the signature
static void localize(double[] P1, double[] P2, double[] P3, double[] P4, double r1, double r2, double r3, double r4)
解决方案
The Wikipedia trilateriation article describes the answer. The calculation steps are:
- ex = (P2 - P1) / ‖P2 - P1‖
- i = ex(P3 - P1)
- ey = (P3 - P1 - i · ex) / ‖P3 - P1 - i · ex‖
- d = ‖P2 - P1‖
- j = ey(P3 - P1)
- x = (r12 - r22 + d2) / 2d
- y = (r12 - r32 + i2 + j2) / 2j - ix / j
- z = ±sqrt(r12 - x2 - y2)
这篇关于使用3-D中其他三个点的距离来定位点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文