Which 3D Rotation Calculation is Correct?

In summary, the person is seeking clarification on two different methods for calculating Y axis rotation and whether they are both correct or not. The expert responds that both methods are correct, but they rotate in opposite directions. They also suggest using linear algebra and a rotation matrix to better understand this concept. The person also mentions their struggle with finding a simple implementation of a rotation matrix in C.
  • #1
IMK
63
0
Hello,
I and just getting to grips with basic 3D rotation and have come across two nice examples, however they are different when calculating the Y axis rotation and I was wondering why and which is correct ? Or are they both correct for some convention I have mist?
Many thank IMK

1:
Yout = Yin;
Xout = Xin * cos(Theta) - Zin * sin(Theta)
Zout = Zin * cos(Theta) + Xin * sin(Theta)

2:
Yout = Yin;
Xout = Zin * sin(Theta) + Xin * cos(Theta)
Zout = Zin * cos(Theta) - Xin * sin(Theta)
 
Mathematics news on Phys.org
  • #2
Both are correct, they just rotate about the y-axis in different directions (one clockwise, the other counterclockwise).

Do you know any linear algebra? It's much clearer to see these things when written out in matrix form - each rotation is described by a rotation matrix, and when you multiply the two rotation matrices together you get the identity matrix. What this tells you is that one rotation cancels out the other, so they must be rotations in opposite directions.
 
  • #3
IMK, could you show where you found those two examples?
 
  • #4
Mute, many many thanks for your reply as every little input helps me a great deal as my maths is both poor and rusty.

So good to know these are both correct and I guess I can use the one that fits my problem. Question does the same rule apply to the rotation about the X and Z axis that I can simply swap the cos sin +- around to control the direct? Or is there some lurking monster?

Are far as the linear algebra well I read and learn more every day but I must admit I am REALLY STUCK as far as rotation matrixes are concerned. As I have searched the web for days to find a simple (software (C if possible)) implementation of them. As all the code I can find has been written for computer graphics and does view rotation, camera and lighting etc and is much to complicated and hence confusing as all I want to do is to rotate some force vectors.

So if you happen to know of a simple C implement of a rotation matrix then I would be doing double backward summersaults.

Again many thanks for you input IMK
 
  • #5
D H said:
IMK, could you show where you found those two examples?

http://www.siggraph.org/education/materials/HyperGraph/modeling/mod_tran/3drota.htm
http://forums.sagamedev.com/topic.aspx?topicid=308

If you find a simple matrix implementation for rotation only, no graphics project etc etc.. Then please let me know..
Of out for dinner now but will be back about 2230 uk time..

Many tahnks IMK
 
Last edited by a moderator:
  • #6
IMK said:
I want to do is to rotate some force vectors.

and from another thread,

IMK said:
Basically I have a set of 3D Accelerometer force vectors that I am trying to rotate in order to align them with another set of calibration vectors from the same device.

Did you read https://www.physicsforums.com/showthread.php?p=1526764#post1526764"? You are guilty here of using rotate and transform as synonyms. There are not. They are conjugates. Those force vectors you want to "rotate" are real things. You do not want to rotate them; you want to transform them from one frame to another. The frames are rotated with respect to each other. Vector representations are transformed between frames. Rotation and transformation are conjugates, which is why you have conjugate representations of the pitch matrix in your OP in this thread.
 
Last edited by a moderator:

FAQ: Which 3D Rotation Calculation is Correct?

What is 3D rotation?

3D rotation refers to the process of rotating an object or image in three dimensions along one or more axes. This allows for the creation of a 3D representation of the object or image, providing a more realistic and dynamic view.

How is 3D rotation different from 2D rotation?

2D rotation only allows for rotation along a single plane, while 3D rotation allows for rotation along multiple axes in three dimensions. This allows for a more realistic and versatile representation of an object.

What are the different types of 3D rotation?

There are three main types of 3D rotation: yaw, pitch, and roll. Yaw refers to rotation around the y-axis, pitch refers to rotation around the x-axis, and roll refers to rotation around the z-axis.

How is 3D rotation used in various industries?

3D rotation is used in a variety of industries, such as animation, video games, virtual reality, and product design. It allows for realistic and dynamic representations of objects, which can be useful for visualizing and testing designs before production.

What are the challenges of implementing 3D rotation?

One of the main challenges of implementing 3D rotation is ensuring that the rotation is smooth and realistic. This requires complex mathematical calculations and precise coding. Additionally, the use of 3D rotation may also require high-performance hardware and software, which can be costly.

Similar threads

Replies
3
Views
2K
Replies
1
Views
889
Replies
31
Views
2K
Replies
29
Views
2K
Replies
24
Views
679
Back
Top