Shape generator help (Armin Hofmann’s ‘rubber band’ shape generator) #2

Can someone help me with my code?
I tried to auto generate the shapes from Armin Hofmann but don’t know how to get further.
This is what I have now:

This his how it should be:

you have to use the shape method, hence call beginShape and endShape and make use of arcs and vertexes here is an example.

this is taken from an old request


    Shape[] shapes = new Shape[3];
    void setup(){
      size(300,300);
      smooth(8);
     
      float eh = 100;
      float ew = 200;
      PVector l = new PVector(100,200);
     
      shapes[2] = new Shape(eh, ew, 100.0, 100.0/3, l);
    }
    void draw(){
      background(255);
      strokeWeight(4);
      stroke(0);
      strokeCap(PROJECT);
      strokeJoin(MITER);
      fill(255,0,0);
      //shapes[2].c = color(0);
      shapes[2].draw();
     
    }
    class Shape{
      //----- variables ------
      float ellipseHeight;
      float ellipseWidth;
      float shapeWidth;
      float shapeHeight;
      PVector location;
     
      //----- constructor -----
      Shape(float eh, float ew, float sh, float sw, PVector l){
        ellipseHeight = eh;
        ellipseWidth  = ew;
        shapeWidth = sw;
        shapeHeight = sh;
        PVector p = l.get();
        location = p;
      }
     
      //------ draw shape -----
      void draw(){
        beginShape();
        float theY = (ellipseHeight/2) * sin(acos(shapeWidth/(ellipseWidth/2)));
        arc(location.x, location.y-shapeHeight+theY, shapeWidth*2, theY*2, -PI/2,0);
        vertex(location.x+shapeWidth, location.y-shapeHeight+theY);
        vertex(location.x+shapeWidth, location.y+theY);
        vertex(location.x, location.y+theY);
        vertex(location.x, location.y-shapeHeight);
    //                );   
        endShape();
      }
    }

the code in question to make the shape in the draw loop

void draw(){
        beginShape();
        float theY = (ellipseHeight/2) * sin(acos(shapeWidth/(ellipseWidth/2)));
        arc(location.x, location.y-shapeHeight+theY, shapeWidth*2, theY*2, -PI/2,0);
        vertex(location.x+shapeWidth, location.y-shapeHeight+theY);
        vertex(location.x+shapeWidth, location.y+theY);
        vertex(location.x, location.y+theY);
        vertex(location.x, location.y-shapeHeight);
    //                );   
        endShape();

}

after that its just knowing how to make proper use of the arc function