Sunflower fractal: Difference between revisions

Added Processing implementation
No edit summary
(Added Processing implementation)
Line 721:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</lang>-->
 
=={{header|Processing}}==
{{trans|C}}
<lang java>
//Abhishek Ghosh, 26th June 2022
 
size(1000,1000);
surface.setTitle("Sunflower...");
 
int iter = 3000;
float factor = .5 + sqrt(1.25),r,theta,diskRatio=0.5;
float x = width/2.0, y = height/2.0;
double maxRad = pow(iter,factor)/iter;
int i;
background(#add8e6); //Lightblue background
for(i=0;i<=iter;i++){
r = pow(i,factor)/iter;
 
if(r/maxRad < diskRatio){
stroke(#000000); // Black central disk
}
else
stroke(#ffff00); // Yellow Petals
 
theta = 2*PI*factor*i;
ellipse(x + r*sin(theta), y + r*cos(theta), 10 * i/(1.0*iter),10 * i/(1.0*iter));
}
</lang>
 
=={{header|Python}}==
503

edits