欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python 自動(dòng)軌跡繪制的實(shí)例代碼

 更新時(shí)間:2019年07月05日 13:32:03   作者:二儀式  
今天小編就為大家分享一篇python 自動(dòng)軌跡繪制的實(shí)例代碼,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

用到的思維:

自動(dòng)化思維,數(shù)據(jù)和功能分開(kāi)處理,用數(shù)據(jù)驅(qū)動(dòng)程序自動(dòng)運(yùn)行

接口化設(shè)計(jì),數(shù)據(jù)與程序的對(duì)接方式要清晰明了

二維數(shù)據(jù)應(yīng)用,應(yīng)用維度組織數(shù)據(jù),二維數(shù)據(jù)最常用

代碼

# AutoTrace.py
import turtle as t
t.title("自動(dòng)軌跡繪制")
t.setup(800,600)
t.pencolor("red")
t.pensize(5)
t.speed(10)
# 數(shù)據(jù)讀取
datals=[]
f=open("data.trace",'rt')
for line in f:
  line=line.replace('\n','')
  datals.append(list(map(eval,line.split(','))))
f.close()
# 自動(dòng)繪制
for i in range(len(datals)):
  t.pencolor(datals[i][3],datals[i][4],datals[i][5])
  t.fd(datals[i][0])
  t.left(datals[i][2]) if datals[i][1]==0 else t.right(datals[i][2])
t.done()

數(shù)據(jù)文件

300,0,144,1,0,0
300,0,144,0,1,0
300,0,144,0,0,1
300,0,144,1,1,0
300,0,108,0,1,1
184,0,72,1,0,1
184,0,72,0,0,0
184,0,72,0,0,0
184,0,72,0,0,0
184,1,72,1,0,1
184,1,72,0,0,0
184,1,72,0,0,0
184,1,72,0,0,0
184,1,72,0,0,0
184,1,720,0,0,0

效果

以上這篇python 自動(dòng)軌跡繪制的實(shí)例代碼就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論