I am looking into the possibility to use multiple iBeacons for indoor position location. i have tried the trilateration formula. but i think there is some problem its not giving the adjust location.
I have three iBeacons at a specific position
CGPoint a=CGPointMake(100, 0);
CGPoint b=CGPointMake(160, 270);
CGPoint c=CGPointMake(0, 145);
On didRangeBeacons
i am getting the following distance
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;
}
}
At the end i am using the trilateration formula.
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);
OutPut of the location
point = (x=138.025452, y=133.269165)
But its not a perfect. it should give the point near to the Point b. i dnt have an idea whats the wrong.
Please help.