當前位置: 首頁>>代碼示例>>Python>>正文


Python surface.Surface類代碼示例

本文整理匯總了Python中surface.Surface的典型用法代碼示例。如果您正苦於以下問題:Python Surface類的具體用法?Python Surface怎麽用?Python Surface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Surface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

 def __init__(self,
              base=[0, 0, 0],
              focal=200.0,
              seglen=30.0,
              ang=0.006,
              r0=5.5,
              r1=None
              ):
     '''
     Constructor
     
     Parameters:
         base:    the center point of the wide end of the segment
         seglen:  the axial length of the segment
         ang:     angle of the segment side to the axis
         r0:      radius of the wide end of the segment
         r1:      radius of the small end of the segment
     '''
     # instantiate
     Surface.__init__(self)
     self.base = np.array(base, dt)
     self.focal = focal
     self.seglen = seglen
     self.ang = ang
     ''' Vanspeybroeck and Chase Parameters '''
     self.e = cos(4 * ang) * (1 + (tan(4 * ang) * tan(3 * ang)))
     self.d = focal * tan(4 * ang) * tan((4 * ang) - 3 * ang)
     self.updateDims(r0, r1)
開發者ID:ehsteve,項目名稱:foxsi-optics-sim,代碼行數:28,代碼來源:segmenth.py

示例2: __init__

 def __init__(self, system, frame, Y=0, Z=0, R=1, name=None, tolerance=1e-10, ):
     Surface.__init__(self, system, name, tolerance)
     self.frame = frame
     self.Y = Y
     self.Z = Z
     self.R = R
     self.sign = 1.0
開發者ID:elliothevel,項目名稱:whisker_sim,代碼行數:7,代碼來源:circle.py

示例3: Weapon

class Weapon(Emitter, Inputable):
    def __init__(self, level, **kwargs):
        super().__init__(**kwargs)

        self._level = level
        self._part = None
        self._s = Surface((20, 10))
        self._s.fill((255, 0, 0))

        self._input = Input(inputStream=self.getInputStream())
        self._input.set(pygame.KEYDOWN, self.createNew, pygame.K_f)

    def createNew(self):
        x, y = self._offsetFunc()
        self._part = Particle((self._anchor.x + x, self._anchor.y + y, 20, 10),
                              (10, 0),
                              self._s,
                              self._level,
                              Behaviors.killAt(150, 150),
                              Behaviors.moveAt(self._anchor.getIntDir() * 10, 0),
                              Behaviors.killOnCollision(exceptions=(self._anchor.getId(),)),
                              Behaviors.cleanupCollision(),
                              altname="bullet")
        if x < 0:
            self._part.x -= self._part.w
        self._part.move.setSpeed(x=self._part.move.getTopSpeed(x=True))

    def _emit(self):
        if self._part:
            self._children.append(self._part)
            self._part = None

    def tick(self):
        self._input()
        super().tick()
開發者ID:DanCardin,項目名稱:PyPlatformer,代碼行數:35,代碼來源:weapons.py

示例4: __init__

 def __init__(self, system, Y, Z, frame, tolerance=1e-10, name=None):
     Surface.__init__(self, system, name, tolerance)
     self.Y = Y
     self.Z = Z
     self.frame = frame
     self.sign = -1.0
     self.pegrw = np.array((0,Y,Z,1))
開發者ID:elliothevel,項目名稱:whisker_sim,代碼行數:7,代碼來源:peg.py

示例5: __init__

 def __init__(self, system, X, Y, Z, R, frame, tolerance=1e-10, name=None):
     Surface.__init__(self, system, name, tolerance)
     self.X = X
     self.Y = Y
     self.Z = Z
     self.R = R
     self.frame = frame
     self.sign = -1.0
開發者ID:elliothevel,項目名稱:whisker_sim,代碼行數:8,代碼來源:sphere.py

示例6: __init__

 def __init__(self, system, point, normal, frame, tolerance=1e-10, name=None):
     Surface.__init__(self, system, name, tolerance)
     self.normal = normal
     self.point = point
     self.frame = frame
     self.plane_d = -np.dot(point, normal)
     self.plane_r = np.sqrt(np.dot(normal,normal))
     self.sign = -1.0
開發者ID:elliothevel,項目名稱:whisker_sim,代碼行數:8,代碼來源:plane.py

示例7: resize

 def resize(self, width, height):
     Surface.resize(self, width, height)
     self.surface.resize(width, height)
     try:
         self.surface._display.textbox.resize()
     except (TypeError, AttributeError):     #pyjs-O:TypeError/-S:AttributeError
         pass
     try:
         self.surface._display.textarea.resize()
     except (TypeError, AttributeError):     #pyjs-O:TypeError/-S:AttributeError
         pass
開發者ID:Lucytheanimefan,項目名稱:Center-for-Advanced-HindSight-Games,代碼行數:11,代碼來源:display.py

示例8: convert_image

 def convert_image(self, image):
     """
     Return the image as a Surface.
     """
     if env.canvas._isCanvas:
         img = image.getElement()
         surface = Surface((img.width,img.height))
         surface.drawImage(image, 0, 0)
     else:
         surface = Surf(image)
     return surface
開發者ID:Lucytheanimefan,項目名稱:Center-for-Advanced-HindSight-Games,代碼行數:11,代碼來源:image.py

