當前位置: 首頁>>代碼示例>>Python>>正文


Python Polygon.close方法代碼示例

本文整理匯總了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
開發者ID:eZanmoto,項目名稱:Modeller-3D,代碼行數:21,代碼來源:modeller3d.py

示例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
開發者ID:eZanmoto,項目名稱:Modeller-3D,代碼行數:33,代碼來源:modeller3d.py


注:本文中的polygon.Polygon.close方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。