Jump to content

Sunflower fractal: Difference between revisions

Applesoft BASIC
(Added Processing implementation)
(Applesoft BASIC)
Line 148:
[https://gitlab.com/amarok8bit/action-rosetta-code/-/raw/master/images/Sunflower_fractal.png Screenshot from Atari 8-bit computer]
 
=={{header|Applesoft BASIC}}==
<lang gwbasic>HGR:A=PEEK(49234):C=(SQR(5)+1)/2:N=900:FORI=0TO1600:R=(I^C)/N:A=2*3.141596535*C*I:X=R*SIN(A)+139:Y=R*COS(A)+96:F=7-4*((X-INT(X/2)*2)>=.75):X=(X>=0ANDX<280)*X:Y=(Y>=0ANDY<192)*Y:HCOLOR=F*(XANDY):HPLOTX,Y:NEXT</lang>
=={{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.
413

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.