Triangulate example for iBeacons

后端 未结 13 2332
梦毁少年i
梦毁少年i 2020-11-28 17:14

I am looking into the possibility to use multiple iBeacons to do a \'rough\' indoor position location. The application is a kind of \'museum\' setting, and it would be easie

13条回答
  •  清歌不尽
    2020-11-28 17:58

    Alternative Equation

    - (CGPoint)getCoordinateWithBeaconA:(CGPoint)a beaconB:(CGPoint)b beaconC:(CGPoint)c distanceA:(CGFloat)dA distanceB:(CGFloat)dB distanceC:(CGFloat)dC {
    
    
    CGFloat x, y;
    x = ( ( (pow(dA,2)-pow(dB,2)) + (pow(c.x,2)-pow(a.x,2)) + (pow(b.y,2)-pow(a.y,2)) ) * (2*c.y-2*b.y) - ( (pow(dB,2)-pow(dC,2)) + (pow(c.x,2)-pow(c.x,2)) + (pow(c.y,2)-pow(b.y,2)) ) *(2*b.y-2*a.y) ) / ( (2*b.x-2*c.x)*(2*b.y-2*a.y)-(2*a.x-2*b.x)*(2*c.y-2*b.y) );
    
    y = ( (pow(dA,2)-pow(dB,2)) + (pow(c.x,2)-pow(a.x,2)) + (pow(b.y,2)-pow(a.y,2)) + x*(2*a.x-2*b.x)) / (2*b.y-2*a.y);
    
    
    
    return CGPointMake(x, y);
    }
    

提交回复
热议问题