本文整理汇总了Python中Polygon.Polygon.overlaps方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.overlaps方法的具体用法?Python Polygon.overlaps怎么用?Python Polygon.overlaps使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.overlaps方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from Polygon import Polygon [as 别名]
# 或者: from Polygon.Polygon import overlaps [as 别名]
#.........这里部分代码省略.........
def draw(self):
"""Draw the shape in the current OpenGL context.
"""
if self.enabled:
self._vertex_list.colors = self._gl_colors
self._vertex_list.vertices = self._gl_vertices
self._vertex_list.draw(pyglet.gl.GL_TRIANGLES)
def update(self, dt):
"""Update the shape's position by moving it forward according to its velocity.
Parameters
----------
dt : float
"""
self.translate(dt * self.velocity)
self.rotate(dt * self.angular_velocity)
def enable(self, enabled):
"""Set whether the shape should be drawn.
Parameters
----------
enabled : bool
"""
self.enabled = enabled
return self
def overlaps(self, other):
"""Check if two shapes overlap.
Parameters
----------
other : |Shape|
Returns
-------
bool
"""
return bool(self.poly.overlaps(other.poly))
def covers(self, other):
"""Check if the shape completely covers another shape.
Parameters
----------
other : |Shape|
Returns
-------
bool
"""
return bool(self.poly.covers(other.poly))
def __repr__(self):
kwarg_strs = []
for arg, value in self._kwargs.items():
if isinstance(value, str):
value_str = "'{}'".format(value)