pulse2percept.utils.three_dim

parse_3d_orient

Functions

parse_3d_orient(orient[, orient_mode]) Parse the orient parameter Given either a 3D rotation matrix, vector of angles of rotation, or direction vector, this function will calculate and return the all three representations.
pulse2percept.utils.three_dim.parse_3d_orient(orient, orient_mode='direction')[source]

Parse the orient parameter Given either a 3D rotation matrix, vector of angles of rotation, or direction vector, this function will calculate and return the all three representations.

Parameters:
  • orient (np.ndarray with shape (3) or (3, 3)) –

    Orientation of the electrode in 3D space. orient can be:

    • A length 3 vector specifying the direction that the thread should extend in (if orient_mode == ‘direction’)
    • A list of 3 angles, (r_x, r_y, r_z), specifying the rotation in degrees about each axis (x rotation performed first). (If orient_mode == ‘angle’)
    • 3D rotation matrix, specifying the direction that the thread should extend in (i.e. a unit vector in the z direction will point in the direction after being rotated by this matrix)
  • orient_mode (str) – If ‘direction’, orient is a vector specifying the direction that the electrode should extend in. If ‘angle’, orient is a vector of 3 angles, (r_x, r_y, r_z), specifying the rotation in degrees about each axis (starting with x). Does not apply if orient is a 3D rotation matrix.
Returns:

  • rot (np.ndarray with shape (3, 3)) – Rotation matrix
  • angles (np.ndarray with shape (3)) – Angles of rotation (degrees) about each axis (x, y, z). Note that this mapping is not unique. This function will always set the rotation about the x axis to be 0, meaning that the returned coordinates will match spherical coordinates (i.e. r_y is phi and r_z is theta).
  • direction (np.ndarray with shape (3)) – Unit vector specifying the direction of the orientation.