Superellipse: Difference between revisions
Added Processing implementation
(Added XPL0 example.) |
(Added Processing implementation) |
||
Line 1,179:
<span style="color: #000000;">main</span><span style="color: #0000FF;">()</span>
<!--</lang>-->
=={{header|Processing}}==
{{trans|C}}
<lang java>
//Aamrun, 29th June 2022
float a = 200, b = 200, n = 2.5;
float i, incr = 0.001;
int xMul,yMul;
size(500,500);
stroke(#ff0000);
for(i=0;i<2*PI;i+=incr){
if(PI/2<i && i<3*PI/2)
xMul = -1;
else
xMul = 1;
if(PI<i && i<2*PI)
yMul = -1;
else
yMul = 1;
ellipse(width/2 + xMul * a*pow(abs(cos(i)),2/n),height/2 + yMul * b*pow(abs(sin(i)),2/n),1,1);
}
</lang>
=={{header|Python}}==
|