我想这样画:http://ompldr.org/vYjN1ZQ
使用activestate example或opengl fractal example或任何
算法是:
def Calculator(Total):
numpyArray = numpy.zeros((Total, 2))
for i in range(1, Total+1):
numpyArray[i-1, 0] = ((2 * i) - 1)
numpyArray[i-1, 1] = (Total - i + 1)
print "N : %d, l : %d, twig : %d, leaf %d" %(Total, i, numpyArray[i-1,0], numpyArray[i-1,1])
num = input("input number : ")
inputTotal = num
for i in range(1, inputTotal + 1):
Calculator(i)
print '\n'
例如N=5
,
茎的关节将有1枝和5叶..N:5,l:1,树枝:1,叶5
N:5,l:2,树枝:3,叶4
N:5,l:3,树枝:5,叶3
N:5,l:4,树枝:7,叶2
N:5,l:5,树枝:9,叶1
如何用这些信息绘制树?