假设我们有在3-d(P1,P2,P3,P4)4分。 如果这些点的坐标与他们的欧几里得距离给第五点P5(R1,R2,R3,R4),如何计算P5的坐标?
在这个帖子中,回答唐里巴是完美的2-d。 但我怎么把它扩展到3 d?
这里是我的二维码:
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);
}
我想用签名重载函数
static void localize(double[] P1, double[] P2, double[] P3, double[] P4, double r1, double r2, double r3, double r4)