Learn how to a build a cloud-first strategyRegister Now

x
Solved

# 3D Coordinate Translation

Posted on 2009-04-10
Medium Priority
1,154 Views
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
Question by:vaughanknight
• 2

LVL 4

Accepted Solution

Xcone earned 1500 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

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

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

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The greatest common divisor (gcd) of two positive integers is their largest common divisor. Let's consider two numbers 12 and 20. The divisors of 12 are 1, 2, 3, 4, 6, 12 The divisors of 20 are 1, 2, 4, 5, 10 20 The highest number among the c…
When there is a disconnect between the intentions of their creator and the recipient, when algorithms go awry, they can have disastrous consequences.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
###### Suggested Courses
Course of the Month21 days, 6 hours left to enroll