# Thread: order of transform

1. ## order of transform

HY.
how i must concatenate the xml component translation of the collada visual scene file?
1)Rotate
2)scale
3)translate

or in the order that are in the file ?

i read this in the collada spec:
These transformations can be combined in any number and ordering
to produce the desired coordinate system for the parent <node> element.
The COLLADA specifi cation requires that the transformation elements are
processed in order and accumulate their result as if they were converted to
column-order matrices and concatenated using matrix post-multiplication.
then the transform must be in order of the file , but if i have a parent node how concatenate the transform?
node1--node2--node3
how i concatenate?
THans
then
Thanks.

2. ## Re: order of transform

Let's say this is your tree.
Code :
```   <node1>
<T1A>
<T1B>
<T1C>
<node2>
<T2A>
<T2B>
<T2C>
<node3>
<T3A>
<T3B>
<T3C>
</node3>
</node2>
</node1>```
M = (T3C x (T3B x (T3A x (T2C x (T2B x (T2A x (T1C x (T1B x (T1A x I)))))))))
I = Identity matrix
x = cross product.
M = compressed matrix
T3A = the first transform in node3

Matrix Multiplication is associative but not commutative. (AB)C = A(BC), but AB !=BA.
so order is important.
M = (T3C x T3B x T3A) x (T2C x T2B x T2A) x (T1C x T1B x T1A)

Herbert

3. ## Re: order of transform

Originally Posted by uclahklaw
t.
M = (T3C x T3B x T3A) x (T2C x T2B x T2A) x (T1C x T1B x T1A)
Uhm, this looks like pre-multiplication to me Herbert. Can you double check your post?

Thanks.

4. ## Re: order of transform

For post-multiplication:
M = (T1A x T1B x T1C) x (T2A x T2B x T2C) x (T3A x T3B x T3C)
wv = v x M
v = vertex in local space
wv = vertex in world space

For OpenGL:
glMultMatrix(T1A);
glMultMatrix(T1B);
glMultMatrix(T1C);
is equal to
glMultMatrix(T1A x T1B x T1C);

For <translate> to <matrix> conversion:
<translate>2 3 4</translate>
is equal to
<matrix>1 0 0 2 0 1 0 3 0 0 1 4 0 0 0 1</matrix>

For OpenGL:
GLfloat T1A[] = {2, 3, 4};
glTranslatefv(T1A);
is equal to
GLfloat T1A[] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1};
glMultMatrixf(T1A);

Mark, does this make sense?

Herbert

5. ## Re: order of transform

Originally Posted by uclahklaw
For post-multiplication:
wv = v x M
That looks like pre-multiply of a row-vector and a matrix to me.

6. ## Re: order of transform

I am pretty confuse now.
What is the best mathematical representation of the post-multiplication and concatenation order?

Thanks,
Herbert

7. ## Re: order of transform

I think all that's left to correct from your previous post is to say this instead:

wv = M x v

i.e. a matrix times a column-vector.

See what I mean?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•