def quat_rotate(rotation, vector):
def quat_mult_point(q, w):<EOL><INDENT>return (q[<NUM_LIT:3>] * w[<NUM_LIT:0>] + q[<NUM_LIT:1>] * w[<NUM_LIT:2>] - q[<NUM_LIT:2>] * w[<NUM_LIT:1>],<EOL>q[<NUM_LIT:3>] * w[<NUM_LIT:1>] + q[<NUM_LIT:2>] * w[<NUM_LIT:0>] - q[<NUM_LIT:0>] * w[<NUM_LIT:2>],<EOL>q[<NUM_LIT:3>] * w[<NUM_LIT:2>] + q[<NUM_LIT:0>] * w[<NUM_LIT:1>] - q[<NUM_LIT:1>] * w[<NUM_LIT:0>],<EOL>-q[<NUM_LIT:0>] * w[<NUM_LIT:0>] - q[<NUM_LIT:1>] * w[<NUM_LIT:1>] - q[<NUM_LIT:2>] * w[<NUM_LIT:2>])<EOL><DEDENT>q = quat_mult_point(rotation, vector)<EOL>q = tf.transformations.quaternion_multiply(<EOL>q, tf.transformations.quaternion_inverse(rotation))<EOL>return [q[<NUM_LIT:0>], q[<NUM_LIT:1>], q[<NUM_LIT:2>]]<EOL>
Rotate a vector according to a quaternion. Equivalent to the C++ method tf::quatRotate
:param rotation: the rotation
:param vector: the vector to rotate
:return: the rotated vector