【发布时间】:2014-06-12 12:39:20
【问题描述】:
我正在研究使用多个 iBeacon 进行室内定位的可能性。我试过三边测量公式。但我认为它没有给出调整位置存在一些问题。
我在特定位置有三个 iBeacon
CGPoint a=CGPointMake(100, 0);
CGPoint b=CGPointMake(160, 270);
CGPoint c=CGPointMake(0, 145);
在didRangeBeacons 我得到以下距离
float ra =0.0f;
float rb=0.0f ;
float rc=0.0f ;
for (CLBeacon *beacon in beacons) {
if ([beacon.minor floatValue]==57726) {
//ra = beacon.accuracy; ra=5.33124
ra = beacon.proximity;
}
if ([beacon.minor floatValue]==31901) {
// rb = beacon.accuracy; rb=0.185142
rb = beacon.proximity;
}
if ([beacon.minor floatValue]==53482) {
// rc = beacon.accuracy; rc=3.23776
rc = beacon.proximity;
}
}
最后我使用的是三边测量公式。
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);
位置的输出
point = (x=138.025452, y=133.269165)
但它并不完美。它应该给出靠近点 b 的点。我不知道出了什么问题。
请帮忙。
【问题讨论】:
标签: ios iphone objective-c ibeacon triangulation