# 3D Changing from one coordinate system to another

## Recommended Posts

I know that when we want to move from one coordinate system to another (e.g. from right to left) that we have to invert z-axis, or any other.
What about the rotations? It seems to me that this should not be a concern as once we have vertices in place an inversion of a basis vector is sufficient. I guess that clockwise or counter-clockwise should come into consideration only if we don't know the final position (after some transformation) of some vertices.

Is this correct or have I missed something?

##### Share on other sites

When you transform from one coord to another your base axes point in another direction, see this as that: initial y points up, after transform z points up and y points forward - you rotate around y axis which means you now rotate around old z axis...

If direction of axis is negated then i have no idea, seems rather complicated

void RotateY(T angle)
{
Matrix44<T> rot(cos(angle), 0, -sin(angle), 0,
0, 1,           0, 0,
sin(angle), 0,  cos(angle), 0,
0, 0,           0, 1);

(*this) = (*this) * rot;
}

Lets see at this code: we rotate around Y axis which points up in this case so only x and z values are modified,

You need to define axis positive direction, and you need to know which components it will modify, anyway i am wondering about not axisaligned axes this could be a little more challenging but we could compose two matrices for that...

##### Share on other sites
15 hours ago, ryt said:

It s﻿e﻿ems to me that this should not be a concern as once we have vertices in place an inversion of a basis vector is sufficient. I guess that clockwise or coun﻿ter-clockwise should come into consideration only if we don't know the final position (after some tr﻿ansformation) of some vertice﻿s

Fliping/negating a basis vector is not an affine transfromation, meaning it gets you to a space that rotation cannot get you into. In that space the clockwise normals are flipped, as it is actualy a negative 1.0 scale factor around one axis. It is a needed operation between affinely different spaces, as those can easily happen (mirrored ones).

## Create an account

Register a new account

• ### Game Developer Survey

We are looking for qualified game developers to participate in a 10-minute online survey. Qualified participants will be offered a \$15 incentive for your time and insights. Click here to start!

• 12
• 18
• 15
• 9
• 9