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


Python Polygon.createBoundingBoxPolygon方法代码示例

本文整理汇总了Python中Polygon.Polygon.createBoundingBoxPolygon方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.createBoundingBoxPolygon方法的具体用法?Python Polygon.createBoundingBoxPolygon怎么用?Python Polygon.createBoundingBoxPolygon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Polygon.Polygon的用法示例。


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

示例1: updateLocation

# 需要导入模块: from Polygon import Polygon [as 别名]
# 或者: from Polygon.Polygon import createBoundingBoxPolygon [as 别名]
 def updateLocation(self, newLocation):
     self.previousLocation = self.location
     self.location = newLocation
     self.bbox = BoundingBox(self.location.x-self.width/2, self.location.y-self.height/2,
                             self.location.x+self.width/2, self.location.y+self.height/2)
     self.polygon = Polygon.createBoundingBoxPolygon(Vector(self.location.x-self.width/2, self.location.y-self.height/2),
                                             Vector(self.location.x+self.width/2, self.location.y+self.height/2))
     self.polygon.convex = True        
开发者ID:ducino,项目名称:dig,代码行数:10,代码来源:Actor.py

示例2: on_key_press

# 需要导入模块: from Polygon import Polygon [as 别名]
# 或者: from Polygon.Polygon import createBoundingBoxPolygon [as 别名]
def on_key_press(symbol, modifiers):
    global actor
    
    if symbol == key.LEFT:
        actor.controls.pressedLeft = True
    if symbol == key.RIGHT:
        actor.controls.pressedRight = True
    if symbol == key.UP:
        actor.controls.pressedUp = True
    if symbol == key.DOWN:
        actor.controls.pressedDown = True
    if symbol == key.SPACE:
        actor.controls.pressedJump = True
        
    global polygon2
    global debug

    if symbol == key.A:
        polygon2 = Polygon.createBoundingBoxPolygon(Vector(-20, -20), Vector(40, 0))
        polygon2.midpointDisplacement(8)
        polygon2.midpointDisplacement(6)
        polygon2.triangulate()
    if symbol == key.Z:
        debug = (debug + 1)%4
开发者ID:ducino,项目名称:dig,代码行数:26,代码来源:Test.py

示例3: Line

# 需要导入模块: from Polygon import Polygon [as 别名]
# 或者: from Polygon.Polygon import createBoundingBoxPolygon [as 别名]
        dx = (self.x1 - self.x2)
        hx = (self.x1 + self.x2)/2
        hy = (self.y1 + self.y2)/2
        return Line(hx, hy, hx - dy, hy + dx)        

debug = 0
actor = Actor()
world = QuadNode()

# polygon = Polygon()
# polygon.addVertex(Vector(-100., -100.))
# polygon.addVertex(Vector(100., -100.+random.randrange(-10., 10.)))
# polygon.addVertex(Vector(50., 0.))
# world.add(polygon)

polygon = Polygon.createBoundingBoxPolygon(Vector(-100, -100), Vector(100, 0))
polygon.midpointDisplacement(10)
polygon.midpointDisplacement(10)
polygon.midpointDisplacement(8)
polygon.midpointDisplacement(6)
polygon.triangulate()
world.add(polygon)

polygon2 = Polygon.createBoundingBoxPolygon(Vector(-20, -20), Vector(40, 0))
polygon2.midpointDisplacement(8)
polygon2.midpointDisplacement(6)  
polygon2.triangulate()

for i in range(-5, 5):
    poly = Polygon.createBoundingBoxPolygon(Vector(-200*i, -200), Vector(-200*i+100+random.randrange(50, 150), -100))
    poly.midpointDisplacement(10)
开发者ID:ducino,项目名称:dig,代码行数:33,代码来源:Test.py


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