(rmat)
return np.array([y, z, x])
Converts a 3x3 rotation matrix to YZX euler angles.
Converts a 3x3 rotation matrix to YZX euler angles.
Converts a 3x3 rotation matrix to YZX euler angles .
def _rmat_to_euler_yzx(rmat):
  """Converts a 3x3 rotation matrix to YZX euler angles."""
  if rmat[1, 0] > _POLE_LIMIT:
    logging.warning('Angle at North Pole')
    x = -np.arctan2(rmat[0, 2], rmat[0, 1])
    z = np.pi/2
    y = 0.0
    return np.array([y, z, x])

  if rmat[1, 0] < -_POLE_LIMIT:
    logging.warning('Angle at South Pole')
    x = -np.arctan2(rmat[0, 2], rmat[0, 1])
    z = -np.pi/2
    y = 0.0
    return np.array([y, z, x])

  x = -np.arctan2(rmat[1, 2], rmat[1, 1])
  z = np.arcsin(rmat[1, 0])
  y = -np.arctan2(rmat[2, 0], rmat[0, 0])

  # order of return is the order of input
  return np.array([y, z, x])
def _rmat_to_euler_yzx ( rmat ) : if rmat [ 1 , 0 ] > _POLE_LIMIT : logging . warning ( 'Angle at North Pole' ) x = - np . arctan2 ( rmat [ 0 , 2 ] , rmat [ 0 , 1 ] ) z = np . pi / 2 y = 0.0 return np . array ( [ y , z , x ] ) if rmat [ 1 , 0 ] < - _POLE_LIMIT : logging . warning ( 'Angle at South Pole' ) x = - np . arctan2 ( rmat [ 0 , 2 ] , rmat [ 0 , 1 ] ) z = - np . pi / 2 y = 0.0 return np . array ( [ y , z , x ] ) x = - np . arctan2 ( rmat [ 1 , 2 ] , rmat [ 1 , 1 ] ) z = np . arcsin ( rmat [ 1 , 0 ] ) y = - np . arctan2 ( rmat [ 2 , 0 ] , rmat [ 0 , 0 ] ) # order of return is the order of input return np . array ( [ y , z , x ] )