PDA

View Full Version : Bending Cylinders



Thug
03-22-2001, 10:24 AM
I am trying to create a cylinder that is 1 unit in length and from one end to the other it bends. For example the Open GL pipes screen saver that comes with windows. Each of the elbows look like a cylinder but the center of the cylinder curves to form a rounded transition from going one direction to the next.

Thanks for any help you can give me.

coredump
03-22-2001, 10:42 AM
a quick and dirty solution would involve a funtion f(x) representing the "core" of the cylinder. then , traverse the line(function) and draw concentric circles around it, spacing them out by some delta-x. the smaller your delta-x, the smoother the cylinder will be.

b

Thug
03-23-2001, 09:19 AM
Coredump

Thanks for the quick and dirty algortim, but for what I want it to do may be too slow at run time. I am looking into making a Open GL Roller Coster Screen Saver but with the hills and curves in the track it will need to have prolly too many of these spheres to make it look like the track is solid and not made up of spheres.

I may be looking into defining a partial Torus to implement these curves.

In theory it should work.