# Clarity about conversion between different Cartesian coordinate systems

This problem bothers me and probably every other developer in the field of computer graphics ever since. Take any two graphics libraries/frameworks and you can be almost sure that they use a different coordinate system definition. The most famous examples are of course DirectX and OpenGL.

DirectX uses a left-handed system where

positive X = (1, 0, 0) points to the right
positive Y = (0, 1, 0) to the top and
positive Z = (0, 0, 1) to the back.

OpenGL uses a right-handed system where

positive X = (1, 0, 0) also points to the right
positive Y = (0, 1, 0) also to the top but
positive Z = (0, 0, 1) to the front.

To make things even worse, their interpretation of the 16 values of a 4x4 matrix is transposed to each other (row major <-> column major).

Another example would be OpenCV which has also a right-handed system but Y points downwards... its a mess!

Question 1:

How can it be solved in a general way, so that an object defined and transformed in system A appears in the same position/orientation in the other system B from the (independent) position of the viewer (e.g. person in front of the screen)?

I guess one would need the basis vectors of system A (where the object comes from) defined in system B (in which one wants to display it) and setup some linear equation system to solve in order to get a transformation matrix which is also defined in B and apply that to the coordinates of the object.

Question 2:

The same question goes for matrices, which matrix (defined in system B) transforms a transformation defined in system A into a transformation defined in system B so that it has visually the same 'effect'? hopefully its the same matrix as in question A with the exception that one has to transpose the matrix in case the two systems use other interpretations of the 16 values.

• In Question 1, what do you mean by an "object defined and transformed in A"? Is this a point (or set of points) expressed in system A's coordinates? Does this just mean $(a,b,c)$ expressed in $A$ coordinates becomes $(a,b,-c)$ in $B$ coordinates? – JohnD Dec 3 '14 at 2:45
• yes, by object i mean a set of 3d points. and in the example case it is true that (a, b, c) in A becomes (a, b, -c) in B. this appears trivial at first but leads to a lot of confusion when it comes to transformations. – thalm Dec 3 '14 at 11:23