예제 #1
0
def test_rotate_certain_angle_2():

    d1 = np.array([1.0, 0.0])
    d2 = np.array([0.0, 1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 90.0)
    npt.assert_array_almost_equal(dnew1, [0.0, 1.0])
    npt.assert_array_almost_equal(dnew2, [-1.0, 0.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 180.0)
    npt.assert_array_almost_equal(dnew1, [-1.0, 0.0])
    npt.assert_array_almost_equal(dnew2, [0.0, -1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 270.0)
    npt.assert_array_almost_equal(dnew1, [0.0, -1.0])
    npt.assert_array_almost_equal(dnew2, [1.0, 0.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 360.0)
    npt.assert_array_almost_equal(dnew1, [1.0, 0.0])
    npt.assert_array_almost_equal(dnew2, [0.0, 1.0])
예제 #2
0
def test_rotate_certain_angle_2():

    d1 = np.array([1.0, 0.0])
    d2 = np.array([0.0, 1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 90.0)
    npt.assert_array_almost_equal(dnew1, [0.0, 1.0])
    npt.assert_array_almost_equal(dnew2, [-1.0, 0.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 180.0)
    npt.assert_array_almost_equal(dnew1, [-1.0, 0.0])
    npt.assert_array_almost_equal(dnew2, [0.0, -1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 270.0)
    npt.assert_array_almost_equal(dnew1, [0.0, -1.0])
    npt.assert_array_almost_equal(dnew2, [1.0, 0.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 360.0)
    npt.assert_array_almost_equal(dnew1, [1.0, 0.0])
    npt.assert_array_almost_equal(dnew2, [0.0, 1.0])
예제 #3
0
def test_rotate_certain_angle():

    d1 = np.array([1.0, 0.0])
    d2 = np.array([0.0, 1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 30.0)

    dnew1_true = np.array([np.sqrt(3) / 2.0, 0.5])
    dnew2_true = np.array([-0.5, np.sqrt(3) / 2.0])
    npt.assert_allclose(dnew1, dnew1_true)
    npt.assert_allclose(dnew2, dnew2_true)
예제 #4
0
def test_rotate_certain_angle():

    d1 = np.array([1.0, 0.0])
    d2 = np.array([0.0, 1.0])

    dnew1, dnew2 = rotate.rotate_certain_angle(d1, d2, 30.0)

    dnew1_true = np.array([np.sqrt(3)/2.0, 0.5])
    dnew2_true = np.array([-0.5, np.sqrt(3)/2.0])
    npt.assert_allclose(dnew1, dnew1_true)
    npt.assert_allclose(dnew2, dnew2_true)