• Create Account

#ActualL. Spiro

Posted 16 December 2012 - 02:59 AM

[source lang="jscript"][sx 0 0 0][0 sy 0 0][0 0 sz 0][0 0 0 1][/source]

Wrong.
Do this:

[sx sx  sx  0]
[sy  sy sy  0]
[sz  sz  sz 0]
[0  0  0  1]

Problem solved depending on how you combine it with the other matrices. If you are using matrix multiplication (very slow, to be avoided) then your scaling matrix is correct and your order of multiplication is wrong. Scale * Rotation * Translation, in that order.

But if you have each component separately it is better to just construct the final matrix directly by putting each part into the matrix where it belongs. In this case you have to multiply each rotation component as I have shown in my snippet. Much faster than matrix math.

L. Spiro

#1L. Spiro

Posted 16 December 2012 - 02:55 AM

[source lang="jscript"][sx 0 0 0][0 sy 0 0][0 0 sz 0][0 0 0 1][/source]

Wrong.
Do this:

[sx sx  sx  0]
[sy  sy sy  0]
[sz  sz  sz 0]
[0  0  0  1]

Problem solved.

L. Spiro

PARTNERS