[Closed] Scalematrix() ?
Hello all, I just got a quick question. I`ve been starting to dabble with manipulating objects transformation matrix and was wondering what the scalematrix() function is for. I know I need to pass it a point three value like [-1,1,1]. which seems to build a matrix3 so writing:
mymatrix = scalematrix [-1,1,1]
– returns:
matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]
but why is that any different to just writing:
mymatrix = matrix3 [-1,0,0] [0,1,0] [0,0,1] [0,0,0]
what is scalematrix() supposed to be used for.
Cheers
Dan
It’s exactly the same thing, fill the main diagonal of a matrix with the scale factors. Just as the transMatrix function does (fill the row4 with the specified point3), the rotateXMatrix (a bit more complex formulas), and so on.
So this functions are good to create these types of matrices quickly (or if you don’t know how to build them…).
Basic transformation matrices.
Greets.
Really it is just a fast way to create a matrix from a point three value. There is also transMatrix that will create a matrix for a position which is just the same as making row4 of an identity matrix the position of your object. It is just a faster way of dealing with it instead of having to create matrix values and then multiply them.