本文整理汇总了Python中polygon.Polygon.close方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.close方法的具体用法?Python Polygon.close怎么用?Python Polygon.close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类polygon.Polygon
的用法示例。
在下文中一共展示了Polygon.close方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_objects
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import close [as 别名]
def load_objects( filename ):
global VERSION_NUMBER
polygons = []
with open( filename, 'r' ) as f:
lines = f.readlines()
version = float( lines.pop( 0 ) )
if version >= VERSION_NUMBER:
lines.pop( 0 ) # ignore num_objects
while len( lines ) > 0:
c = lines.pop( 0 ).split()
polygon = Polygon( ( int( c[ 0 ] ), int( c[ 1 ] ), int( c[ 2 ] ) ) )
num_ps = int( lines.pop( 0 ) )
for i in range( 0, num_ps ):
magnitudes = map( int, lines.pop( 0 ).split() )
polygon.add( Point( *magnitudes ) )
polygons.append( polygon.close() )
else:
print "Modeller3D version " + VERSION_NUMBER + " cannot read file from Modeller3D version " + version
return polygons
示例2: Polygon
# 需要导入模块: from polygon import Polygon [as 别名]
# 或者: from polygon.Polygon import close [as 别名]
)
else:
actions.do( \
( lambda a: objects.append( a ), [ Polygon( ( 100, 100, ( 200 + model.position.z * 2 ) % 255 ) ).add( point ) ] ), \
( objects.pop, [] ) \
)
elif Command.POLYGON == command[ 0 ]:
if len( objects ) > 0 and objects[ -1 ].is_open():
actions.do( \
( objects[ -1 ].close, [] ), \
( objects[ -1 ].open, [] ) \
)
polygon = Polygon( ( 100, 100, ( 200 + model.position.z * 2 ) % 255 ) )
for p in command[ 1 ]:
polygon.add( Point( int( p[ 0 ] ), int( p[ 1 ] ), int( p[ 2 ] ) ) )
polygon.close()
actions.do( \
( objects.append, [ polygon ] ), \
( objects.pop, [] ) \
)
elif Command.SET == command[ 0 ]:
option = command[ 1 ][ 0 ]
if 'g' == option:
model = model.set_grid( True )
elif 'nog' == option:
model = model.set_grid( False )
elif 'sg' == option:
snapgrid = True
model = model.set_grid( True )
elif 'nosg' == option:
snapgrid = False