Cantor set: Difference between revisions

Added Processing implementation
(→‎{{header|XPL0}}: cleaner version)
(Added Processing implementation)
Line 2,802:
=== Press any key to exit ===</pre>
 
=={{header|Processing}}==
<lang java>
void cantorSet(int x1,int y1,int x2,int y2,int strWt,int gap,int n){
strokeWeight(strWt);
line(x1,y1,x2,y2);
if(n>0){
cantorSet(x1,gap + y1,(2*x1+x2)/3,gap + (2*y1+y2)/3,strWt,gap,n-1);
cantorSet((2*x2+x1)/3,gap + (2*y2+y1)/3,x2,gap + y2,strWt,gap,n-1);
}
}
 
void setup(){
size(1000,1000);
cantorSet(100,10,900,10,1,10,5);
}
</lang>
=={{header|Python}}==
===Imperative===
503

edits