Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Superellipse/Zkl/superellipse-1.zkl
Normal file
9
Task/Superellipse/Zkl/superellipse-1.zkl
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
fcn superEllipse(plot,n,color=0xff0000){ // we'll assume width <= height
|
||||
a,p:=(plot.w/2).toFloat(), 1.0/n; // just calculate upper right quadrant
|
||||
foreach x in ([0.0 .. a]){
|
||||
y:=(a.pow(n) - x.pow(n)).pow(p); // a==b>0 --> y=(a^n - x^n)^(1/n)
|
||||
//println( (x/a).abs().pow(n) + (y/b).abs().pow(n) ); // sanity check
|
||||
plot[x,y]=plot[-x,-y]=plot[-x,y]=plot[x,-y]=color; // all 4 quadrants
|
||||
}
|
||||
plot
|
||||
}
|
||||
7
Task/Superellipse/Zkl/superellipse-2.zkl
Normal file
7
Task/Superellipse/Zkl/superellipse-2.zkl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
w:=h:=600;
|
||||
plot:=PPM(w+1,h+1,0x909090); plot.cross(w/2,h/2);
|
||||
foreach n in ([0.01..1, 0.14]){ superEllipse(plot,n, 0x0000bb) }// 0-1: blue
|
||||
foreach n in ([1.0.. 2, 0.14]){ superEllipse(plot,n, 0x00ff00) }// 1-2: green
|
||||
foreach n in ([2.0..10, 1.4]) { superEllipse(plot,n, 0xff0000) }// 2+: red
|
||||
|
||||
plot.writeJPGFile("superEllipse.jpg");
|
||||
Loading…
Add table
Add a link
Reference in a new issue