View Full Version : How to rotate a gluCylinder 3D
11-09-2005, 01:32 PM
I try to generate a 3Dpoly made of short gluCylinders, in one
dimension it works:
But with 2 or 3 dimesion I get unexpected results.
So, please tell me: What do I have to learn ?
11-09-2005, 07:42 PM
Please describe what expected result is.
What I see in your code is;
1. Translate the cylinder to (x,y,z) first
2. then Rotate it alpha degree about Y-axis
Do you want to ratate first then translate?
If then, swap the order of your transforms.
11-10-2005, 09:59 AM
thank you for your help. I feel encouraged to describe my problem in detail.
I want to have a method that draws a steric polyline. I did it former with POVRAY, it's easier,
there you define a cylinder with a base point and a top point.
My my method is declared as following :
- void drawPolylineWithVertices; NSArray* arr
The related part of the definition is :
for//i=0;i< arr count-1;i++//
get arr objectAtindex:i
extract point array to x, y and z
calculate arcs alphaXY, alphaXZ with point i and i+1
Rotation of the cylinder at the origin
around Y-axis with alphaXZ
around Z-axis with alphaXY
then translate from the origin to x,y,z
I use for test three sinus functions at the three axes, you can recognize function , translate is O.K. , but the cylinders do not
point from i to i+1.
Can you see what's wrong ?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.