Jump to content
  • Advertisement
ryt

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 this post


Link to post
Share on other sites
Advertisement

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 this post


Link to post
Share on other sites
15 hours ago, ryt said:

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

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).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!