View Full Version : Curved Tubes/Cylinders
04-02-2002, 03:02 PM
Has anyone tried to draw curved tubes/cylinders by using gluCylinder with parts of torus? I want to basically connect various cylinders with an arc of radius r and angle w. I looked at GLE but I don't think it will do it. Or is there an easier way?
04-03-2002, 03:04 AM
if you want curves of any kind try this link:
This site is more than great and absolutely clearly explaining all techniques.
I'm also interested in this. I agree that Paul Bourke's website is great, however, I need to render pipes that connect at various angles "seamlessly". Rendering a simple sphere at the joint won't work for my application since the intersection needs to be "hollow" like the rest of the pipe.
[This message has been edited by Pat (edited 04-03-2002).]
04-03-2002, 08:18 AM
This is how I draw pipes. Its not the easiest but it is the best and most flexible. Check out www.reactorsoftware.com (http://www.reactorsoftware.com) and look at Ultra Coaster. Its a project I worked on a little while back. Its a 3d coaster simulator (with a track editor) that uses bezier splines. The spline defines the shape of the track and then I simply draw a crosssection of the track at points along the spline and then strip between each crossection to make a closed tube. The beauty of this is that Level of Detail is a piece of cake since both the spline and the crosssection are dynamically generated. Track that is far away actually starts getting drawn as lines (I never could tell). Low memory overhead and endless possibilities. The coaster of course must have an "up" orientation as it moves along the track but that is simply and angle that is linear interpolated between both ends of the spline segment. You also don't have to use splines. Lines and circular curves will work just the same.
Its a wonderful technique that really isn't too hard to implement. I can't give you any code from UltraCoaster but I do believe I have some sample code from early technology testing (I think it is directX though). But it should be equally useful since all the math is being done on the cpu and it has nothing to do with DirectX.
The code is on my machine at home (and I am at work) so let me know if you want to take a look and I will post it when I get home.
P.S. As for the use of DirectX for UltraCoaster, I pushed for opengl but I was only a contractor on the project and arrived late in development at which point nobody wanted to change the entire engine. I'm not proud of the use of DirectX.
04-03-2002, 09:40 AM
Take a look at GLE library (part of glut), it comes with source code which should help in what you are doing.
04-03-2002, 12:01 PM
I can't really see the problem with seamless pipes and Bezier or Spline curves. What I would do is to determin the gradient of the kurve, then you have the the angle and can "extrude" your circle along the curve. That is more or less what Bourke is doing in his knot examples. Hope I don't mess up things, it's sometime ago since I was working with this kind of stuff.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.