Java: plot points based on distances

2019-01-27 11:15发布

I need to plot a group of points based on distances. I have three unknown points X, Y, and Z. I then get another unknown point (A) and its distances from the originals (AX, AY, AZ). I will continue getting points and distances (B, BX, BY, BZ; C, CX, CY, CZ) etc.

My question is whether its possible to plot all of the points. If so, how many points would I need for an exact plot map? What about an approximate map?

This is similar to this question but I get a different set of distances and am not limited to the original number of points.

Also, if it would help I could add more points to the X, Y, Z group which would give me more distances for A, B, etc.What I don't know until it's been somehow calculated are any of the Distances XY, XZ, YZ, AB, AC, etc.

2条回答
唯我独甜
2楼-- · 2019-01-27 11:25

I am not sure exactly what you mean by exact plot map or approximate plot map. I think I might know but I am not sure. But plotting all points in this case, to me is not possible if the user can continue to "add more points to the XYZ group", which is dynamic. It would sound like you need to know what the user is going to plot before he does. Now if all this is static, it is possible

查看更多
Deceive 欺骗
3楼-- · 2019-01-27 11:45
  1. I assume you use 2D space

    If it is 1D then 2 points are enough (not identical !!!).

    If 2D then 3 distances is enough but the points used must not lay on the same line !!!

  2. position/orientation of the plot

    for relative plot are above conditions enough if you want also the exact orientation and position then you need to know exact position of first 3 points otherwise your plot will look the same but can be offseted,rotated and mirrored to original geometry.

    • knowing 1 point eliminates offset
    • knowing 2 point eliminates rotation
    • knowing 3 point eliminates mirroring

[notes]

you need n+1 points for n-D coordinate system

[edit1] equations

original question text did not contain any equations need but comments requires it so here are some:

You will need intersection point between two hyperspheres (in 2D circles, in 3D spheres,...) so look here:

Cast circle from each point as center with radius equal to the distance from that point. Find out intersection point that is the same between all combinations of circles (0,1),(0,2),(1,2)

example

Yellow intersection is the same in all 3 combinations so that is the next point or for 2D just solve this system:

(x-x0)^2+(y-y0)^2=l0^2
(x-x1)^2+(y-y1)^2=l1^2
(x-x2)^2+(y-y2)^2=l2^2

where x,y is the intersection point, xi,yi are center of circle and li is distance from that point.

The first option should be simpler and more accurate if done right but need some knowledge on vector and trigonometry math. You will need to add rotation or compute on vectors and use perpendicular vector feature in 2D

V(x,y) -> V0(+y,-x),V1(-y,+x)

where V0,V1 are perpendicular to V

查看更多
登录 后发表回答