def test_division(self):
qr_1 = Quaternion(1, 2, 3, 4)
qt_1 = Quaternion(1, 3, 3, 6)
dq_1 = DualQuaternion(qr_1, qt_1)
identity_dq = np.array([0., 0., 0., 1., 0., 0., 0., 0.]).T
npt.assert_allclose((dq_1 / dq_1).dq, identity_dq, atol=1e-6)
# TODO(ff): Fix this test.
qr_2 = Quaternion(1, 4, 5, 1)
qt_2 = Quaternion(-4, 2, 3, 4)
dq_2 = DualQuaternion(qr_2, qt_2)
# dq_2_copy = dq_2.copy()
# dq_2_copy.normalize()
# dq_expected = dq_1 / dq_2.norm()[0] * dq_2.conjugate()
# dq_expected = 1.0 / dq_2.norm()[0] * DualQuaternion(
# qr_1 * qr_2.conjugate(),
# -1.0 / dq_2.norm()[0] * (qr_1 * qt_2.conjugate() +
# qt_1 * qr_2.conjugate()))
# dq_expected = dq_1 * DualQuaternion(qr_2.inverse(),
# -qt_2 * qr_2.inverse() * qr_2.inverse())
# npt.assert_allclose((dq_1 / dq_2).dq, dq_expected.dq, atol=1e-6)
test_dual_quaternion.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录