Sunflower fractal: Difference between revisions

Content added Content deleted
(→‎{{header|Vlang}}: Rename "Vlang" in "V (Vlang)")
(Added XPL0 example.)
Line 1,034: Line 1,034:
}
}
}</syntaxhighlight>
}</syntaxhighlight>

=={{header|XPL0}}==
[[File:SunflowerXPL0.gif|200px|thumb|right]]
<syntaxhighlight lang "XPL0">

proc DrawCircle(X0, Y0, R, Color);
int X0, Y0, R, Color;
int X, Y, R2;
[R2:= R*R;
for Y:= -R to +R do
for X:= -R to +R do
if X*X + Y*Y <= R2 then
Point(X+X0, Y+Y0, Color);
];

def Seeds = 3000, Color = $0E; \yellow
def ScrW = 800, ScrH = 600;
def Phi = (sqrt(5.)+1.) / 2.; \golden ratio (1.618...)
def Pi = 3.14159265358979323846;
real R, Angle, X, Y;
int I;
[SetVid($103);
for I:= 0 to Seeds-1 do
[R:= Pow(float(I), Phi) / float(Seeds/2);
Angle:= 2. * Pi * Phi * float(I);
X:= R*Sin(Angle);
Y:= R*Cos(Angle);
DrawCircle(ScrW/2+fix(X), ScrH/2-fix(Y), I*7/Seeds, Color);
];
]</syntaxhighlight>


=={{header|Yabasic}}==
=={{header|Yabasic}}==