How to construct a line with a given equal distance from 3 Points in 3 Dimensions?

3.4k Views Asked by At

Important: I'm now convinced that 4 points are needes in order to reduce the solutions to a finite number. (Which is necessary because I need ALL solutions)

In a computer science context I need to solve a geometrical problem which states:

Given three points in three-dimensional space, find a line $L$ (in any form, e.g. specify two points which lie on the line) so that the distance between each of the points and $L$ are equal to a given distance $d$, if possible.

By distance between a point $P$ and a line $L$, the euclidean distance between $P$ and the foot of the perpendicular on $L$ that passes through $P$ is meant.

In two dimensions (given two points) this is rather simple as it involves only a few trigonometric functions, altough I really struggle with it in three dimensions. The reason surely is that I'm not from a math background and don't know too much about linear algebra (which I believe is involved here).

It would be ideal if there is a solution for $N$ dimensions (I think that $N$ Points are needed then), altough I would be very happy if someone could give at least some hints about the three dimensional problem (maybe some sort of heuristic that i didn't thought of could also work). :)

EDIT: Clarification

The distance between the points and the line is a given constant. Example: Given three Points and a distance $d=3$, I want to find the line which has a distance of $d$ (in this case $3$) to every given point, if possible (of course there are many cases where such a line does not exist). And I am aware of the fact that this line is not unique (several, or in case of colinearity of the three points, infinitely many lines exist)

EDIT: Clarification II

It seems that my wording causes much confusion about exactly WHAT properties the line should have. A picture showing the two-dimensional case follows:

In this case the Points $P_1$ and $P_2$ are given and the task was to find the line $g$ such that every given Point has the same shortest distance $r_B$ (which is preset) to $g$. (In this context the line was specified by a point $C$ and the angle $\alpha$, altough I'm happy with any kind of parameterization).

Now I have given 3 three-dimensional points and want to find a line with the described properties and I do not have any idea how to do this.

EDIT III:

I should also have mentioned that I should be able to find all solutions (I am 99% convinced that there is only a finite number of solutions for ordinary cases)

5

There are 5 best solutions below

7
On

Let me briefly explain the case of $3$ dimension:

Find the plane contains those $3$ points. In this plane, find the circumcenter of the triangle formed by these $3$ points, then the straight line perpendicular to this plane and passing through the circumcenter is the required line.

0
On

I think such line may not be unique.

Find in 3D,the plane contains those 3 points. In this plane, the three points form a triangle. Let the straight line parallel to a side, say $AB$ then moving to the third point $C$ parallel on the plane. Then it will reach a line $l_1$ where ABC has the same distance $d_0$ to it (during the movement, A,B always have the same distance to the line) . Then move the line paralelly to the direction up/down perpendicular to the plane (during the movement, A,B,C always have the same distance to the line). Stop when you have the desired distance.

Of course, if the desired $d$ is too small, you can't get a solution. And for a nice $d$, you will get several solutions depending on which side you start with.

0
On

There is a line for which each point has the same distance from the three points, but that distance will depend on which point of the line it was.
There is either zero, one or two points on the line that are a distance $d$ from the three points.
Given the points $(a,b,c),(e,f,g),(h,k,m)$, and a point equidistant $(x,y,z)$, then $$(x-a)^2+(y-b)^2+(z-c)^2=d^2\\(x-e)^2+(y-f)^2+(z-g)^2=d^2\\(x-h)^2+(y-k)^2+(z-m)^2=d^2$$ Subtract the first equation from the other two $$2x(a-e)+2y(b-f)+2z(c-g)=a^2-e^2+b^2-f^2+c^2-g^2\\ 2x(a-h)+2y(b-k)+(2z(c-m)=a^2-h^2+b^2-k^2+c^2-m^2$$ This is two linear equations in three unknowns. I hope you know how to solve it; it usually gives a line.
To get a common distance $d$, feed your answer back into the first equation, and you get a quadratic in $d$, which has zero, one or two solutions.

5
On

Maybe the following will help. It's not an answer, but it's too long for a comment.

Suppose the given distance is $d$. Then $L$ must be simultaneously tangent to three spheres of radius $d$, one centered at each of the given points.

Consider the case where the distances between some pair of the points is $D>2d$. The radius $d$ spheres can be nestled inside a ruled surface of this shape (so long as it's sized appropriately):

enter image description here

Any line of the ruled surface is tangent to both spheres.

You can also fit two spheres with centers distance $D$ apart into a ruled surface that's more (or completely) cone-like, or into one that's less cone-like and more (or exactly) cylindrical. Any of these ruled surfaces will yield an infinite number of lines $L$ tangent to these first two spheres.

If the sphere of radius $d$ about the third point intersects any of these ruled surfaces (hyperboloids of one sheet with axis containing the first two spheres' centers - the cone and the cylinder being degenerate ones), it seems like there will be either one or two lines $L$ from that ruled surface where $L$ equidistant from the three points.

I think that the third sphere will intersect one of these ruled surfaces if and only if it intersects either the cone or the cylinder, so maybe only the degenerate hyperboloids need to be considered.

If none of the points are more than $2d$ units apart, the first two spheres will intersect in a circle. The families of lines tangent to both will comprise a cylinder and some hyperboloids, but you can't twist them completely into a cone. Instead, there will be a different degenerate ruled family of tangent lines: those in the plane through the spheres' circle of intersection that are also tangent to that circle. Again, if the third sphere intersects any of these families of lines (and I think in this case it must), you'll get solutions.

0
On

As you have already noted, three points is not enough in general. In most case, you will need four points to constrain the line completely. Using Plücker coordinates makes this point obvious. For a line defined by Plücker coordinates $$p_{01},p_{02},p_{03},p_{23},p_{31},p_{12}$$ the distance $d$ between a point $(x,y,z)$ and the line satisfies $$d^2=(p_{01}+zp_{31}-yp_{12})^2+(p_{02}+xp_{12}-zp_{23})^2+(p_{03}+yp_{23}-xp_{31})^2,$$ provided that $p_{23}^2+p_{31}^2+p_{12}^2=1$. The Plücker coordinates obey $$p_{01}p_{23}+p_{02}p_{31}+p_{03}p_{12}=0$$ and you can always normalize them so that $$p_{23}^2+p_{31}^2+p_{12}^2=1.$$ The four points and the two equations above yield a system of six equations for six unknowns. It can be easily solved numerically for the given coordinates of the four points. Looking for a general analytical solution might be too onerous.

To illustrate, for $d=1$ and points $$(0,0,0), (4,0,0), (6,2,0), (9,4,1)$$ I get the following lines $$(-0.236073,0.351294,0.906014,0.91316,0.399015,0.0832224),$$ $$(0.0561098,-0.577272,0.814622,0.867865,0.431585,0.24606).$$