PDA

View Full Version : how to generate 1000 3D points to form a sphere, cone, cylinder, pyramid, cube



07-08-2003, 09:09 PM
can anybody give me some source code on how to generate 1000 3D points to form/ produce a sphere, cone, cylinder, pyramid, cube using opengl.

gvm
07-08-2003, 11:09 PM
hm... maybe you should buy a book about OGL programming??? or 'bout math?

check this one: Francis S.Hill "Computer Graphics Using OpenGL SE" (good for beginners)

kehziah
07-08-2003, 11:21 PM
OpenGL is for *displaying* things, not generating them.

You give it the 1000 points, and it draws something. It won't generate the points for you.

roffe
07-08-2003, 11:28 PM
Don't have any source code, but for a detailed description look up math books about analytic geometry. These are from the top of my head:

sphere at point P:
(x-Px)^2 + (y-Py)^2 + (z-Pz)^2 = r^2

cylinder=extruded circle=>
(x-Px)^2 + (y-Py)^2 = r^2

cone=cylinder where r decreses by dr/dz

07-09-2003, 01:22 AM
Originally posted by roffe:
Don't have any source code, but for a detailed description look up math books about analytic geometry. These are from the top of my head:

sphere at point P:
(x-Px)^2 + (y-Py)^2 + (z-Pz)^2 = r^2

cylinder=extruded circle=>
(x-Px)^2 + (y-Py)^2 = r^2

cone=cylinder where r decreses by dr/dz



How about torus?