# Fitting a line to the set of planes

The methods of fitting lines, planes to the set of points are rather popular. But is it possible to do anything similar for the case when the 3D line is fitted to the set of 3D planes?

I.e. there are planes $\pi_i = \{a_i x + b_i y + c_i z + d = 0\}, i = 1, \ldots, n$; and we are searching for a line $L = \{A + tv | t \in \mathbb{R}\}$ that fits them in the best manner.

There is no strict understanding of how to measure the distance from the plane to the line, so any suggestions are welcome.

My own suggestion is to consider the dual transformation $\delta(\{a x + b y + c z + d = 0\}) = (-\frac{a}{d}, -\frac{b}{d}, -\frac{c}{d})$ and then find the best fitting line to dual images of planes, and then map this line back to the primal space. But the problem of such method is that dual transformation doesn't save the Euclidean distance.

EDIT: It can also be assumed (from the practical origin of the problem) that no two normals of planes are equal, in order to exclude the case of parallel planes.

• Of course one big difference is that in Euclidean space, there's always a line going through two points (so in the case of only two points, the perfect fit is always well-defined), while two planes may not intersect in a line (namely if they are parallel), so there are cases where even with just two planes, there's no obvious best fit of a line. Jun 26, 2017 at 8:24
• Yes, but let's consider the case when no two normals of planes are equal (the practical origin of this problem lets to assume this). Jun 26, 2017 at 8:29

• Hm. There is also a possibility to search a line as a container of the segment $[a, b]$, where $a$ can move on the fixed plane $\pi_a$, and $b$ can move on the fixed plane $\pi_b$, and these two planes are parallel... We can then minimize the sum of distance squares subject to the two linear constraints... We can also fix the distance between $a$ and $b$ and let them move through the whole space... Will it be equal to the result of your proposal? Jun 26, 2017 at 8:57