connecting points using gluCylinder function
how to connect two points with cylinder ? drawing cylinders is very easy while using OpenGl and its quadrics. one simply call funciton gluCylinder with proper parameters. as one can read in OpenGl manual reference, this function draws cylinder along Z axis. The bottom of cylinder is placed in (X,Y,0) plane and the top of cylinder is in plane (X,Y,height). Where height is height of cylinder and is given as one of parameters. if we have two points p1=(x1,y1,z1) and p2=(x2,y2,z2) and we want to connect them with cylinder, we would like to use gluCylinder function. to do this we have to transform our coordinate system, so its Z axis coincide with direction given be vector n=p2-p1.
to do this we have to
0. remember current coordinate system
1. translate cooridinate system do point p1
2. rotate aroud Y axis, so the Z axis coincide with projection of vector n on the XY plane (we get new coorindate system X'YZ')
3. rotate around X' axis, so the Z' axis conicide with vector n direction
4. use gluCylinder function to draw cylinder with height equal |p2-p1|
5. restore saved coordinate system
its easy to show that points 1-3 can be realized using single matrix, given below
where n=p2-p1. when one calculates given matrix, we can set it as a current transformation matrix using function glLoadMatrix*.
SRTM
: Heart surface :
Lets take equation
fractal image #2 - hiperspeed mandelbrot

previous (newer) , 1 , ... , 5 , 6 , 7 , 8 , 9 , next (older)