max12345
max12345

Reputation: 39

Algorithm for finding my position using the distance from 3 different points

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

Answers (2)

LSerni
LSerni

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:

https://math.stackexchange.com/questions/110309/three-circle-intersection-for-circles-of-unbounded-integer-radius

Your robot will be in the intersection of the three circles. (Extra characters to allow my 1 character edit to be accepted).

Upvotes: 1

Morpfh
Morpfh

Reputation: 4093

Trilateration. http://en.wikipedia.org/wiki/Trilateration

Upvotes: 0

Related Questions