maxtrix in mathutil

i 'm trying to use the functions in mathutil module but not certain how it can be use!

can someone give a small example on this

like i tried to do the transpose but i did nto worl!

matrix1 = Matrix([1,1,1],[0,1,0],[1,0,0])

print ’ mat =’,matrix1

print ’ transpose =’,matrix.transpose(matrix1)

and can somone tell me what are the 4 values in a quaternon in blender?
i guess there are the 3 XYZ values + another one !

Thanks for any help & happy blendering

For quaternion read wikipedia articles for enlightenment or not.

You misunderstand the python. Matrix is a class, transpose is a method of the class.

matrix1 = Matrix([1,1,1],[0,1,0],[1,0,0]) defines an instance of the class.

therefore the method applied to the instance is:

matrix1.transpose()

Note: blender actually does call these instance methods in the documentation.

http://www.blender.org/documentation/249PythonDoc/index.html

The documentation says that this sets the matrix to its transpose and returns none.

Thus

print matrix1.transpose()

is not going to print anything

but

matrix1.transpose()

will transpose matrix1 in place, as you should be able to see by doing this

print matrix1

If you want to transpose a copy then first do this:

matrix2 = matrix1.copy()
matrix2.transpose()
print matrix2

The documentation explains all the methods you can use on the instances of Matrix plus these “magic” methods:

  •          mat + mat
    
  •          mat - mat
    
  •          mat * float/int
    
  •          mat * vec
    
  •          mat * mat