PDA

View Full Version : Create 3d pipe



qmadd
11-16-2005, 12:15 AM
I need to create a 3d pipe in open gl with visual c++ 6.
A pipe is defined with a collection of 3D points and the diameter of the pipe. At each vertex (except first and last) a radius of curvature is associated to describe the curvature of the pipe at the vertex. The program should generate the complete pipe, straight and curve areas and display in an OpenGL view.
can anyone help me and tell me how can i do that? please

qmadd
11-16-2005, 10:14 AM
actually i think it reffers to something like the 3d pipes screensaver. i don't know exactly, i have to do this for school, but i didn't understand exactly what it means. but i think that's it, the screensaver.
i have to read form an input file something like that:
Diameter (x y z radius) (x y z radius) (x y z radius) etc.
so there's only one diameter. and in each other vertex, except first and last where the radius is 0, there is a radius. it can't be something like an angle, because we allready know the next point of the pipe. so what the hell is that radius meaning?
i'm thinking i can create those pipes with the GluCylinder, and the curves with a torus. i don't have another idea. anyone has? Thank you very much.

11-16-2005, 08:22 PM
yeah my idea is to get you a maths book and make you read it :) but perhaps you will ask here so someone would read it for you as well - if its for school why are you asking others to do your homework?? i wish i had opengl homework sadly enough i only had history and such as homework during college

qmadd
11-18-2005, 02:02 PM
i have solved the problem. now all i need is a small problem: how do i draw only a sector of a torus? pls for this i really don't have solution. i know how to draw a torus, but only a sector not. can anyone help me?

11-18-2005, 04:03 PM
I suggest you to get some source to generate and render a torus this will let you calculate the torus as you want it by full PI or half PI or quarter PI etc! so you can have 1/4 of a torus and so on with out having to "cut" with stencil planes or anything like that because (not that i know how to do it or if thats well said) but it would be slower than just generating a quarter of a torus

however if you are generating pipes like at the opengl screensaver i believe they are totally dynamically generated and at once not by parts

growing by length segmen or amount of course

so you should learn how to make a cylinder dynamically and how to perform rotations on the "creation plane" so you can much likely create the pipes as you move and rotate that "emmiter"

it would be the best way and fastest IMO
will also be nicer as you wont have to calculate the normals for the faces that are from separate objects so they look smooth

if not you should go use bezier patches i think