' version 23-10-2016 ' compile with: fbc -s console Const scr_x = 800 ' screen 800 x 800 Const scr_y = 600 Const m_x = scr_x \ 2 ' middle of screen Const m_y = scr_y \ 2 Sub superellipse(a As Long, b As Long, n As Double) ReDim As Long y(0 To a) Dim As Long x y(0) = b ' value for x = 0 y(a) = 0 ' value for x = a '(0,0) is in upper left corner PSet (m_x, m_y - y(0)) ' set starting point For x = 1 To a-1 y(x) = Int( Exp( Log(1 - ((x / a) ^ n)) / n ) * b ) Line - ((m_x + x), (m_y - y(x))) Next For x = a To 0 Step -1 Line - ((m_x + x), (m_y + y(x))) Next For x = 0 To a Line - ((m_x - x), (m_y + y(x))) Next For x = a To 0 Step -1 Line - ((m_x - x), (m_y - y(x))) Next End Sub ' ------=< MAIN >=------ ScreenRes scr_x, scr_y, 32 Dim As Long a = 200 Dim As Long b = 150 Dim As Double n = 2.5 superellipse(a, b, n) ' empty keyboard buffer While Inkey <> "" : Wend Print : Print "hit any key to end program" Sleep End