use // https://github.com/rcolyer/closepoints function Rectellipse(a, b, q, h=0) = [for (t=[0:2:359]) let(xs=t<90||t>270?1:-1, ys=t<180?1:-1, tm=90-abs(t%180-90)) [xs*a*cos(tm)^q, ys*b*sin(tm)^q, h]]; function Height(x) = 2*((1-exp(-4*x))*(exp(-x)+0.8)^0.4); pointsarray = [for (t=[0:0.04:5]) let(h=Height(t), f=(5-t)/5) Rectellipse(4*f, 3*f, 0.4, h)]; ClosePoints(pointsarray);