Using mathutils

Hello,

i wanna use mathutils für rotating vectors.
For example rotate [1,2,3] at the axis [3,4,5] throuch 60 Degree against clock.

I simply do not understand the usage. It does not become clear from the documentation. Do you know any tutorial?

Im not sure… but I think you need to contruct a a rotation matrix from the arbitrary axis [3,4,5] with a rotation of 60 degrees. Then you would multiply the vector [1,2,3] by the rotation matrix.

v * M = v’

To construct the arbitrary rotation matrix you can do:

import Blender
from Blender import *

arbAxis = Mathutils.Vector([3,4,5])
rotMat = Mathutils.RotationMatrix(60.0, 3, 'R', arbAxis)

vect = Mathutils.Vector([1,2,3])

vect_prime = Mathutils.MatMultVec(rotMat, vect)
print vect_prime

RotationMatrix(rotation_in_degrees, square_matrix_dimensions, axis_type, (optional)arbitrary_axis)

MatMultVec() does column_multiplication VecMultMat() does row_multiplication.