Reputation: 39
I'm trying to develop an algorithm for a robot, which takes the distance from three different points which are visible to the robot, assumes each point is a center of a circle, and the distance is a radius of a that circle, and then maps the robot position as the intersection of those 3 circles.
I have difficulties to develop the algorithm, and even a math formula would help. Also, I also have the angle between the robot and each point, but don't know where to use it.
Hope someone can help.
Upvotes: 1
Views: 4698
Reputation: 57418
Suppose that the three points are not aligned, which you can verify with
(y1 - y2)*(x1 - x3) != (y1 - y3)*(x1 - x2)
if x1, x2 and x3 are all different; if two of them are equal and the third is not, the three points of course can't be aligned and you needn't check.
We can now reduce to a known solution:
Your robot will be in the intersection of the three circles. (Extra characters to allow my 1 character edit to be accepted).
Upvotes: 1