def test_boxshape(): # __init__ S0 = BoxShape() args = Vec3(1, 2, 3) S1 = BoxShape([args]) assert S0[0][0] == BoxShape.args0.values()[0] assert S1[0][0] == args
def test_boxshape_fix_xform(): # _fix_xform ident_T = TransformState.makeIdentity() X = None assert BoxShape._fix_xform(X) == ident_T X = () assert BoxShape._fix_xform(X) == ident_T X = Mat4.identMat() * 3 assert BoxShape._fix_xform(X) == TransformState.makeMat(X)
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
def test_boxshape_scale(): S0 = BoxShape() args = Vec3(1, 2, 3) S1 = BoxShape([args]) scale = Vec3(5, 6, 7) S0.scale(scale) S1.scale(scale) assert S0[0][0] == Vec3(*imap(mul, BoxShape.args0.values()[0], scale)) assert S1[0][0] == Vec3(*imap(mul, args, scale))
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)