Padrão de filotaxia em Python | Uma unidade de Botânica Algorítmica
Filotaxia / filotaxia é o arranjo das folhas no caule de uma planta e as espirais filotáticas formam uma classe distinta de padrões na natureza. A própria palavra vem do grego phullon que significa 'folha' e táxis que significa 'arranjo'. Os arranjos filotáxicos florais básicos incluem:
1. Filotaxia Espiral -
Na filotaxia espiral, os órgãos florais individuais são criados em intervalos regulares de tempo com o mesmo ângulo divergente. O ângulo divergente em uma flor com filotaxia espiral aproxima-se de 137,5 graus, o que é indicativo de um padrão que segue uma
Série Fibonacci
.A imagem abaixo mostra os padrões de filotaxia espiral com padrões espirais no sentido horário e anti-horário.
Pontos importantes a serem observados:
- As séries de Fibonacci normalmente descrevem espirais encontradas na natureza. É calculado como uma série em que o par de números anterior soma o próximo número da série. A série é 1 1 2 3 5 8 13 21 34 55 89….
- Na verdade, existe um conjunto de espirais no sentido horário e outro no sentido anti-horário.
- As espirais de órgãos florais seguem um conjunto de numeradores e denominadores de números de Fibonacci deslocados (1/2 1/3 2/5 3/8 5/13 8/21 13/34…). O numerador é o número de vezes ou voltas em torno do eixo para voltar à origem de iniciação. O denominador indica o número de órgãos iniciados durante os turnos. Portanto, 2/5 indicaria 2 voltas em torno do eixo e 5 órgãos para retornar à origem.
- por exemplo - No pinheiro temos (2 3) (5 3) e (5 8) filotaxes em capítulos os pares encontrados são (21 34) (55 34) (55 89) e (89 144) e nos abacaxis com escamas hexagonais os trigêmeos (8 13 21) ou (13 21 34) são encontrados dependendo do tamanho dos exemplares.
- A prevalência da sequência de Fibonacci na filotaxia é frequentemente referida como 'o mistério da filotaxia'.
Outros tipos de arranjos filotáxicos florais são:
2. Filotaxia espiralada 3. Filotaxia espiralada simples 4. Filotaxia espiralada complexa e 5. Filotaxia irregular
Formação do Padrão: Resumo
O belo arranjo de folhas em algumas plantas, chamado filotaxia, obedece a uma série de relações matemáticas sutis. Por exemplo, as florzinhas na cabeça de um girassol formam duas espirais em direções opostas: 55 delas no sentido horário e 34 no sentido anti-horário. Surpreendentemente
- Esses números são números consecutivos de Fibonacci.
- As proporções dos números alternativos de Fibonacci são dadas pelos convergentes para φ^(-2) onde φ é o proporção áurea e dizem que medem a fração de volta entre folhas sucessivas no caule de uma planta:
- por exemplo: 1/2 para olmo e tília 1/3 para faia e aveleira 2/5 para carvalho e maçã 3/8 para choupo e rosa 5/13 para salgueiro e amêndoa etc.
- Cada nova folha no caule de uma planta é posicionada em um determinado ângulo em relação à anterior e esse ângulo é constante entre as folhas: geralmente cerca de 137,5 graus.
Isto é, se você olhar de cima para a planta e medir o ângulo formado entre uma linha traçada do caule até a folha e uma linha correspondente para a próxima folha, você descobrirá que geralmente existe um ângulo fixo chamado ângulo de divergência. Aqui estamos interessados na filotaxia espiral e codificaremos para formar o padrão filotaxia espiral em python usando gráficos de tartaruga.
Projetando o Código
- Codificaremos duas funções, uma para desenhar o padrão filotaxia e outra para desenhar as pétalas.
- As pétalas precisam ser desenhadas somente após a conclusão do padrão de filotaxia. Portanto, chamaremos a função drawPetal() de dentro da função drawPhyllPattern() com as últimas coordenadas x e y sendo visitadas após desenhar o padrão de filotaxia.
- A função drawPetal() irá desenhar as pétalas com funções e recursos de tartaruga, consulte Programação tartaruga .
Para codificar o padrão de filotaxia, precisamos seguir estas equações:
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: Padrão de Filotaxia
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 idleSaída:
Padrões de filotaxia.
![]()
Criar questionário