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
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
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)
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)
def typeStr(self): return PtCommon.dataTypeToStr(self.type)
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
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