Line Through point seems to be not accurate

Continuing the discussion from Line through point: mathematical error?:

The LineThroughPt command does not appear to do what is claimed above. In the enclosed file the red line is what Rhino produces using that command on the points from the discussion that was closed.

The blue line is a line I created that does a significantly better job of minimizing the sum of the squared orthogonal distances between the points and the line. The green line that the OP asked about also produce a line that minimizes the sum of the squared orthogonal distances between the points and the line better.

LineThruPt.3dm (62.2 KB)

I show my calculations in the Notes of the file perhaps there is an error that someone can find…

I checked most of the distances, which look correct. However, I think there’s something wrong with your computation of the sum for the Rhino line obtained with LineThroughPt. These are the results I get:

# LineThroughPt
0.4956080*0.4956080 + 0.7491596*0.7491596 + 0.2535516*0.2535516 = 0.87115580979  # total sum of  squared orthogonal distances

# Linear regression with least-squares method
0.4215609*0.4215609 + 0.7662928*0.7662928 + 0.3450413*0.3450413 = 0.88397174644  # total sum of  squared orthogonal distances

# The blue line
0.4591205*0.4591205 + 0.7592038*0.7592038 + 0.2946186*0.2946186 = 0.87398216292  # total sum of  squared orthogonal distances

Yes you are correct. I copied and pasted that line into the calculator and apparently copied the wrong result that it spit out. I’m now getting the same number as you. After some further investigation, I am now satisfied that it is finding the line that minimizes the sums accurately.
I apologize for the trouble this caused.