# Before / After for transformation matrices

## Recommended Posts

I always get a little turned around choosing the before or after version of a transformation on a VWTransformationMatrix, e.g. RotateXBefore vs RotateXAfter. I had thought maybe Before applies to pre-multiplication and After applies the post-multiplication, but the opposite seems to be true:

Before applies to the object axes and After applies to the global axes.

Does anyone know what the before and after terms actually apply to?

It means apply rotation before applying the offset.

Rotations use always the 0,0,0 as anchor. Whne you want to rotate some object about his own axis you would have to move it first with the axis on 0,0,0

then rotate and move it back where it was. This step is saved by the RotateBefore function.

regards,

Patrick

Edited by PatW

Posted (edited)

Transformations (mathematically matrices) are not commutative. That is the reason of "before" and "after".

Otherwise said: making transformation A, then transformation B is not the same as making transformation B first and then A.

Edited by Nicolas Goutte

On 3/1/2021 at 3:43 AM, Nicolas Goutte said:

Transformations (mathematically matrices) are not commutative. That is the reason of "before" and "after".

Thats what I thought initially, but VW applies the transformation to the matrix immediately, so it’s the order of the calls that matters, not the before/after designation.

The designations seem to determine pre- or post- multiplication, but as far as I can tell, “After” pre multiplies and “Before” post multiplies.
http://web.cse.ohio-state.edu/~wang.3602/courses/cse5542-2013-spring/6-Transformation_II.pdf

Posted (edited)
17 hours ago, JBenghiat said:

Thats what I thought initially, but VW applies the transformation to the matrix immediately, so it’s the order of the calls that matters, not the before/after designation.

That has not to have with immediately. It just to have if one transformation has to be done before or after another. As I have written above that is not the same.

Quote

The designations seem to determine pre- or post- multiplication, but as far as I can tell, “After” pre multiplies and “Before” post multiplies.
http://web.cse.ohio-state.edu/~wang.3602/courses/cse5542-2013-spring/6-Transformation_II.pdf

Yes sure, for "after"you have to be on the left side, for "before" on the right side of the multiply. (The vector you transform is always the far right side the matrix formula.)

Edited by Nicolas Goutte

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×