예제 #1
0
def PiScale(*args):
    if len(args) > 0 and type(args[0]) == list:
        vec = args[0]
        x = float(vec[0])
        y = float(vec[1])
        z = float(vec[2])
    elif len(args) > 0 and args[0].__class__.__name__ == "PtVector":
        vec = args[0]
        x = vec.x
        y = vec.y
        z = vec.z
    elif len(args) == 0:
        x = 1.
        y = 1.
        z = 1.
    else:
        raise PtCommon.PtTypeError("PiScale requires a list or a PtVector")

    m = PtMatrix([x, 0., 0., 0., 0., y, 0., 0., 0., 0., z, 0., 0., 0., 0., 1.])
    #mi = PtMatrix([1./x,0.,0.,0.,
    #              0.,1./y,0.,0.,
    #              0.,0.,1./z,0.,
    #              0.,0.,0.,1.])
    #t = PtTransform()
    #t.m = m
    #t.mInv =mi
    return m
예제 #2
0
def PiTranslate(*args):
    if len(args) > 0 and type(args[0]) == list:
        vec = args[0]
        x = float(vec[0])
        y = float(vec[1])
        z = float(vec[2])
    elif len(args) and args[0].__class__.__name__ in ["PtVector", 'PtPoint']:
        vec = args[0]
        x = vec.x
        y = vec.y
        z = vec.z
    elif len(args) == 0:
        x = 0.
        y = 0.
        z = 0.
    else:
        raise PtCommon.PtTypeError("PiTranslate requires a list or a PtVector")

    l = [1., 0., 0., x, 0., 1., 0., y, 0., 0., 1., z, 0., 0., 0., 1.]
    mat = PtMatrix(l)
    return mat
예제 #3
0
    def __init__(self, pluginName, name=None):
        # create an instance of the plugin
        #plugin = eval("PtPluginManager.getPlugin('%s').%s"%(pluginName,pluginName))
        plugin = eval("PtPluginManager.getPlugin('%s')" % pluginName)
        if not inspect.isclass(plugin):
            plugin = eval("plugin.%s" % pluginName)

        ins = plugin()
        self.name = name if name else PtCommon.getRandomName(ins.name)
        self.type = ins.name
        self.params = ins.params
        for i in self.params:
            exec("self.%s = self.params[i]" % i)

        for i in ins.methods:
            exec("self.%s = ins.methods[i]" % i)

        # add to the world
        if ins.type == PtCommon.TDC_PLUGIN_CAMERA:
            PtWorld.cameras.append(self)
        elif ins.type == PtCommon.TDC_PLUGIN_SHAPE:
            PtWorld.shapes.append(self)
예제 #4
0
    def __init__(self,pluginName,name=None):
        # create an instance of the plugin
        #plugin = eval("PtPluginManager.getPlugin('%s').%s"%(pluginName,pluginName))
        plugin = eval("PtPluginManager.getPlugin('%s')"%pluginName)
        if not inspect.isclass(plugin):
            plugin = eval("plugin.%s"%pluginName)

        ins = plugin()
        self.name   = name if name else PtCommon.getRandomName(ins.name)
        self.type   = ins.name
        self.params = ins.params 
        for i in self.params:
            exec("self.%s = self.params[i]"%i)

        for i in ins.methods:
            exec("self.%s = ins.methods[i]"%i)

        # add to the world
        if ins.type == PtCommon.TDC_PLUGIN_CAMERA:
            PtWorld.cameras.append(self)
        elif ins.type == PtCommon.TDC_PLUGIN_SHAPE:
            PtWorld.shapes.append(self)
예제 #5
0
 def typeStr(self):
     return PtCommon.dataTypeToStr(self.type)
예제 #6
0
 def __init__(self,name=None,value=None,parmType=None):
     self.type   = parmType if parmType else None
     self.name   = name if name else PtCommon.getRandomName("Param") 
     self.__value  = value if value else None
     self.default  = value 
예제 #7
0
파일: PtParam.py 프로젝트: camer/videofiles
 def typeStr(self):
     return PtCommon.dataTypeToStr(self.type)
예제 #8
0
파일: PtParam.py 프로젝트: camer/videofiles
 def __init__(self, name=None, value=None, parmType=None):
     self.type = parmType if parmType else None
     self.name = name if name else PtCommon.getRandomName("Param")
     self.__value = value if value else None
     self.default = value