예제 #1
0
def test_get_angle_with_orthogonal_vectors():
    v0 = np.array([0, 0, 1])
    v1 = np.array([0, 1, 0])

    r, d = get_angle(v0, v1)
    assert (r == 90 * np.pi / 180), "returned angle should be pi/2"
    assert (d == 90), "returned angle should be 90 degree"
예제 #2
0
def test_get_angle_returns_float():
    v0 = np.array([0, 0, 1])
    v1 = np.array([0, 1, 1])

    r, d = get_angle(v0, v1)
    assert (isinstance(r, np.float)), "get_angle() should return float"
    assert (isinstance(d, np.float)), "get_angle() should return float"
예제 #3
0
def test_get_angle_btw_zero_and_v1():
    v0 = np.array([0, 0, 0])
    v1 = np.array([0, 1, 0])

    r, d = get_angle(v0, v1)
    assert (r == 0), "returned angle should be 0"
    assert (d == 0), "returned angle should be 0"
예제 #4
0
def test_get_angle_with_unnormalized_vector():
    v0 = np.array([0, 0, 1])
    v1 = np.array([0, 2, 0])

    r, d = get_angle(v0, v1)
    assert (r == 90 * np.pi / 180), "returned angle should be pi/2"
    assert (d == 90), "returned angle should be 90 degree"
예제 #5
0
def test_get_angle_with_opposite_vectors():
    v0 = np.array([0, 0, 1])
    v1 = np.array([0, 0, -1])

    r, d = get_angle(v0, v1)
    assert (r == np.pi), "returned angle should be pi"
    assert (d == 180), "returned angle should be 180 degree"
예제 #6
0
def test_get_angle_with_same_vector():
    v0 = np.array([0, 0, 1])

    r, d = get_angle(v0, v0)
    assert (r == 0), "returned angle should be 0"
    assert (d == 0), "returned angle should be 0"