当前位置: 首页>>代码示例>>Python>>正文


Python Interval.Interval类代码示例

本文整理汇总了Python中Interval.Interval的典型用法代码示例。如果您正苦于以下问题:Python Interval类的具体用法?Python Interval怎么用?Python Interval使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Interval类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

    def __init__(
        self,
        node,
        startPos=None,
        endPos=None,
        duration=None,
        startVel=None,
        endZ=None,
        wayPoint=None,
        timeToWayPoint=None,
        gravityMult=None,
        name=None,
    ):
        """
        You may specify several different sets of input parameters.
        (If startPos is not provided, it will be obtained from the node's
        position at the time that the interval is first started. Note that
        in this case you must provide a duration of some kind.)
        
        # go from startPos to endPos in duration seconds
        startPos, endPos, duration
        # given a starting velocity, go for a specific time period
        startPos, startVel, duration
        # given a starting velocity, go until you hit a given Z plane
        startPos, startVel, endZ
        # pass through wayPoint at time 'timeToWayPoint'. Go until
        # you hit a given Z plane
        startPos, wayPoint, timeToWayPoint, endZ
        
        You may alter gravity by providing a multiplier in 'gravityMult'.
        '2.' will make gravity twice as strong, '.5' half as strong.
        '-1.' will reverse gravity
        """
        self.node = node

        if name == None:
            name = "%s-%s" % (self.__class__.__name__, self.projectileIntervalNum)
            ProjectileInterval.projectileIntervalNum += 1

            """
            # attempt to add info about the caller
            file, line, func = PythonUtil.callerInfo()
            if file is not None:
                name += '-%s:%s:%s' % (file, line, func)
            """

        args = (startPos, endPos, duration, startVel, endZ, wayPoint, timeToWayPoint, gravityMult)
        self.implicitStartPos = 0
        if startPos is None:
            if duration is None:
                self.notify.error("must provide either startPos or duration")
            self.duration = duration
            # we can't calc the trajectory until we know our starting
            # position; delay until the interval is actually started
            self.trajectoryArgs = args
            self.implicitStartPos = 1
        else:
            self.__calcTrajectory(*args)

        Interval.__init__(self, name, self.duration)
开发者ID:Wilee999,项目名称:TTRInjector,代码行数:60,代码来源:ProjectileInterval.py

示例2: __init__

 def __init__(self, node, startPos = None, endPos = None, duration = None, startVel = None, endZ = None, wayPoint = None, timeToWayPoint = None, gravityMult = None, name = None, collNode = None):
     self.node = node
     self.collNode = collNode
     if self.collNode:
         if isinstance(self.collNode, NodePath):
             self.collNode = self.collNode.node()
     if name == None:
         name = '%s-%s' % (self.__class__.__name__, self.projectileIntervalNum)
         ProjectileInterval.projectileIntervalNum += 1
     args = (startPos,
      endPos,
      duration,
      startVel,
      endZ,
      wayPoint,
      timeToWayPoint,
      gravityMult)
     self.implicitStartPos = 0
     if startPos is None:
         if duration is None:
             self.notify.error('must provide either startPos or duration')
         self.duration = duration
         self.trajectoryArgs = args
         self.implicitStartPos = 1
     else:
         self.trajectoryArgs = args
         self.__calcTrajectory(*args)
     Interval.__init__(self, name, self.duration)
     return
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:29,代码来源:ProjectileInterval.pyc.py

示例3: get_octave

 def get_octave(self):
     octave = Interval(self.base_freq)
     octave_freq = self.scale_intervals[0].final_frequency*2
     octave.final_frequency = octave_freq
     octave.note_number = self.NUM_INTERVALS
     octave.set_note_name()
     return octave
开发者ID:usrfrndly,项目名称:ModeBuilder,代码行数:7,代码来源:Scale.py

示例4: privInstant

 def privInstant(self):
     self.__initialize()
     Interval.privInstant(self)
     if self.collNode:
         self.collNode.clearSolids()
         csolid = CollisionParabola(self.parabola, 0, self.duration)
         self.collNode.addSolid(csolid)
开发者ID:Oldtiger5,项目名称:panda3d,代码行数:7,代码来源:ProjectileInterval.py

