11
$\begingroup$

Given four lines in $3D$ (represented as a couple of points), I want to find the point in space which minimizes the sum of distances between this point and every line.

I'm trying to find a way to formulate this as a problem of Least Square, but I'm not quite sure as to how I should. I'm currently trying to use the definition of distance provided at: http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html

Any ideas?

  • 0
    I'm trying to avoid using Calculus because I need to use this computation in an algorithm and I don't have access to any stable optimization libraries for C++.2011-05-02
  • 0
    @Dennis, is it clear that minimizing the sum of squared distances is the same as minimizing the sum of distances?2011-05-02
  • 4
    @Dennis: minimizing the sum of the squares is not the same as minimizing the sum of distances. Take three coplanar lines that meet in a point and another line in a plane $d$ away which passes above the intersection point. To minimize the sum of distances you choose the intersection point and find $d$. To minimize the sum of squares, take a point $a$ from the intersection to the other line. The sum of squares is minimized at $a=d/4$ and find $3d^2/4$ compared to $d^2$ for the intersection.2011-05-02
  • 0
    That's true, Sorry.2011-05-02
  • 0
    My instinct would be to set up the problem using the formula to which you link in full generality (lots of constants/variables), bash it over the head with something like Mathematica (using calculus), and see if a concise formula for what you want comes out the other side. I don't have Mathematica handy to try it at the moment, though.2011-05-04

2 Answers 2