# Find coordinates of points when distance is known amongst them

Lets say I have 6 point name A, B, C, D, E, F.

Distance between a point and it's nearest 3-4 points are known i.e the displacement.

Now I want to assign x and y coordinates to them assuming one point as (0, 0).

The origin point can be taken as input from the user. But nothing more than that.

Sample input :

Distance between A & B = Given

Distance between A & F = Given

Distance between A & c = Given

So on, distance between all the points are given.

Required output :

Update :

The question is not specific to 6 points. The number of points can be dynamic. Maybe 30, maybe 40.

Consider this image.

Distance between Pooint (A, B) , (A, C), (A,L) is known i.e the LOS distance between points. But same can't be said for Point (A, D), as the LOS distance between A and D is unknown. But Distance between (L, D), (C, D), (K,D) is known.

New contributor
driftking9987 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
• You'll get an overdetermined system of quadratic equations, which most probably won't have an exact solution (because of limited precision of numbers in computer) – HEKTO Jun 6 at 16:37
• Look into multi-dimensional scaling and SMACOF. I have a demo of it being used here: orlp.github.io/Robotics2020-Final/distpos/demo.html. You can use it to derive (plausible) positions from distances. Beware that you have more freedoms than just marking one point as the origin though, distances are preserved under rotation and reflection as well. – orlp Jun 6 at 17:09
• I find the question confusing. In one place you say we're given the distance between a point and its nearest 3-4 neighbors, in another you say we're given the distance between all points. Which is it? – D.W. Jun 6 at 21:54
• In the given example as it only has 6 points, indirectly we have distance known among all of the points, but if we have let's say 15 points, then distance between point A and point H wouldn't be known. @D.W. – driftking9987 Jun 7 at 4:04
• Sorry, it's still not clear what is known. Can you edit your question to be more precise, and state the problem clearly, and avoid statements that appear to contradict each other? If you have 6 points, then knowing the distances for the 3-4 nearest neighbors means you don't know all distances for all pairs, as each point has 5 neighbors. – D.W. Jun 7 at 5:22