def project_rotation_2D()

in fairmotion/ops/math.py [0:0]


def project_rotation_2D(R, axis1, axis2, order="zyx"):
    """
    Project a 3D rotation matrix to the 2D rotation
    when two rotational axes are given
    """
    zyx = conversions.R2E(R, order)
    index1 = utils.axis_to_index(axis1)
    index2 = utils.axis_to_index(axis2)
    if index1 == 0 and index2 == 1:
        return np.array(zyx[2], zyx[1])
    elif index1 == 0 and index2 == 2:
        return np.array(zyx[2], zyx[0])
    elif index1 == 1 and index2 == 0:
        return np.array(zyx[1], zyx[2])
    elif index1 == 1 and index2 == 2:
        return np.array(zyx[1], zyx[0])
    elif index1 == 2 and index2 == 0:
        return np.array(zyx[0], zyx[2])
    elif index1 == 2 and index2 == 1:
        return np.array(zyx[0], zyx[1])
    else:
        raise Exception