示例#1
0
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)
示例#2
0
文件: pso.py 项目: jhamrick/scenesim
 def _fix_xform(T):
     """ Converts T into a valid xform. Returns None on fail."""
     # If T has "flat" attribute, it is an ndarray and that should
     # be returned. Otherwise just return T.
     if not T:
         xform = TransformState.makeIdentity()
     else:
         if not isinstance(T, TransformState):
             mat = Mat4(*T.flat) if hasattr(T, "flat") else Mat4(T)
             xform = TransformState.makeMat(mat)
         else:
             xform = T
     return xform
示例#3
0
 def _fix_xform(T):
     """ Converts T into a valid xform. Returns None on fail."""
     # If T has "flat" attribute, it is an ndarray and that should
     # be returned. Otherwise just return T.
     if not T:
         xform = TransformState.makeIdentity()
     else:
         if not isinstance(T, TransformState):
             mat = Mat4(*T.flat) if hasattr(T, "flat") else Mat4(T)
             xform = TransformState.makeMat(mat)
         else:
             xform = T
     return xform