# Thread: Cylinder in 3d space

1. ## Cylinder in 3d space

Given 2 points P1= (x1, y1, z1) and P2= (x2, y2, z2), how can we describe a cylinder around the line formed?

I was thinking of finding a parallel line segment and rotating it at distance r around the line segment defined by P1 and P2, but i'm not sure how to define these.

I don't want to find just the surface area, per se, but the actual points that the cylinder would go through.

thanks. if that's not clear enough, please let me know.

2. 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