Lemniscate envelope

This Lemniscate envelope is generated by sweeping a circle, which has its center on a hyperbola.

This code was written by Pouya on TeX.SE.

LuaLaTeX is required.

Lemniscate envelope plot

Edit and compile if you like:
%!TEX lualatex
\pgfplotsset{width=\paperwidth, height=\paperheight}
  function getCenterRadius(t)
    a = 1;
    b = 1;
    h = 0;
    k = 0;
    cX = a*(1/math.cos(t)) + h;
    cY = b*math.tan(t) + k;
    R = math.sqrt((cX-h)^2 + (cY-k)^2) -- Classic
    return cX, cY, R
  function printHyperbola()
    for t=-1.56,1.56,0.02555 do
        xL,yL,RL = getCenterRadius(t)
        xR,yR,RR = getCenterRadius(3.1415+t)
        tex.sprint("\\draw[very thin] (axis cs:"..(xL)..","..(yL)..") circle("..(RL*10)..");")
        tex.sprint("\\draw[very thin] (axis cs:"..(xR)..","..(yR)..") circle("..(RR*10)..");")
    \begin{axis}[xmin=-14.85, xmax=14.85, ymin=-10.5, ymax=10.5,
      hide axis,
Click to download: lemniscate-envelope.texlemniscate-envelope.pdf