Solve Rotation Matrices w/ X, Y, Z Axes

Click For Summary

Discussion Overview

The discussion revolves around the mathematical problem of rotating objects using rotation matrices around the X, Y, and Z axes in a specific order, and finding a way to match this with a different order of rotations. Participants explore various methods, including Euler angles and quaternions, to address the complexities involved in these rotations.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant describes a practical problem encountered while working on a computer game, seeking a more efficient method to solve rotation matrices than brute force multiplication.
  • Another participant suggests a paper that may provide insights into the problem, cautioning about the complexities of rotation sequences and the issues with Euler angles.
  • Some participants express skepticism about the use of Euler angles, labeling them as problematic due to singularities and other challenges.
  • Quaternions are proposed as an alternative method for handling rotations, with one participant highlighting their advantages, such as smoother interpolation and avoidance of gimbal lock.
  • A participant shares a resource for learning about quaternions and their applications, emphasizing the importance of understanding the conventions used in quaternion representation.
  • Another participant provides a link to a website with diagrams that may assist in visualizing rotation matrices, although they express uncertainty about the accuracy of all matrices presented.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the best method for solving the rotation problem, with multiple competing views on the use of Euler angles versus quaternions remaining evident throughout the discussion.

Contextual Notes

Participants note various complexities associated with both Euler angles and quaternions, including issues of singularities, conventions in quaternion representation, and the distinction between rotation and transformation matrices. These factors contribute to the unresolved nature of the discussion.

Zal
Messages
2
Reaction score
0
So, I've been fiddling around with a computer game (not the most productive use of my time, I know) and I've come across a problem that seems to have broader mathematical import, and most certainly has been found before, so I thought I'd ask about it here.

Basically I need to rotate an object (well group of objects) using rotation around the X, Y, and Z axes, in that order) to match a rotation around the Z, X, and Y axes, also in that order. Now doing the brute force method of multiplying the matrices through and solving the resulting system of equations will work, but lacking access to mathematica or the like, it's going to kill a lot of trees. And considering my propensity for simple errors, cause a lot of frustration as well. But I'm guessing there's some sort of neat trick or higher level math way of looking at this that will make things a lot quicker and be a lot more insightful. Any ideas?

Put more mathematically, I need to find \Theta_{1},\Theta_{2},\Theta_{3} such that X(\Theta_{1})Y(\Theta_{2})Z(\Theta_{3}) equals Z(\Phi_{1})X(\Phi_{2})Y(\Phi_{3}) where \Phi_{i} are constants.

X, Y, Z are 3x3 rotation matrices around the given axis, i.e. the Z matrix would be:
<br /> \[ \left( \begin{array}{ccc}<br /> cos(\Theta) &amp; -sin(\Theta) &amp; 0 \\<br /> sin(\Theta) &amp; cos(\Theta) &amp; 0 \\<br /> 0 &amp; 0 &amp; 1 \end{array} \right)\] <br />
 
Physics news on Phys.org
This paper, http://www.atacolorado.com/eulersequences.doc looks like it has what you want.

Beware: There a lot of places to get mixed up here:
  • Rotation is the transpose of transformation. One consequence: Rotation sequences chain left to right, transformation matrices chain right to left.
  • Euler angles have singularities. The singularities are one reason why your desired simple trick is a bit of a challenge.
  • Why are you using Euler angles, anyhow? They're evil.
 
D H said:
[*]Why are you using Euler angles, anyhow? They're evil.[/list]
Someone here finds them difficult?
[:-)]
 
Last edited:
Try using quaternions:
http://www.cprogramming.com/tutorial/3d/quaternions.html"
They let you interpolate more smoothly between rotations and save you from the notorious gimbal lock.
 
Last edited by a moderator:
Well I was using Euler matrices because I didn't know any better tool to use. But the link on quaternions you posted, Daniel, sure looks handy. Thank you. Between that and the Euler Secuences doc DH posted I should manage to figure out the proximate problem shortly. I'm wondering though if anyone knows of a good source for reading up on the theory behind them; I'm as interested in the mathematics as the implementation.
 
This book is fairly good: Quaternions and Rotation Sequences: A Primer with Applications to Orbits, Aerospace, and Virtual Reality, Jack B. Kuipers.
http://books.google.com/books?hl=en...ts=yVnCatNtiT&sig=rIrbN6mfsClRAiHkma1BBGLosWs

There are a number of gotchas with quaternions as well: scalar first or last, rotation versus transformation, left versus right.

Scalar first or last: One way to look at quaternions is as a real scalar and an imaginary vector (think of them as an extension of complex numbers). Alternatively, you could represent them as an imaginary vector and a real scalar. I use the scalar+vector form:

{\mathcal Q} = \bmatrix s \\ {\boldsymbol v} \endbmatrix

Others use the vector+scalar form:

{\mathcal Q} = \bmatrix {\boldsymbol v} \\ s \endbmatrix

There's no reason to pick one convention over the other, and both are in use. It is important (*very important*) to determine which convention is in use when you are exchanging quaternions with some other organization.Rotation versus transformation: Imagine making two 2D coordinate system grids on two pieces of clear plastic. Mark a spot on a white sheet of paper. Put the plastic overlays on top of the paper so the origins are co-located and axes co-aligned and so that the marked spot is not at the common origin. Now rotate the top overlay. Imagine that instead of using two overlays you had used just one. A rotation matrix describes this physical rotation of an object to another orientation. With two sheets, you can read off the coordinates of the marked point in each of the two coordinate systems. A transformation matrix describes the mathematical transformation of a representation from one coordinate system to another. The rotation and transformation matrices in this example are transposes of one another. This concept extends to higher dimensions. Rotation and transformation quaternions are similarly conjugates of one another.Left versus right quaternions: A quaternion can be used to transform a 3-vector via

<br /> \bmatrix 0 \\ {\boldsymbol x&#039;} \endbmatrix =<br /> {\mathcal Q} \bmatrix 0 \\ {\boldsymbol x} \endbmatrix {\mathcal Q}^{\ast}<br />

or via

<br /> \bmatrix 0 \\ {\boldsymbol x&#039;} \endbmatrix =<br /> {\mathcal Q}^{\ast} \bmatrix 0 \\ {\boldsymbol x} \endbmatrix {\mathcal Q}<br />

The unconjugated quaternion is to the left of the vector to be transformed in the first form but to the right of the vector in the second form: left versus right. Left transformation quaternions chain like transformation matrices (right to left). Right transformation quaternions chain left to right. I've been involved in incredibly stupid arguments over which approach is correct. The math comes out fine either way; both are equally valid. The distinction becomes important if you are exchanging quaternions with some other group.
 
There are some diagrams at the following site:

http://www.akiti.ca/RotateTrans.html"

The Z-matrix looks like your result.
Not sure about the others; you might have to alter them somewhat, but at least there are some nice diagrams to give you an idea how things are worked out. Plus the page outputs some numbers, so you could confirm your own results.

If you get more seriously into game development, you might also want to check out gamedev.net.
 
Last edited by a moderator:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 16 ·
Replies
16
Views
24K
  • · Replies 26 ·
Replies
26
Views
1K
  • · Replies 3 ·
Replies
3
Views
10K
  • · Replies 2 ·
Replies
2
Views
2K