-2

I'm trying to reconstruct a set of points according to their relative distances and an initial known point a0. The points can be in any direction, as long as their relative distances are respected. The point a0 has the property of not being on the same plan that a1, a2 and a3.

Let dij be the distance between two points.

Considering a0 is placed at (x0, y0, z0), I have managed to place a1 at (x0+d10, y0, z0).

a0(x0, y0, z0)
a1(x0+d10, y0, z0)

In order to place a2, I consider two spheres S1 and S2 of centers d10 and d20 and of following equations. My idea is since the point I'm looking for is any of the points of the intersection of the spheres, I should be able to find a solution a2 among the solutions of the intersection.

d20² = (x2-x0)² + (y2-y0)² +(z2-z0)²
d21² = (x2-x1)² + (y2-y1)² +(z2-z1)²

I was expecting to obtain the equation of a cirle from these equations but all I can obtain is the following cartesian equation of a plan.

x2(x0-x1) + y2(y0-y1) + z2(z0-z1) + (d20-d21-x0²-x1²+y0²-y1²+z0²-z1²)/2 = 0

I wonder if I have made an algebric mistake though I checked twice, and if my assumption of obtaining the equation of a circle was wrong.

Also, even while assuming the equation I have obtained is correct, I'm unable to find a method to find a solution (x2, y2, z2) that fits the constraints. Any solution would be right but I can't deduce x2 from y2 and z2 since they have no constraints. I am writing an algorithm so I'm looking for an automatic solution.

I would be very grateful if you could help me, I have spend the entire day looking for a solution to that problem.

2 Answers2

0

First of all you can always have a solution with $z_2=z_0$, if that is fine for you. You can then find $y_2$ (as a function of $x_2$) from the equation of the plane and plug the result into one of the sphere equations. Solve then for $x_2$.

Intelligenti pauca
  • 50,470
  • 4
  • 42
  • 77
0

It looks like you’ve subtracted one sphere equation from the other. This eliminates all of the quadratic terms, so you shouldn’t expect that you’ll end up with an equation of a circle. Moreover, a curve in 3-D space, even one that’s planar as this will be, can’t be represented by a single implicit Cartesian equation.

Analogously to the result of subtracting the equations one circle from another, what you’ve got is the equation of the plane on which the spheres’ intersection lies. You still need to intersect this plane with either of the two spheres in order to find the intersection circle.

I suggest simplifying things a bit by placing the three points relative to the origin and then translating by $a_0$ afterwards. This will reduce a lot of clutter in the equations that you’re manipulating. So, you would instead set $a_1=(d_{01},0,0)$. You might as well place $a_2$ on the $x$-$y$ plane as well: $a_2 = (x_2,y_2,0)$. This reduces the placement to a two-dimensional problem. Following the same method that you’re using, $a_2$ is at the intersection of a circle centered on the origin and one centered on $a_1$. The difference of their equations is the equation of the line on which the circle’s intersections lie, and $a_2$ is a point on this line at a distance of $d_{02}$ from the origin. If you convert the equation of the line into parametric form, placing $a_2$ reduces to solving a quadratic equation.

Now that you’ve got $a_1$ and $a_2$ in place, locating $a_3$ can proceed in a similar fashion: find the intersection of three spheres. The differences of pairs of their equations are equations of planes on which the pairwise intersections lie, and the intersection of these planes will be a line through the common intersection points. (You only need to consider two of the three planes—the third is redundant.) As before, find the parametric equation of this line and solve the resulting quadratic equation to find the points on the line that are at a distance of $d_{03}$ from the origin. Finally, translate to $a_0$ by adding its coordinates to those you’ve computed.

You might have noticed that in general there will be two possible solutions for $a_2$ and $a_3$. These resulting configurations are mirror images of each other. In fact, you can generate other possible solutions by applying an orthogonal transformation to the computed configuration before translating to $a_0$.

amd
  • 53,693
  • Thank you it has been very helpful. I've managed to place the four first points. Now I'm looking for the general way of placing the others. – Juleguy Apr 20 '18 at 07:38
  • @Juleguy If what you’re really trying to do is place a cluster of points given their pairwise distances, you’ll want this – amd Apr 21 '18 at 01:15