(axis, angle)
return q
Returns a quaternion that generates the given axis-angle rotation.

  Returns the quaternion: sin(angle/2) * axis + cos(angle/2).

  Args:
    axis: Axis of rotation, a 3D vector in a numpy array.
    angle: The angle of rotation (radians).

  Raises:
    ValueError: If input axis is not a normalizable 3D vector.

  Returns:
    A unit quaternion in a numpy array.
Returns a quaternion that generates the given axis-angle rotation.
Returns a quaternion that generates the given axis - angle rotation .
def QuaternionFromAxisAngle(axis, angle):
  """Returns a quaternion that generates the given axis-angle rotation.

  Returns the quaternion: sin(angle/2) * axis + cos(angle/2).

  Args:
    axis: Axis of rotation, a 3D vector in a numpy array.
    angle: The angle of rotation (radians).

  Raises:
    ValueError: If input axis is not a normalizable 3D vector.

  Returns:
    A unit quaternion in a numpy array.

  """
  if len(axis) != 3:
    raise ValueError('Axis vector should have three components: %s' % axis)
  axis_norm = np.linalg.norm(axis)
  if np.isclose(axis_norm, 0.0):
    raise ValueError('Axis vector may not have zero length: |v| = %f, v = %s' %
                     (axis_norm, axis))
  half_angle = angle * 0.5
  q = np.zeros(4, dtype=np.float64)
  q[0:3] = axis
  q[0:3] *= math.sin(half_angle) / axis_norm
  q[3] = math.cos(half_angle)
  return q
def QuaternionFromAxisAngle ( axis , angle ) : if len ( axis ) != 3 : raise ValueError ( 'Axis vector should have three components: %s' % axis ) axis_norm = np . linalg . norm ( axis ) if np . isclose ( axis_norm , 0.0 ) : raise ValueError ( 'Axis vector may not have zero length: |v| = %f, v = %s' % ( axis_norm , axis ) ) half_angle = angle * 0.5 q = np . zeros ( 4 , dtype = np . float64 ) q [ 0 : 3 ] = axis q [ 0 : 3 ] *= math . sin ( half_angle ) / axis_norm q [ 3 ] = math . cos ( half_angle ) return q