示例9: scale

    def scale(self, surface, size, dest=None):
        """
        Return Surface resized by the given size.
        An optional destination surface can be provided.
        """
        if not dest:
            surf = Surface(size)
        else:
            surf = dest
        surf.drawImage(surface.canvas, 0, 0, surface.get_width(), surface.get_height(), 0, 0, size[0], size[1])    #pyjs0.8 *.canvas
#        surf.drawImage(surface, 0, 0, surface.get_width(), surface.get_height(), 0, 0, size[0], size[1])
        return surf
開發者ID:Lucytheanimefan,項目名稱:Center-for-Advanced-HindSight-Games,代碼行數:12,代碼來源:transform.py

示例10: __init__

 def __init__(self, origin = [-1,-1,0], ax1 = [2,0,0], ax2 = [0,2,0]):
     '''
     Constructor
     
     Parameters:
         ax1:     first edge of parallelogram as a vector
         ax2:     second edge of parallelogram as a vector
         origin:  the origin coordinate for both axes
     '''
     Surface.__init__(self)
     self.origin = np.array(origin,dt)
     self.ax1 = np.array(ax1,dt)
     self.ax2 = np.array(ax2,dt)
開發者ID:ehsteve,項目名稱:foxsi-optics-sim,代碼行數:13,代碼來源:plane.py

示例11: scale

 def scale(self, surface, size, dest=None):
     """
     Return Surface resized by the given size.
     An optional destination surface can be provided.
     """
     if not dest:
         surf = Surface(size, BufferedImage.TYPE_INT_ARGB)
     else:
         surf = dest
     g2d = surf.createGraphics()
     g2d.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
     g2d.drawImage(surface, 0, 0, size[0], size[1], None)
     g2d.dispose()
     return surf
開發者ID:YuliReiri,項目名稱:WinLifeGame,代碼行數:14,代碼來源:transform.py

示例12: __init__

    def __init__(   self,
                    camera,
                    scale=1.0,
                    tileSize=128,
                    tilesX=1,
                    tilesZ=1,
                    depth=30.0):
    
        self.depth = depth

        self.tileSize = tileSize
        self.tilesX = tilesX
        self.tilesZ = tilesZ

        self.camera = camera
        self.scale = scale
        
        self.surfaceShader = ShaderProgram.open('shaders/colour_by_height.shader')

        
        # Use the shallow pool ripple surface generator
        self.heightfield = Ripples(self.camera, self.tileSize)
                                           
        # The water surface
        self.surface = Surface( self.surfaceShader,
                                self.camera,
                                texture=None,
                                heightfield=self.heightfield,
                                tileSize=self.tileSize, 
                                tilesX=self.tilesX,
                                tilesZ=self.tilesZ,
                                scale=self.scale, 
                                offset=Vector3(0.0,self.depth,0.0))
開發者ID:naxIO,項目名稱:WaterCaustics,代碼行數:33,代碼來源:water.py

示例13: apply

 def apply(self):
     self._log.debug(u"""Applying values
     filename: '%s',
     subdivisions: '%f',
     bezier factor: '%f'""" % (
         self.surface_filename,
         self.surface_subdivisions,
         self.bezier_factor))
     if self.surface:
         del self.surface
         if self.plane:
             self.plane.removeNode()
             self.plane = None
         if self.mls_surface:
             self.mls_surface.removeNode()
             self.mls_surface = None
         if self.bezier_surface:
             self.bezier_surface.removeNode()
             self.bezier_surface = None
         if self.point_cloud:
             self.point_cloud.removeNode()
             self.point_cloud = None
     self.surface = Surface.from_file(self.surface_filename)
     self._toggle_plane()
     self._toggle_mls_surface()
     self._toggle_bezier_surface()
     self._toggle_point_cloud()
開發者ID:weltenwort,項目名稱:uni_cg2,代碼行數:27,代碼來源:cg2_ex2.py

示例14: create_life

	def create_life(self):

		spot_count = len(Level1.LIFE_SPOT)
		spot_number = randint(0, spot_count - 1)
		life_tile = Surface.get_tile_by_number(Level1.LIFE_SPOT[spot_number])

		Life(life_tile.x, life_tile.y)
開發者ID:mmoreirasouza,項目名稱:pythonzombiegame,代碼行數:7,代碼來源:level1.py

示例15: Pool

class Pool():
    '''
    A shallow pool with concentric ripples on its surface
    '''
    def __init__(   self,
                    camera,
                    scale=1.0,
                    tileSize=128,
                    tilesX=1,
                    tilesZ=1,
                    depth=30.0):
    
        self.depth = depth

        self.tileSize = tileSize
        self.tilesX = tilesX
        self.tilesZ = tilesZ

        self.camera = camera
        self.scale = scale
        
        self.surfaceShader = ShaderProgram.open('shaders/colour_by_height.shader')

        
        # Use the shallow pool ripple surface generator
        self.heightfield = Ripples(self.camera, self.tileSize)
                                           
        # The water surface
        self.surface = Surface( self.surfaceShader,
                                self.camera,
                                texture=None,
                                heightfield=self.heightfield,
                                tileSize=self.tileSize, 
                                tilesX=self.tilesX,
                                tilesZ=self.tilesZ,
                                scale=self.scale, 
                                offset=Vector3(0.0,self.depth,0.0))

    def setDepth(self, depth):
        self.surface.setDepth(self.depth)
    def tap(self, tapPosition):
        self.heightfield.tap(tapPosition)

    def draw(self,dt):
        self.surface.draw(dt)        
開發者ID:naxIO,項目名稱:WaterCaustics,代碼行數:45,代碼來源:water.py


注:本文中的surface.Surface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。