lemmingapex / trilateration

Solves a formulation of n-D space trilateration problem using a nonlinear least squares optimizer
MIT License
398 stars 106 forks source link

Unexpected results #5

Closed orcking closed 8 years ago

orcking commented 8 years ago

Hi there:

here is my data double[][] positions = {{2,4},{21,13},{0,42}}; double [] distances = {35,45,5};

result [-19,31]

It seems way off, if you plot it , it should be around the [5,35] area.

Can you please tell me what is wrong?

Thanks

lemmingapex commented 8 years ago

Why would you expect an intersection with this data?

screen shot 2016-08-25 at 2 15 30 pm

orcking commented 8 years ago

Hi:

Thanks for the quick answer, maybe I miss understood what the algorithm is doing, I thought it would try to find the intersection of all possible circles. Anyway, can you please tell me why [-19,31] would be a good solution.

Thanks again.

lemmingapex commented 8 years ago

Because there is no intersection among all three circles. If your distances were instead

double [] distances = {35,45,22};

then there would be a near intersection among all three circles. Does that make sense?

orcking commented 8 years ago

So it picks the edge of intersection (not area of intersection)? Then there could be other answers like [-4,39] or [4,39]??

Thanks

lemmingapex commented 8 years ago

That's correct.

lemmingapex commented 8 years ago

@orcking Can I close this ticket?

orcking commented 8 years ago

Just one more question. Do you know of an algorithm that gives me a point in the intersection area of all circles?

Thanks

lemmingapex commented 8 years ago

@orcking I am not exactly certain what you are looking for, but the conbined centroid of area might be sufficient for you: https://en.wikipedia.org/wiki/Centroid