15 lines
374 B
Text
15 lines
374 B
Text
//Aamrun, 1st July 2022
|
|
|
|
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);
|
|
}
|