รูปแบบ Phyllotaxis คืออะไร
เมื่อเราย้อนกลับไป ในชั้นเรียนพฤกษศาสตร์และโลกของพืช ไฟลโลทาซิสหมายถึงการจัดเรียงของดอกไม้ ใบไม้ หรือเมล็ดพืชบนลำต้น คล้ายกับที่พบในเกลียวฟีโบนักชี จากลำดับฟีโบนักชี เกลียวฟีโบนักชีคือชุดของตัวเลขที่เป็นไปตามรูปแบบที่คล้ายกับสามเหลี่ยมปาสกาล หมายเลขลำดับฟีโบนักชีมีลักษณะดังนี้ - 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144 เป็นต้น ดังนั้นหมายเลขลำดับฟีโบนักชีคือผลรวมของตัวเลขก่อนหน้า
ฟีโบนักชีวงก้นหอย
โดยทั่วไปเราจะมองหาความสมมาตรและรูปแบบเพื่อทำความเข้าใจวัตถุรอบตัวเรา โดยที่ไม่รู้ตัว ตาของเรากำลังเห็นลำดับฟีโบนักชี หรือในกรณีของหัวดอกทานตะวัน นั่นคือเกลียวฟีโบนักชี
วิธีแก้ปัญหา


เกลียวดอกทานตะวัน
โค้ดตัวอย่าง
import math
import turtle
def PhyllotacticPattern( t, petalstart, angle = 137.508, size = 2, cspread = 4 ):
"""print a pattern of circles using spiral phyllotactic data"""
# initialize position
turtle.pen(outline=1,pencolor="black",fillcolor="orange")
# turtle.color("orange")
phi = angle * ( math.pi / 180.0 )
xcenter = 0.0
ycenter = 0.0
# for loops iterate in this case from the first value until < 4, so
for n in range (0,t):
r = cspread * math.sqrt(n)
theta = n * phi
x = r * math.cos(theta) + xcenter
y = r * math.sin(theta) + ycenter
# move the turtle to that position and draw
turtle.up()
turtle.setpos(x,y)
turtle.down()
# orient the turtle correctly
turtle.setheading(n * angle)
if n > petalstart-1:
#turtle.color("yellow")
drawPetal(x,y)
else: turtle.stamp()
def drawPetal( x, y ):
turtle.up()
turtle.setpos(x,y)
turtle.down()
turtle.begin_fill()
#turtle.fill(True)
turtle.pen(outline=1,pencolor="black",fillcolor="yellow")
turtle.right(25)
turtle.forward(100)
turtle.left(45)
turtle.forward(100)
turtle.left(140)
turtle.forward(100)
turtle.left(45)
turtle.forward(100)
turtle.up()
turtle.end_fill() # this is needed to complete the last petal
turtle.shape("turtle")
turtle.speed(0) # make the turtle go as fast as possible
PhyllotacticPattern( 200, 160, 137.508, 4, 10 )
turtle.exitonclick() # lets you x out of the window when outside of idle วิธีแก้ปัญหา

ด้วยการเปลี่ยนแปลงเล็กน้อยในโปรแกรมด้านบนของคุณ ผลลัพธ์ของคุณอาจถูกแทนที่ เช่น (ให้สีที่กำหนดเองและแก้ไขค่าบางอย่าง):
