Patrón de filotaxis en Python | Una unidad de botánica algorítmica
La filotaxis/filotaxia es la disposición de las hojas en el tallo de una planta y las espirales filotácticas forman una clase distintiva de patrones en la naturaleza. La palabra en sí proviene del griego phullon que significa "hoja" y taxis que significa "arreglo". Los arreglos filotáxicos florales básicos incluyen:
1. Filotaxia espiral -
En la filotaxia espiral, los órganos florales individuales se crean en un intervalo de tiempo regular con el mismo ángulo divergente. El ángulo divergente en una flor con filotaxia espiral se aproxima a 137,5 grados, lo que indica un patrón que sigue una
serie de fibonacci
La siguiente imagen muestra los patrones de filotaxia en espiral que tienen patrones en espiral tanto en el sentido de las agujas del reloj como en el sentido contrario a las agujas del reloj.
Puntos importantes a tener en cuenta:
- Las series de Fibonacci suelen describir espirales que se encuentran en la naturaleza. Se calcula como una serie donde el par de números anterior se suma al siguiente número de la serie. La serie es 1 1 2 3 5 8 13 21 34 55 89….
- En realidad, hay un conjunto de espirales en el sentido de las agujas del reloj y otro en el sentido contrario a las agujas del reloj.
- Las espirales de órganos florales siguen un conjunto de numerador y denominador de números de Fibonacci desplazados (1/2 1/3 2/5 3/8 5/13 8/21 13/34…). El numerador es el número de vueltas o vueltas alrededor del eje para volver al origen de iniciación. El denominador indica el número de órganos iniciados durante los turnos. Por tanto un 2/5 indicaría 2 vueltas alrededor del eje y 5 órganos para volver al origen.
- ej. - En el pino tenemos (2 3) (5 3) y (5 8) filotaxes en capituli los pares encontrados son (21 34) (55 34) (55 89) y (89 144) y en piñas con escamas hexagonales se encuentran los trillizos (8 13 21) o (13 21 34) dependiendo del tamaño de los ejemplares.
- La prevalencia de la secuencia de Fibonacci en la filotaxis a menudo se denomina "el misterio de la filotaxis".
Otros tipos de arreglos filotáxicos florales son:
2. Filotaxia espirada 3. Filotaxia espirada simple 4. Filotaxia espirada compleja y 5. Filotaxia irregular
Formación del patrón: resumen
La hermosa disposición de las hojas en algunas plantas llamada filotaxis obedece a una serie de sutiles relaciones matemáticas. Por ejemplo, los floretes de la cabeza de un girasol forman dos espirales con direcciones opuestas: 55 de ellas en el sentido de las agujas del reloj y 34 en el sentido contrario. Asombrosamente
- Estos números son números de Fibonacci consecutivos.
- Las proporciones de los números de Fibonacci alternos están dadas por los convergentes a φ^(-2) donde φ es el proporción áurea y se dice que miden la fracción de vuelta entre hojas sucesivas en el tallo de una planta:
- por ejemplo: 1/2 para olmo y tilo 1/3 para haya y avellano 2/5 para roble y manzano 3/8 para álamo y rosa 5/13 para sauce y almendro, etc.
- Cada nueva hoja en el tallo de una planta se coloca en un ángulo determinado con respecto a la anterior y que este ángulo es constante entre hojas: normalmente unos 137,5 grados.
Es decir, si miras la planta desde arriba y mides el ángulo formado entre una línea trazada desde el tallo hasta la hoja y una línea correspondiente para la siguiente hoja, encontrarás que generalmente hay un ángulo fijo llamado ángulo de divergencia. Aquí estamos interesados en la filotaxia espiral y codificaremos para formar el patrón de filotaxia espiral en Python usando gráficos de tortuga.
Diseñando el código
- Codificaremos dos funciones, una para dibujar el patrón de filotaxia y la otra para dibujar los pétalos.
- Los pétalos deben dibujarse solo después de que se complete el patrón de filotaxis. Por lo tanto, llamaremos a la función drawPetal() desde dentro de la función drawPhyllPattern() visitando las últimas coordenadas x e y después de dibujar el patrón de filotaxis.
- La función drawPetal() dibujará los pétalos con funciones y características de tortuga. Programación de tortugas .
Para codificar el patrón de filotaxis debemos seguir estas ecuaciones:
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)
Pseudocódigo: patrón de filotaxis
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 idleProducción:
Patrones de filotaxis.
![]()
Crear cuestionario