# Distance metric for (infinite) lines in 3D

I would like a metric $d(\;)$ between pairs of (infinite) lines in $\mathbb{R}^3$, with these properties:

• If two lines $L_1$ and $L_2$ are parallel and separated by distance $x$, then $d(L_1,L_2) = x$.

• $d(L_1,L_2)$ increases with the degree of skewness between the lines, i.e., the angle $\theta$ between their projections onto a plane orthogonal to the shortest segment connecting them (dashed below), where $\theta=0$ for parallel lines and $\theta=\pi/2$ for orthogonal lines. Intuitively, I would like the metric to be related to the repulsive force between two electrically charged lines (but it need not be exactly the actual physical force).

Have such metrics been considered in the literature? If so, I'd appreciate descriptions and/or pointers—Thanks!

Update1. It turns out that the natural ad hoc definition (from the comments) fails to be a metric. For example, below, a sufficiently large value of $a$ ensures the triangle inequality will be violated: So this question may be more difficult than it initially appeared...

Update2. The responses to this followup MO question have revealed that in fact there is no metric that satisfies my two conditions (and is continuous w.r.t. $\theta$)!

• Can we put $d(L_1,L_2) = \lambda(L_1,L_2) + \theta(L_1,L_2)$ where $\lambda$ is the length of that shortest segment, and $\theta$ is the angle, or that's not a metric? Or you rather ask for all possible $d$ satisfying those two properties? – Ilya Jul 19 '13 at 12:52
• @Ilya: Yes, I can think of many ad hoc definitions, but I would prefer something more principled, connecting to other research. – Joseph O'Rourke Jul 19 '13 at 12:55
• I see ${{{}}}{}$ – Ilya Jul 19 '13 at 12:56
• I think the ad hoc metric $\lambda + |\theta|$ is pretty natural. I can think of one simple variant: $|\sin\theta|$ instead of $|\theta|$. Anyway, it does not seem to reduce ad-hocness that much. – Tunococ Jul 19 '13 at 13:21

## 2 Answers

You could use to sum of the "usual" metric distance $d(A,B) := \inf_{a\in A, b\in B} \Vert a-b \Vert$ plus a distance measure on the angle Vectors $\theta \in S_2/\pm$. i.E. $$m(L_1, L_2) := d(L_1, L_2) + \Vert \theta_1 \times \theta_2 \Vert$$ where $L_1 = \{ x_1 + t \theta_1, t\in \mathbb{R} \}, L_2 = \{ x_2 + t \theta_2, t\in \mathbb{R} \}$

• And of course the cross-product should be normalized, in which case it reduces to the sine of the angle. – Joseph O'Rourke Jul 19 '13 at 13:23
• That's what the euclidean norm does here, assuming $\theta_1, \theta_2 \in S^2$, i.e. $\Vert \theta_i \Vert = 1$ – AlexR Jul 23 '13 at 10:27

A natural metric could perhaps be constructed as follows: Consider the Euclidean group (the group of all rotations and translations). Since it is a Lie group, I think it should be possible to define a natural geodesic metric on it. With that, you'd have for each transformation a distance from the identity. Now consider the set of transformations which transform the first straight line to the second, and calculate for each one the distance to the identity. I'm pretty sure that the minimum of that should give a proper distance measure for straight lines.

Since parallel lines are transformed into each others using only translations, and translations form a vector space with the displacement distance as natural norm, I also think this should fulfil the condition that for parallel lines it gives just their Euclidean distance in space.