Sunflower fractal: Difference between revisions
Content added Content deleted
No edit summary |
Thundergnat (talk | contribs) (Rename Perl 6 -> Raku, alphabetize, minor clean-up) |
||
Line 4: | Line 4: | ||
<br> |
<br> |
||
<br> |
<br> |
||
=={{header|C}}== |
=={{header|C}}== |
||
The colouring of the "fractal" is determined with every iteration to ensure that the resulting graphic looks similar to a real Sunflower, thus the parameter ''diskRatio'' determines the radius of the central disk as the maximum radius of the flower is known from the number of iterations. The scaling factor is currently hardcoded but can also be externalized. Requires the [http://www.cs.colorado.edu/~main/bgi/cs1300/ WinBGIm] library. |
The colouring of the "fractal" is determined with every iteration to ensure that the resulting graphic looks similar to a real Sunflower, thus the parameter ''diskRatio'' determines the radius of the central disk as the maximum radius of the flower is known from the number of iterations. The scaling factor is currently hardcoded but can also be externalized. Requires the [http://www.cs.colorado.edu/~main/bgi/cs1300/ WinBGIm] library. |
||
Line 361: | Line 362: | ||
print "</svg>\n";</lang> |
print "</svg>\n";</lang> |
||
See [https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/sunflower.svg Phi-packing image] (SVG image) |
See [https://github.com/SqrtNegInf/Rosettacode-Perl5-Smoke/blob/master/ref/sunflower.svg Phi-packing image] (SVG image) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | Or, to be completely accurate: It is a variation of a generative [[wp:Fermat's_spiral|Fermat's spiral]] using the Vogel model to implement phi-packing. See: [https://thatsmaths.com/2014/06/05/sunflowers-and-fibonacci-models-of-efficiency/ https://thatsmaths.com/2014/06/05/sunflowers-and-fibonacci-models-of-efficiency] |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Phix}}== |
=={{header|Phix}}== |
||
Line 453: | Line 426: | ||
end procedure |
end procedure |
||
main()</lang> |
main()</lang> |
||
=={{header|Python}}== |
=={{header|Python}}== |
||
<lang python> |
<lang python> |
||
Line 506: | Line 480: | ||
done() |
done() |
||
</lang> |
</lang> |
||
=={{header|R}}== |
=={{header|R}}== |
||
<lang R> |
<lang R> |
||
Line 551: | Line 526: | ||
(+ (/ HEIGHT 2) (* r (cos theta))) |
(+ (/ HEIGHT 2) (* r (cos theta))) |
||
image))</lang> |
image))</lang> |
||
⚫ | |||
(formerly Perl 6) |
|||
⚫ | |||
⚫ | |||
⚫ | Or, to be completely accurate: It is a variation of a generative [[wp:Fermat's_spiral|Fermat's spiral]] using the Vogel model to implement phi-packing. See: [https://thatsmaths.com/2014/06/05/sunflowers-and-fibonacci-models-of-efficiency/ https://thatsmaths.com/2014/06/05/sunflowers-and-fibonacci-models-of-efficiency] |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Ring}}== |
=={{header|Ring}}== |