test_rotate_utils.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pytomo3d 作者: computational-seismology 项目源码 文件源码
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])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号