דפוס פילוטקסיס בפייתון | יחידה של בוטניקה אלגוריתמית
Phyllotaxis/Phyllotaxy הוא סידור העלים על גזע צמח והספירלות הפילוטקטיות יוצרות סוג ייחודי של דפוסים בטבע. המילה עצמה באה מהיוונית phullon שמשמעותה 'עלה' ומוניות שמשמעותה 'סידור'. הסידורים הפילוטקסיים הבסיסיים של הפרחים כוללים:
1. פילוטקסיס ספירלי -
בפילוטקסיה ספירלית נוצרים איברי הפרחים הבודדים במרווח זמן קבוע עם אותה זווית מתפצלת. הזווית המתפצלת בפרח עם פילוטקסיה ספירלית מתקרבת ל-137.5 מעלות, מה שמעיד על תבנית שעוקבת אחרי
סדרת פיבונאצ'י
.התמונה למטה מציגה את דפוסי הפילוטקסיה הספירלית עם דפוסי ספירלה גם עם כיוון השעון וגם נגד כיוון השעון.
נקודות חשובות לשים לב:
- סדרות פיבונאצ'י מתארות בדרך כלל ספירלות שנמצאות בטבע. זה מחושב כסדרה שבה זוג המספרים הקודם מסתכם למספר הבא בסדרה. הסדרה היא 1 1 2 3 5 8 13 21 34 55 89 … .
- למעשה יש סט אחד של ספירלות בכיוון השעון וקבוצה אחת נגד כיוון השעון.
- ספירלות איברים פרחוניים עוקבות אחר קבוצה של מונה ומכנה של מספרי פיבונאצ'י מקוזזים (1/2 1/3 2/5 3/8 5/13 8/21 13/34 …). המונה הוא מספר הפעמים או הסיבובים סביב הציר כדי לחזור למקור החניכה. המכנה מציין את מספר האיברים שהופעלו במהלך הסיבובים. לכן 2/5 יציין 2 סיבובים סביב הציר ו-5 איברים לחזור למקור.
- למשל - באורן יש לנו (2 3) (5 3) ו- (5 8) פילוטקסים בקפיטולי הזוגות שנמצאו הם (21 34) (55 34) (55 89) ו- (89 144) ובאננסים עם קשקשים משושה השלשות (8 13 2) נמצאו בגודל 13 132 בהתאם לגודל (13) של הדגימות.
- השכיחות של רצף פיבונאצ'י בפילוטקסיס מכונה לעתים קרובות 'המסתורין של הפילוטקסיס'.
סוגים אחרים של סידורים פילוטקסיים פרחוניים הם:
2. Phyllotaxis 3. Phyllotaxis פשוט-whurled 4. Phyllotaxis מורכבת ו-5. Phyllotaxis לא סדיר
היווצרות התבנית: סיכום
הסידור היפה של עלים בחלק מהצמחים הנקרא פילוטקסיס מציית למספר קשרים מתמטיים עדינים. לדוגמה, הפרחים שבראשה של חמנייה יוצרים שתי ספירלות מכוונות הפוכה: 55 מהן בכיוון השעון ו-34 נגד כיוון השעון. לְהַפְלִיא
- המספרים הללו הם מספרי פיבונאצ'י עוקבים.
- היחסים של מספרי פיבונאצ'י החלופיים ניתנים על ידי המתכנסים ל-φ^(-2) כאשר φ הוא יחס הזהב ונאמר מודדים את שבריר הסיבוב בין עלים עוקבים על גבעול צמח:
- למשל: 1/2 עבור בוקיצה וטיליה 1/3 עבור אשור ולוז 2/5 עבור אלון ותפוח 3/8 עבור צפצפה וורד 5/13 עבור ערבה ושקדים וכו'.
- כל עלה חדש על גזע צמח ממוקם בזווית מסוימת לקודמת ושהזווית הזו קבועה בין העלים: בדרך כלל כ-137.5 מעלות.
כלומר, אם תביטו מלמעלה על הצמח ותמדדו את הזווית הנוצרת בין קו שנמשך מהגבעול לעלה לקו המתאים לעלה הבא תגלו שבדרך כלל יש זווית קבועה שנקראת זווית הדיברגנציה. כאן אנו מעוניינים בפילוטקסיה ספירלית ואנו נקודד ליצירת תבנית פילוטקסיה ספירלית בפיתון באמצעות גרפיקת צב.
עיצוב הקוד
- נקודד שתי פונקציות האחת לצייר את תבנית הפילוטקסיה והשנייה לצייר את עלי הכותרת.
- יש לצייר את עלי הכותרת רק לאחר השלמת תבנית הפילוטקסיס. אז נקרא לפונקציה drawPetal() מתוך הפונקציה drawPhyllPattern() עם קואורדינטות ה-x וה-y האחרונות שבהן ביקרו לאחר ציור תבנית הפילוטקסיס.
- הפונקציה drawPetal() תצייר את עלי הכותרת עם פונקציות ותכונות של צב תכנות צב .
כדי לקודד את תבנית הפילוטקסיס עלינו לעקוב אחר המשוואות הבאות:
x = r*cos(θ)
y = r*sin(θ)
r θ can also vary - so the to form phyllotactic pattern we substitutethe cartesian form
by polar form:
r = c*sqrt(n)
θ = n*137.508°
Reduces the problem to optimal packing on a disc so
r = c*sqrt(n) is from the area of the circle
Area = πr² and n fills the Area in some units
c1 * n/π = r² c is 1/sqrt(c1/π)
So r = some constant c * sqrt(n)
PseudoCode: דפוס פילוטקסיס
IMPORT MODULES ( MATH TURTLE )
FUNCTION - DrawPhyllotaxisPattern( turtle t length petalstart angle = 137.508 size cspread)
turtleColor('Black')
FillColor(''Orange')
Convert angle to radians (Φ)
initialize ( xcenterycenter ) = ( 00 )
Drawing the Pattern Starts:
For n in Range ( 0t ):
r = cspread * sqrt(n)
θ = n * Φ
x = r * cos(θ) + xcenter
y = r * sin(θ) + ycenter
TURTLE POSITION(xy)
START DRAWING():
if Drawing pattern ends:
DrawFlowerPetals()
FUNCTION - DrawFlowerPetals(Turtle x coordinate y coordinate)
DRAW using Turtle methods
Create Turtle = gfg
Call DrawPhyllotaxisPattern( gfg t length petalstart angle = 137.508 size cspread)
END
Python Pattern APython Pattern Bimport math import turtle def drawPhyllPattern ( turtle 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 ( 'black' ) turtle . fillcolor ( 'orange' ) phi = angle * ( math . pi / 180.0 ) #we convert to radian 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 ( turtle x y ) else : turtle . stamp () def drawPetal ( turtle x y ): turtle . penup () turtle . goto ( x y ) turtle . pendown () turtle . color ( 'black' ) turtle . fillcolor ( 'yellow' ) turtle . begin_fill () turtle . right ( 20 ) turtle . forward ( 70 ) turtle . left ( 40 ) turtle . forward ( 70 ) turtle . left ( 140 ) turtle . forward ( 70 ) turtle . left ( 40 ) turtle . forward ( 70 ) turtle . penup () turtle . end_fill () # this is needed to complete the last petal gfg = turtle . Turtle () gfg . shape ( 'turtle' ) gfg . speed ( 0 ) # make the turtle go as fast as possible drawPhyllPattern ( gfg 200 160 137.508 ) gfg . penup () gfg . forward ( 1000 )import math import turtle def drawPhyllotacticPattern ( 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 ( 20 ) turtle . forward ( 100 ) turtle . left ( 40 ) turtle . forward ( 100 ) turtle . left ( 140 ) turtle . forward ( 100 ) turtle . left ( 40 ) 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 drawPhyllotacticPattern ( 200 160 137.508 4 10 ) turtle . exitonclick () # lets you x out of the window when outside of idleתְפוּקָה:
דפוסי פילוטקסיס.
![]()
צור חידון