Hi,

this is the right way to go.

What you need are two unit-vectors perpendicular to the line segment and to each other.

If the line-segment-vector is (a1,a2,a3), then you can usually use (0,a3,-a2) as the first one, and (a1,a2,a3)x(0,a3,-a2) as the second one (there are rare cases when this doesnīt work, figure ot yourself, please).

Now normalize those vectors and name them e1 and e2.

Now you cet a circle around P1 as c(t) = P1 + r*cos(t)*e1 + r*sin(t)*e2, t running from 0 to 2pi.

Thus your parametrization of the whole cylinder is

cyl(t,u) = P1 + u*(P2-P1) + + r*cos(t)*e1 + r*sin(t)*e2, t running from 0 to 2pi, u running from 0 to 1.

I can make an Archimedes Geo3D construction to illustrate this, if you donīt get me.

Regards,

Andreas