3

How can I calculate center point from set of coordinates with accuracy?

For example from set of observations:

point   xcoord  ycoord  accuracy    time
1       x1      y1      2000        t1
2       x2      y2      2000        t2
3       x3      y3      2000        t3
n       xn      yn      2000        tn

Techically all those points are centerpoints for circles with radius of their accuracy, and we know that we are within atleast one circle at time.

I would like to calculate center point and accuracy for circles' intersecting areas.

Here's a crude example. Green line is trying to represent accuracy crude example picture

4

1 回答 1

2

+1 非常有趣的问题......这是我在 C++ 中的方法

存储所有需要的全局表和变量:

const int    N=5;       // number of measurement circles
struct _circle { double x,y,r; _circle() { x=0; y=0; r=0.0; } } circle[N],circle0,circle1;
  • circle[]- 测量位置
  • circle0- 原始真实位置(你不知道)
  • circle1- 计算更准确的位置

这是我的随机测量值(请复制您的测量值):

int i;
double r,a,x0,x1,y0,y1;
// set real position
circle0.x=50.0;
circle0.y=50.0;
circle0.r=25.0;
// set meassured positions
Randomize();
for (i=0;i<N;i++)
    {
    r=circle0.r*(0.2+(0.3*double(Random(101))*0.01));
    a= 2.0*M_PI*          double(Random(101))*0.01;
    circle[i]=circle0;
    circle[i].x+=r*cos(a);
    circle[i].y+=r*sin(a);
    }

这是计算平均样式位置的方法:

// compute more accurate position (average style)
circle1.x=0.0;
circle1.y=0.0;
circle1.r=circle0.r;
for (i=0;i<N;i++)
    {
    circle1.x+=circle[i].x;
    circle1.y+=circle[i].y;
    }
circle1.x/=N;
circle1.y/=N;
for (i=0;i<N;i++)
    {
    r=circle1.x-circle[i].x; r*=r;
    a=circle1.y-circle[i].y; a*=a;
    r=circle[i].r-sqrt(a+r);
//  if (circle1.r>r) circle1.r=r;   // best accuracy
    if (circle1.r<r) circle1.r=r;   // worse accuracy
    }
  • 在最后两个 if 中选择了您想要的精度半径...
  • 位置基于所有测量值的平均值

这是计算几何样式位置的方法:

// compute more accurate position (geometry style)
x0=circle[i].x; x1=x0;
y0=circle[i].y; y1=y0;
for (i=0;i<N;i++)
    {
    a=circle[i].x; if (x0>a) x0=a; if (x1<a) x1=a;
    a=circle[i].y; if (y0>a) y0=a; if (y1<a) y1=a;
    }
circle1.x=0.5*(x0+x1); x1-=x0; x1*=x1;
circle1.y=0.5*(y0+y1); y1-=y0; y1*=y1;
circle1.r=1.0*sqrt(x1+y1);
  • 位置是占据区域的中心

以下是我的代码输出的一些预览:

精度重叠

于 2013-12-28T17:00:34.517 回答