本文整理匯總了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