Solved

3D Coordinate Translation

Posted on 2009-04-10
3
1,138 Views
Last Modified: 2013-12-21
I am currently trying to translate the position and rotation of objects in two different coordinate systems.

I've tried to use Matrix transforms but it's not getting me the results I need, which leads me to believe I'm lost.

Both follow Right Hand Rule rotation.  

The first is 3D Studio Max:
Z axis - UP
X axis - RIGHT
Y axis - Into the screen

The next is:
Z axis - out of the screen
X axis - RIGHT
Y axis - DOWN

I've can easily translate the positions (z = -y, x = x, y = -z) but translating the rotation is causing me no end of grief.  Both systems can use euler angles (assume XYZ order of rotation), the second system has no concept of a world, so the world and the camera are fixed.
0
Comment
Question by:vaughanknight
  • 2
3 Comments
 
LVL 4

Accepted Solution

by:
Xcone earned 500 total points
ID: 24121503
To transform vertices from 1 space to the other you really need matrices, especially when rotation is involved. I do have to say, my experience with them is very limited, so I can't help you directly. But please check out this webpage:

http://www.euclideanspace.com/

It contains ton's of information about using matrices, vectors, and rotations. Including formulas and code samples. It has helped me a lot.
0
 

Author Comment

by:vaughanknight
ID: 24124188
Thanks.  I'd been looking at that site, but started to deep.  Having a read from the top level I'd recommend to anyone wanting to find information on it.

What I have discovered is that the coordinate system of Z - towards, X right, Y down is 180 rotation on the X axis of Direct 3D coordinates, which should help.  There is plenty of information on how to get objects into that coordinate system, and then it's a normal rotation on the X axis to get the final result.

http://www.euclideanspace.com/maths/standards/index.htm

I'll post my success later if I find it.
0
 

Author Comment

by:vaughanknight
ID: 24136961
Solution!

I figured out what was wrong.

I had been doing a matrix transform using

1  0  0
0  0 -1
0 -1  0

As Y (row2) goes to -Z, and Z (row 3) goes to -Y.

This was 100% correct.  But I'd take the Eulerangles to apply and no luck!

But 3DSMax gives eulerangles as XYZ, and it applies them as XYZ, but it's more important to speak about it in terms of what XYZ represent in general terms, not axes.

XYZ in Max is Pitch, Roll, Heading, where as the target system applies Pitch, Heading, Roll, so it's critical to get the coordinates back as the same as the target system after the matrix transform.

So after the transform I use
CODE: quatToEuler MY_MATRIX order:2
... where 2 represents XZY

My object was 180 flipped on the X axis to, so I rotate it 180 on X before doing the quatToEuler... not sure why that happens but it works!

Credits go to Xcone, making me read the entire site helped me come up with the solution.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Iteration: Iteration is repetition of a process. A student who goes to school repeats the process of going to school everyday until graduation. We go to grocery store at least once or twice a month to buy products. We repeat this process every mont…
This video discusses moving either the default database or any database to a new volume.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now