def angle_axis2quat(theta, vector, is_normalized=False):
 vector = np.array(vector)
 if (not is_normalized):
  vector = (vector / math.sqrt(np.dot(vector, vector)))
 t2 = (theta / 2.0)
 st2 = math.sin(t2)
 return np.concatenate(([math.cos(t2)], (vector * st2)))

def angle_axis2quat ( theta , vector , is_normalized = False ) : vector = np . array ( vector ) if ( not is_normalized ) : vector = ( vector / math . sqrt ( np . dot ( vector , vector ) ) ) t2 = ( theta / 2.0 ) st2 = math . sin ( t2 ) return np . concatenate ( ( [ math . cos ( t2 ) ] , ( vector * st2 ) ) )
quaternion for rotation of angle theta around vector parameters theta : scalar angle of rotation vector : 3 element sequence vector specifying axis for rotation .