# Up orientation calculation

This topic is 4945 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

I have recently implemented something from a paper where statistical models are learned from motion data. Part of the information used for learning is information with respect to up direction which essentially taken as the third row of a rotation matrix (the z value for each axis). What I'd like to know is that given that the values for this row is know, how can I generate a orientation matrix/quaternion that satisfies this constraint, obviously there are infinite number of possible orientations available but I don't really care which specific one I end up with. The paper don't really elaborate on the matter and makes no references to any other paper. thanks for any help.

##### Share on other sites
I can't address the statistics aspect, but if you're talking about building an orthogonal matrix from a single vector, that's pretty easy. If that's what you need I can give you the algorithm or post some code (if no one else does first).

[Edit: never mind.]

##### Share on other sites
Dot the desired up vector with the world up vector. If it's 1.0, use the identity matrix, otherwise, cross the two vectors to create a perp vector and normalize. Cross this new vector with the desired up vector. These three vectors can now be used to create a rotation matrix.

EDIT: If you already have this matrix R (from your later post, below), the above steps are redundant.

[Edited by - John Schultz on May 27, 2005 2:12:59 PM]

##### Share on other sites
I am not sure that is what I am after, here is the description from the paper, what I want to do is sort of reverse the process.

"Vertical orientation: We include a feature that measures the global orientation of the character with respect to the up direction, (along the Z-axis) defined as follows. Let R be a rotation matrix that maps a vector in the character s local coordinate frame to the world coordinate frame. We take the three canonical basis vectors in the local coordinate frame, rotate them by this matrix, and take their Z-components, to get an estimate to the degree that the character is leaning forward and to the side. This reduces to simply taking the third row of R."

thanks

##### Share on other sites
So you want an orthonormal basis derived from the z components only? Since the transpose of an orthogonal matrix is itself orthogonal, it seems that you could simply use John's method and apply it to the rows of your matrix rather than the columns...

##### Share on other sites
Quote:
 Original post by shaobohouI am not sure that is what I am after, here is the description from the paper, what I want to do is sort of reverse the process."Vertical orientation: We include a feature that measures the global orientation of the character with respect to the up direction, (along the Z-axis) defined as follows. Let R be a rotation matrix that maps a vector in the character s local coordinate frame to the world coordinate frame. We take the three canonical basis vectors in the local coordinate frame, rotate them by this matrix, and take their Z-components, to get an estimate to the degree that the character is leaning forward and to the side. This reduces to simply taking the third row of R."thanks

The "canonical basis vectors in the local coordinate frame" is equivalent to the identity matrix, thus it's clear that you only need to look at R, and extract the geometric basis vector for UP (in this case, a column oriented matrix where Z is up).

Thus, just extract the Z row of R, and move on to the next step of the algorithm.
To determine lean angle, dot world UP with the extracted UP vector. Since the world UP will contain one non-zero value, you can look at just one component, the Z value from the Z row.

Perhaps post a link to the paper.

##### Share on other sites
http://grail.cs.washington.edu/projects/styleik/styleik.pdf

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
14
5. 5
frob
12

• 9
• 11
• 11
• 23
• 12
• ### Forum Statistics

• Total Topics
633662
• Total Posts
3013228
×