3d cylinder animation

I currently create a cylinder out of a line consisting of a number of points. At each point, I take the perpendicular vector and a vector created from joining the point before and the point after. I then rotate the perpendicular vector around the other vector to create the bases of the cylinders, with all the bases being joined up to create 3d cylinder frame.

This seems fine, but when it is moved through 3d space, and the points twist and turn, the cylinder becomes distorted.

Can anyone either give me some advice or point me in the right direction, please?

I am wondering how you calculate your perpendicular vector and keep it consistent after you transform your points… There are an infinity of perpendicar vectors lying in the plane perpendicular to the vector on your line of points. If you were to create two lines of points when you start one on the axis of the cylinder and one parallel to it representing the tips of the perpendicular vectors, then the points would transform ok and you could use them to get the vectors you need.

Steve