A superellipse is a geometric figure defined as the set of all points (x, y) with



 





|


x
a


|


n



+


|


y
b


|


n



=
1
,


{\displaystyle \left|{\frac {x}{a}}\right|^{n}\!+\left|{\frac {y}{b}}\right|^{n}\!=1,}




where n, a, and b are positive numbers.



Task
Draw a superellipse with n = 2.5, and a = b = 200




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
}