Advertisement

Changing from one coordinate system to another

Started by March 27, 2019 09:19 PM
2 comments, last by JohnnyCode 5 years, 10 months ago

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?

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

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

This topic is closed to new replies.

Advertisement