示例5: privInitialize

 def privInitialize(self, t):
     self.__initialize()
     if self.collNode:
         self.collNode.clearSolids()
         csolid = CollisionParabola(self.parabola, 0, 0)
         self.collNode.addSolid(csolid)
     Interval.privInitialize(self, t)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:7,代码来源:ProjectileInterval.pyc.py

示例6: __init__

    def __init__(self,
                 particleEffect,
                 duration=0.0,
                 parent = None,
                 renderParent = None,
                 name=None):
        """
        particleEffect is ??
        parent is ??
        worldRelative is a boolean
        loop is a boolean
        duration is a float for the time
        name is ??
        """
        # Generate unique name
        id = 'Particle-%d' % TestInterval.particleNum
        TestInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect
        self.parent = parent
        self.renderParent = renderParent

        Interval.__init__(self, name, duration)
开发者ID:BmanGames,项目名称:Toontown-Level-Editor,代码行数:25,代码来源:TestInterval.py

示例7: privStep

 def privStep(self, t):
     self.node.setFluidPos(self.__calcPos(t))
     Interval.privStep(self, t)
     if self.collNode and self.collNode.getNumSolids() > 0:
         csolid = self.collNode.modifySolid(0)
         csolid.setT1(csolid.getT2())
         csolid.setT2(t)
开发者ID:Oldtiger5,项目名称:panda3d,代码行数:7,代码来源:ProjectileInterval.py

示例8: __init__

    def __init__(self,
                 particleEffect,
                 parent,
                 worldRelative = 1,
                 renderParent = None,
                 duration = 0.0,
                 softStopT = 0.0,
                 cleanup = False,
                 name = None):
        """
        particleEffect is a ParticleEffect
        parent is a NodePath: this is where the effect will be
                              parented in the scenegraph
        worldRelative is a boolean: this will override 'renderParent'
                                    with render
        renderParent is a NodePath: this is where the particles will
                                    be rendered in the scenegraph
        duration is a float: for the time
        softStopT is a float: no effect if 0.0,
                              a positive value will count from the
                              start of the interval,
                              a negative value will count from the
                              end of the interval
        cleanup is a boolean: if True the effect will be destroyed
                              and removed from the scenegraph upon
                              interval completion
                              set to False if planning on reusing
                              the interval
        name is a string: use this for unique intervals so that
                          they can be easily found in the taskMgr
        """
        
        # Generate unique name
        id = 'Particle-%d' % ParticleInterval.particleNum
        ParticleInterval.particleNum += 1
        if name == None:
            name = id
        # Record instance variables
        self.particleEffect = particleEffect 
        self.cleanup = cleanup

        if parent != None:
            self.particleEffect.reparentTo(parent)
        if worldRelative:
            renderParent = render
        if renderParent:
            for particles in self.particleEffect.getParticlesList():
                particles.setRenderParent(renderParent.node())

        self.__softStopped = False
        
        if softStopT == 0.0:
            self.softStopT = duration
        elif softStopT < 0.0:
            self.softStopT = duration+softStopT
        else:
            self.softStopT = softStopT
            
        # Initialize superclass
        Interval.__init__(self, name, duration)
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:60,代码来源:ParticleInterval.py

示例9: privStep

 def privStep(self, t):
     if self.state == CInterval.SPaused or t < self.currT:
         self.privInitialize(t)
     else:
         if not self.__softStopped and t > self.softStopT:
             self.__step(self.softStopT - self.currT)
             self.__softStop()
             self.__step(t - self.softStopT)
         else:
             self.__step(t - self.currT)
         Interval.privStep(self, t)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:11,代码来源:ParticleInterval.pyc.py

示例10: privInitialize

    def privInitialize(self, t):
        if self.state != CInterval.SPaused:
            self.__softStart()
            if self.particleEffect:
                self.particleEffect.clearToInitial()
            self.currT = 0
        if self.particleEffect:
            for forceGroup in self.particleEffect.getForceGroupList():
                forceGroup.enable()

        Interval.privInitialize(self, t)
开发者ID:MasterLoopyBM,项目名称:c0d3,代码行数:11,代码来源:ParticleInterval.pyc.py

