示例#1
0
def test_boxshape_shift():
    S0 = BoxShape()
    args = Vec3(1, 2, 3)
    S1 = BoxShape([args])
    pos = Vec3(10, 20, 30)
    quat = Quat(1, 1, 0, 0)
    quat.normalize()
    ones = Vec3(1, 1, 1)
    T = TransformState.makePosQuatScale(pos, quat, ones)
    S0.shift(pos=pos, quat=quat)
    S1.shift(pos=pos, quat=quat)
    S1.shift(pos=pos, quat=quat)
    assert S0[1] == T
    assert S1[1] == T.compose(T)
示例#2
0
def test_boxshape_transform():
    args = Vec3(1, 2, 3)
    S0 = BoxShape([args])
    scale = Vec3(5, 6, 7)
    pos = Vec3(10, 20, 30)
    quat = Quat(1, 1, 0, 0)
    quat.normalize()
    ones = Vec3(1, 1, 1)
    rbso = RBSO("rbso")
    rbso.set_scale(scale)
    rbso.set_pos(pos)
    rbso.set_quat(quat)
    S0.transform(rbso)
    T = TransformState.makePosQuatScale(pos, quat, ones)
    assert S0[0][0] == Vec3(*imap(mul, args, scale))
    assert S0[1] == T