Reputation: 1121
I have 3 signal receivers indoors, A, B, C, to detect whether customers are standing in the orange highlighted area shown above.
So, now we only got 3 circles, if we had more points the area would be more accurate.
Question: How to find the Highlighted Area Coordinate in the image above, and find the center point of that area (green point in picture). Actually I'm using VB.NET, what math formula I should use?
Upvotes: 2
Views: 1652
Reputation: 2137
I often find that getting exact geometrically precise answer may result in too much effort. Therefore I would suggest to sample all area with a grid of given step (say 10 cm). For each coordinate check if it is in all circles if yes put that position to list. Finally get average position from list.
Pseudocode:
left = min(A.x-A.r, B.x-B.r, C.x-C.r);
top = min(A.y-A.r, B.y-B.r, C.y-C.r);
right = max(A.x+A.r, B.x+B.r, C.x+C.r);
bottom = max(A.y+A.r, B.y+B.r, C.y+C.r);
for (x=left; x<=right; x+=0.1)
for (y=top; y<=bottom; y+=0.1)
if (A.inCircle(x,y) && B.inCircle(x,y) && C.inCircle(x,y)) list.add([x,y]);
return list.getAveragePos();
Please note that you can greatly speed this up only by considering grid for the smallest circle.
Upvotes: 0