Register to reply 
Rotation,angle of vector from axes ? 
Share this thread: 
#1
Jan2613, 06:12 PM

P: 101

How to find that? In R3.
I want to rotate everything around a vector, at an angle A. (making a n openGL game at my free time) I tried , for normalized vector V = <x,y,z>: Displace V to start of axes. angleToYZ = acos(y); Rotate all around Z with that angle. (1) angleToZ = acos(z); Rotate all around X with that angle. (2) Now V is on the Z axis. Rotate all around Z with angle A. perform (2) , (1) with opposite respective angles. Problem is, when i implement that for rotation around another vector, individually the rotations work, but when i.e. i do a rotation around V1, then the rotation around V2 gets messed up. Is there a mathematical error in the above? 


#2
Jan2813, 10:51 AM

Sci Advisor
P: 3,313




#3
Jan2813, 11:37 AM

Mentor
P: 15,201

You appear to be confusing an Euler rotation sequence with a single axis rotation (or eigenrotation, or angle/axis representation). The latter are very closely aligned with quaternions. openGL provides various quaternionic representations of a rotation. The easiest thing is to convert that single that single axis rotation to a quaternion and let openGL do the work. This wikipedia page provides a good start if you want to understand the math: http://en.wikipedia.org/wiki/Axisangle_representation. 


#4
Jan2813, 03:10 PM

P: 101

Rotation,angle of vector from axes ?



#5
Jan3013, 12:04 AM

Sci Advisor
P: 3,313




#6
Jan3013, 02:14 AM

P: 101




#7
Jan3013, 11:14 AM

Sci Advisor
P: 3,313




#8
Jan3013, 12:00 PM

P: 101




#9
Jan3013, 12:30 PM

Sci Advisor
P: 3,313

It isn't clear what algorithm you are using to perform a rotation. Let's assume you are multiplying a column vector v on the left by a matrix M to produce the new column vector u. So u = Mv. You're idea is to use a matrix T (which is the product of two other matrices) to transform 3 axes of object back to the xyz axes, use a matrix R (whichis is the product of two othe matrices) to perform rotations about the xyz axes and use the matrix Tinverse to transform the the xyz axes back to the original axes of the object. I think this idea works if properly implemented, but I can't tell from what you wrote exactly how you implemented it.



#10
Jan3013, 03:34 PM

P: 101

I use the matrices from here
http://en.wikipedia.org/wiki/Rotatio...asic_rotations to perform the rotations of each vector. Instead of using a "combined" matrix i do the rotations one after another,which us equivalent. Instead of using the inverse, i just use the negative angles, which is also equivalent for these rotation matrices (negative angle = inverse) Problem is,as i said : individually doing left/.right or up/down rotations works fine. But when doing a leftright and then updown (and vice versa) , the 2nd rotation gets messed up. The cross product of the 2 rotating vectors doesn't equal the third (the reference for the rotation) after the above. 


#11
Jan3013, 05:54 PM

Sci Advisor
P: 3,313

That's not a sufficiently specific description of your method for anyone to check. You need to explicity write out the product of matrices that you used.



#12
Jan3013, 06:41 PM

Mentor
P: 15,201

Rotations in 3D space are a bit counterintuitive. They do not obey nice laws. Unlike rotations in 2D space, they are neither commutative nor additive. Rotation A followed by rotation B is not the same as rotation B followed by rotation A. Example: Rotate by 90 degrees about the x axis, then by 90 degrees about the y' axis (the orientation of the y axis after being rotated by 90 degrees). This is quite different from rotating by 90 degrees about the y axis and then rotating by 90 degrees about the x' axis. The former is equivalent to a single 120 degree rotation about an axis pointing along [itex]\hat x + \hat y + \hat z[/itex], while the latter is equivalent to a single 120 degree rotation about an axis pointing along [itex]\hat x + \hat y  \hat z[/itex]. 


Register to reply 
Related Discussions  
Vector which has same angle with x,y,z axes  Calculus & Beyond Homework  4  
3D Rotation of a rigid body in Fixed Axes (Not Axes Rotation)  Classical Physics  16  
Find rotation to align two vectors by rotation about two arbitrary axes  Linear & Abstract Algebra  7  
Angle rotation about 2 axes  Differential Geometry  1  
Rotation of axes  Precalculus Mathematics Homework  1 