示例#1
0
def test_angle_between():

    a = np.array([[0, 1], [1, 1], [1, 0]])
    b = np.array([[1, 0], [1, 0], [1, 0]])
    angles = angle_between(a, b, in_degrees=True, axis=-1)
    assert np.allclose(angles, [90, 45, 0])
    assert np.allclose(angle_between([2, 1], [1, 0], in_degrees=True), np.arctan(1/2.)*180/np.pi)
示例#2
0
def test_angle_between():

    a = np.array([[0, 1], [1, 1], [1, 0]])
    b = np.array([[1, 0], [1, 0], [1, 0]])
    angles = angle_between(a, b, in_degrees=True, axis=-1)
    assert np.allclose(angles, [90, 45, 0])
    assert np.allclose(angle_between([2, 1], [1, 0], in_degrees=True), np.arctan(1/2.)*180/np.pi)