def test_angle_axis_to_rot3d_invariant(): """Test the invariance of angle_axis_to_rot3d. Test the invariance property of the rotation axis on randomly selected axes. """ n = 1000 orientations = generate.get_random_quat(n) thetas = np.random.rand(n) * 2 * np.pi for i in range(n): orientation = orientations[i, 1:] theta = thetas[i] rot = convert.angle_axis_to_rot3d(orientation, theta) rotated = np.dot(rot, orientation) assert np.allclose(rotated, orientation)
def test_angle_axis_to_rot3d_x(): """Test angle_axis_to_rot3d for 90deg rotations along x.""" rot90 = convert.angle_axis_to_rot3d(cst.vecx, np.pi / 2) assert np.allclose(rot90, cst.Rx90)
def test_angle_axis_to_rot3d_z_name(): """Test angle_axis_to_rot3d for 90deg rotations along z, by name.""" # Caps should work too rot90 = convert.angle_axis_to_rot3d('Z', np.pi / 2) assert np.allclose(rot90, cst.Rz90)
def test_angle_axis_to_rot3d_y_name(): """Test angle_axis_to_rot3d for 90deg rotations along y, by name.""" rot90 = convert.angle_axis_to_rot3d('y', np.pi / 2) assert np.allclose(rot90, cst.Ry90)