View Full Version : Transformation matrix problem!

07-30-2008, 05:18 AM
hi... i need help about transformation, i mean rotation object.
i want to rotate object without glRotatef, so i multiple the points and matrix
rotate x
1 0 0 | | x | | x
0 cos -sin |X | y |=| cos * y + (-sin)*z
0 sin cos | | z | | sin * y + cos * z

my line program
double RadTheta=theta*3.14159265358979323846/180.0;

double CosRadTheta=cos(RadTheta);
double SinRadTheta=sin(RadTheta);

for (unsigned int i=1;i<=o->nPoints;i++){


the problem is, the result is not corect. my object not rotate corectly. please help me... what i must do?
i have change degree to radian (angle*3,14.../180).

07-30-2008, 05:24 AM
You fall prey for a very basic algorithmic mistake mathematicians usually make: you change the y coordinate but then use it again to compute the z coordinate, where you should have used the old value. You should use a temporary variable that will store the old y value, like

old_y = y
// compute new y
// compute new z, with old_y

07-30-2008, 05:53 AM
oh... i see...
my point y is change!
wow thank you!