The short answer is, yes.  What line goes best through the middle of all points that comprise the entirety or just the surface of an airplane or javelin?  Draw it; in your head or on a picture.  You are looking for and at that solitary line from which every point (of interest, whether you plot them or not) that would contribute to total least (among points) deviation from that line.  If you do it by eye, implicitly by common sense, you will approximate (remarkably well) a mathematically calculated result.  For that there are formulae which bother the eye and may not make common sense.  In similar formalized problems in engineering and science, the scatters still invite a preliminary appraisal by eye, but in those arenas one is supposed to come up with a "test" probability that a line is the line.  It goes downhill from there.  However, you are apparently trying to teach a machine to size up (in effect) the metes and bounds of (a) a sizeable barnyard and (b) scattered livestock inside it.  If you give your machine what amounts to a picture (graphical, algebraic) of the real estate and occupants, it should be able to figure out (midline neatly dividing blob in two, calculated descatter into a line) what you want it to do.  Any decent statistics textbook (ask teachers or professors to name more than one) should spell out both the whole point of linear regression in the first place, and how to do it in the simplest cases (ranging to cases that are not simple).  A number of pretzels later, you'll have it down pat.