本文整理汇总了Python中polygon.Polygon.contains方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.contains方法的具体用法?Python Polygon.contains怎么用?Python Polygon.contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.contains方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: snap
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import contains [as 别名]
if snapgrid:
x = snap( x, 50, 10 )
y = snap( y, 50, 10 )
point = Point( x + model.position.x, y + model.position.y, model.position.z )
if leftClick:
if len( objects ) > 0 and objects[ -1 ].is_open():
actions.do( \
( objects[ -1 ].add, [ point ] ), \
( objects[ -1 ].remove, [ point ] ) \
)
else:
actions.do( \
( lambda a: objects.append( a ), [ Polygon( ( 100, 100, ( 200 + model.position.z * 2 ) % 255 ) ).add( point ) ] ), \
( objects.pop, [] ) \
)
elif rightClick and len( objects ) > 0 and objects[ -1 ].is_open():
actions.do( \
( lambda a: objects[ -1 ].add( a ).close(), [ point ] ), \
( lambda a: objects[ -1 ].remove( a ).open(), [ point ] ) \
)
if Mode.VISUAL == mode and leftClick:
selected = False
for polygon in objects:
if not selected and polygon.contains( model, pygame.mouse.get_pos() ):
polygon.select()
selected = True
else:
polygon.deselect()
leftClick, _, rightClick = pygame.mouse.get_pressed()
model.output( screen, mode, objects )