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.

  • 1
    $\begingroup$ 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. $\endgroup$
    – celtschk
    Jun 26, 2017 at 8:24
  • $\begingroup$ 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). $\endgroup$ Jun 26, 2017 at 8:29

1 Answer 1


Maybe the following could work (note that everything marked with "should" is things I believe are true, but don't actually know for sure; you definitely should check them if you consider using this method):

In a first step, determine a point that minimizes the average square distance to all planes. It seems obvious to me that a good average line should pass through that point. If there's more than one such point, since parallel planes are explicitly excluded, they should already form a line, in which case you're finished.

Otherwise, determine the direction of the line as the vector which minimizes the square scalar products with all normals to the plane (that is, which is as orthogonal as possible to all plane normals).

  • $\begingroup$ 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? $\endgroup$ Jun 26, 2017 at 8:57
  • $\begingroup$ The first method cannot find the same line if the optimal line from my approach happens to be parallel to those pre-chosen extra planes. The second approach (the fixed-size interval) sounds like it should give the same result, but I'll have to think about it (but that will have to wait; I took too much time on SE already and should actually be working right now :-)) $\endgroup$
    – celtschk
    Jun 26, 2017 at 9:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .