Exemple #1
0
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)
Exemple #2
0
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)
Exemple #3
0
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)
Exemple #4
0
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)
Exemple #5
0
def test_angle_axis_to_rot3d_z_name():
    """Test angle_axis_to_rot3d for 90deg rotations along z, by name."""
    theta = np.pi / 2
    rot90 = convert.angle_axis_to_rot3d('Z', theta)  # Caps should work too
    assert np.allclose(rot90, Rz90)
Exemple #6
0
def test_angle_axis_to_rot3d_x_name():
    """Test angle_axis_to_rot3d for 90deg rotations along x, by name."""
    theta = np.pi / 2
    rot90 = convert.angle_axis_to_rot3d('x', theta)
    assert np.allclose(rot90, Rx90)
Exemple #7
0
def test_angle_axis_to_rot3d_z():
    """Test angle_axis_to_rot3d for 90deg rotations along z."""
    axis = np.array([0., 0., 1.])
    theta = np.pi / 2
    rot90 = convert.angle_axis_to_rot3d(axis, theta)
    assert np.allclose(rot90, Rz90)