ans =

You cannot find ALL the points between any pair, in any number of dimensions. At best, you can describe the set of all such points, typcially as a line.

Two points define a line, in any number of dimensions. Actually, a line segment. If you extend that segment out, then it becomes a line. NO, two points cannot define a plane. There would be infinitely many planes that pass through two points.

The simplest way to define the line segment is in a parametric form. This allows the points to be vertically related, and still create a line. Thus, I would do this:

% pick two random points

xyz1 = randn(1,3)

xyz2 = randn(1,3)

Now we can define the line segment as a linear combination of those two points. What I would call a convex combination.

lineseg = @(t) xyz1.*(1-t) + xyz2.*t;

lineseg is a function handle, that for any value of the parameter t, returns a point along the line connecting the points. If t lies in the interval [0,1], then the point returned will be between the two. When t==1.2, the point will be exactly in the middle. And when t==0 or t==1, you get the corresponding point. For example...

lineseg(0)

lineseg(1)

lineseg(0.5)

When t is outside of the interval [0,1], you get an extrapolated pooint along that line.

lineseg(2) % extrapolating

And, if t is a (column vector) then you will get a set of points long that line.

xyz = lineseg(linspace(-1,2,100)')

plot3(xyz(:,1),xyz(:,2),xyz(:,3),'-r')

hold on

plot3([xyz1(1),xyz2(1)],[xyz1(2),xyz2(2)],[xyz1(3),xyz2(3)],'go')

box on

grid on

As you should see, nothing special as needed. No line fit. And again, hoping to fit a surface or a plane to two points is a meaningless endeaver, since there are infinitely many planes you could form.