示例11: getInterval

def getInterval(pos,exons):
    numExons=len(exons)
    for i in range(numExons):
        exon=exons[i]
        interval=None
        if(pos+2==exon.getBegin()):
            interval=Interval(exons[i-1].end,exon.getEnd())
        elif(pos==exon.getEnd()):
            interval=Interval(exon.getBegin(),exons[i+1].getBegin())
        if(interval): 
            interval.exon=i
            return interval
    return None
开发者ID:ReddyLab,项目名称:1000Genomes,代码行数:13,代码来源:revisions-get-broken-sites.py

示例12: __init__

 def __init__(self, node, startPos = None, endPos = None, duration = None, startVel = None, endZ = None, gravityMult = None, name = None):
     self.node = node
     if name == None:
         name = '%s-%s' % (self.__class__.__name__, self.projectileIntervalNum)
         ProjectileInterval.projectileIntervalNum += 1
     
     args = (startPos, endPos, duration, startVel, endZ, gravityMult)
     self.needToCalcTraj = 0
     if startPos is None:
         self.trajectoryArgs = args
         self.needToCalcTraj = 1
     else:
         self._ProjectileInterval__calcTrajectory(*args)
     Interval.__init__(self, name, duration)
开发者ID:Toonerz,项目名称:Toontown-2003,代码行数:14,代码来源:ProjectileInterval.py

示例13: privInitialize

    def privInitialize(self, t):
        if self.state != CInterval.SPaused:
            # Restarting from a hard stop or just interrupting the
            # current play
            self.__softStart()
            if self.particleEffect:
                self.particleEffect.clearToInitial()
            self.currT = 0

        if self.particleEffect:
            for forceGroup in self.particleEffect.getForceGroupList():
                forceGroup.enable()

        Interval.privInitialize(self,t)
开发者ID:FelixBucket,项目名称:ToontownFritzServer,代码行数:14,代码来源:ParticleInterval.py

示例14: getContiguousRegions

 def getContiguousRegions(self):
     """getContiguousRegions() returns an array of Interval objects
     with a "value" attribute added
     """
     data=self.data
     if(self.isDiscrete()): raise Exception("track is not continuous")
     L=len(data)
     intervals=[]
     begin=0
     for i in range(1,L):
         x=data[i]
         prev=data[i-1]
         if(x==prev): continue
         interval=Interval(begin,i)
         interval.value=prev
         intervals.append(interval)
         begin=i
     interval=Interval(begin,L)
     interval.value=data[L-1]
     intervals.append(interval)
     return intervals
开发者ID:bmajoros,项目名称:python,代码行数:21,代码来源:FastbTrack.py

示例15: insert

 def insert(self, intervals, newInterval):
     
     if len(intervals) == 0:
         return [newInterval]
     
     r = []
     overlapWithNewInterval = Interval(newInterval.start, newInterval.end)
     didAddNewInterval = False
     
     for i in intervals:
         if (i.start < overlapWithNewInterval.start
               and i.end < overlapWithNewInterval.start):
             r.append(i)
         elif (i.start < overlapWithNewInterval.start
               and i.end >= overlapWithNewInterval.start
               and i.end <= overlapWithNewInterval.end):
             overlapWithNewInterval.start = i.start 
         elif (i.start < overlapWithNewInterval.start
               and i.end > overlapWithNewInterval.end):
             return intervals
         elif (i.start >= overlapWithNewInterval.start
               and i.end <= overlapWithNewInterval.end):
             pass
         elif (i.start >= overlapWithNewInterval.start
               and i.start <= overlapWithNewInterval.end
               and i.end >= overlapWithNewInterval.end):
             overlapWithNewInterval.end = i.end
         else:   # hxl: i is after overlapWithNewInterval
             if didAddNewInterval == False:
                 r.append(overlapWithNewInterval)
                 didAddNewInterval = True
             r.append(i)
     
     # hxl: It's possible that the new interval is not added yet!
     if didAddNewInterval == False:
         r.append(overlapWithNewInterval)
         didAddNewInterval = True
     return r
开发者ID:54lihaoxin,项目名称:leetcode_python,代码行数:38,代码来源:solution.py


注:本文中的Interval.Interval类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。