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




 
[start]
    nomainwin
    UpperLeftX=1:UpperLeftY=1
    WindowWidth=800:WindowHeight=600
    open "Super Ellipse" for graphics_nf_nsb as #1
    #1 "trapclose [q];down;fill black;flush;color green;size 1"
 
    n=1.5
    a=200
    b=200
 
    for n = 0.1 to 5 step .1
        na=2/n
        t=.01
        for i = 0 to 314
            xp=a*sign(cos(t))*abs((cos(t)))^na+350
            yp=b*sign(sin(t))*abs((sin(t)))^na+275
            t=t+.02
            #1 "set ";xp;" ";yp
        next i
    next n
 
    'plot only the super ellipse for the task
    n=2.5
    na=2/n
    t=.01
    #1 "color white;size 4"
    for i = 0 to 314
        xp=a*sign(cos(t))*abs((cos(t)))^na+350
        yp=b*sign(sin(t))*abs((sin(t)))^na+275
        t=t+.02
        #1 "set ";xp;" ";yp
    next i
wait
 
[q]
close #1
end
 
function sign(x)
    if x<0 then sign=1
    if x>0 then sign=-1
    if x=0 then sign=0
end function
 