Rotation,angle of vector from axes ?

  • Context: Undergrad 
  • Thread starter Thread starter atrus_ovis
  • Start date Start date
  • Tags Tags
    Axes Vector
Click For Summary

Discussion Overview

The discussion centers on the challenges of implementing 3D rotations in a game development context, specifically regarding the rotation of objects around defined vectors in three-dimensional space. Participants explore mathematical approaches to achieve desired rotations while addressing issues related to the order of operations and the effects of multiple rotations.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant describes a method for rotating vectors around an axis using angles and transformations, but encounters issues when applying multiple rotations sequentially.
  • Another participant questions the clarity of the original question, seeking to understand whether the intent is to rotate about two different axes simultaneously.
  • Some participants suggest that the method described may confuse Euler rotations with single-axis rotations, proposing the use of quaternions for better handling of rotations in 3D space.
  • There is a discussion about whether the rotations should be performed about the original axes or the new axes after a rotation has occurred.
  • One participant notes that performing rotations sequentially does not yield the same results as using a combined rotation matrix, highlighting the non-commutative nature of 3D rotations.
  • Another participant emphasizes the need for a more specific description of the rotation method to facilitate troubleshooting.

Areas of Agreement / Disagreement

Participants express differing views on the effectiveness of the proposed rotation methods, with some agreeing on the challenges posed by the non-commutative nature of 3D rotations, while others remain uncertain about the specific implementation details and their implications.

Contextual Notes

Limitations include the potential confusion between different rotation representations (Euler angles vs. quaternions) and the need for clarity in defining the rotation algorithm used. The discussion also highlights the complexity of achieving desired rotational behavior in 3D space.

atrus_ovis
Messages
99
Reaction score
0
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?
 
Physics news on Phys.org
atrus_ovis said:
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.

Your question isn't clear. Are you trying to rotate an object simultaneously about two different axes, V1 and V2?
 
atrus_ovis said:
Is there a mathematical error in the above?

Yes. That's just not how rotations in R3 (three dimensional space) work.

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/Axis-angle_representation.
 
Your question isn't clear. Are you trying to rotate an object simultaneously about two different axes, V1 and V2?
I have two vectors, v1, v2 ( the "up" and "left" vector of an object) and i want to rotate with respect to them, to implement left/right rotation and up/down rotation.

Yes. That's just not how rotations in R3 (three dimensional space) work.
But since i am aligning the reference vector with an axis, rotating via that axis, and performing the inverse alignment operations, shouldn't the desired rotation be the result?

The easiest thing is to convert that single that single axis rotation to a quaternion and let openGL do the work.
I had tried an "intro to quaternions" via a linear algebra intro pdf, but failed.I'll try wikipedia.
 
atrus_ovis said:
I have two vectors, v1, v2 ( the "up" and "left" vector of an object) and i want to rotate with respect to them, to implement left/right rotation and up/down rotation.

If you rotate about the "up" axis, it moves the "left" axis to a new position. Is your intent to do the next rotation about the "new left" axis? Or are you trying to rotate about the original left axis?
 
Stephen Tashi said:
If you rotate about the "up" axis, it moves the "left" axis to a new position. Is your intent to do the next rotation about the "new left" axis? Or are you trying to rotate about the original left axis?

Yes, of course. The left axis changes when rotation around the up is performed, and vice versa.
 
atrus_ovis said:
Yes, of course..

Which alternative are you agreeing to?
 
Which alternative are you agreeing to?
To this:
Is your intent to do the next rotation about the "new left" axis?

Yes , like a regular 3rd person camera, viewing left/right and up/down.
 
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 T-inverse 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
I use the matrices from here

http://en.wikipedia.org/wiki/Rotation_matrix#Basic_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 left-right and then up-down (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
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
atrus_ovis said:
Instead of using a "combined" matrix i do the rotations one after another,which us equivalent.
Equivalent to what?

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 \hat x + \hat y + \hat z, while the latter is equivalent to a single 120 degree rotation about an axis pointing along \hat x + \hat y - \hat z.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
31
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K