用户位置与信标三边测量

时间:2015-03-14 11:16:18

标签: ios cllocationmanager ibeacon trilateration clbeacon

我正在使用基于灯塔的项目我的项目中的一个主要功能是使用信标的室内导航我尝试了一些第三方sdks但没有帮助我。因此,我决定用一组方程式进行自己的三角测量,然后我再次坚持它,因为为了我的目的,我想知道从用户到每个信标的近似距离,我的信标接近值总是给出0,1,3所以我将如何获得这些近似距离请帮助我。

我的计算userlocation(x,y)的方法如下:

   -(void)indorLocationCalculationProximity1:(float*)ra proximity2:(float*)rb proximity3:(float*)rc
{

    CGPoint a=CGPointMake(100, 0);
    CGPoint b=CGPointMake(200,100);
    CGPoint c=CGPointMake(0, 100);

    float S = (pow(c.x, 2.) - pow(b.x, 2.) + pow(c.y, 2.) - pow(b.y, 2.) + pow(rb, 2.) - pow(rc, 2.)) / 2.0;

    float T = (pow(a.x, 2.) - pow(b.x, 2.) + pow(a.y, 2.) - pow(b.y, 2.) + pow(rb, 2.) - pow(ra, 2.)) / 2.0;
    float y = ((T * (b.x - c.x)) - (S * (b.x - a.x))) / (((a.y - b.y) * (b.x - c.x)) - ((c.y - b.y) * (b.x - a.x)));
    float x = ((y * (a.y - b.y)) - T) / (b.x - a.x);

}

0 个答案:

没有答案