Example: Lemniscate envelope

Published 2014-03-18 | Author: Pouya

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, so currrently it doesn't run with writeLaTeX, but you can run it on your own computer: just use lualatex instead of pdflatex.

Download as: [PDF] [TEX]  •  [Open in Overleaf]

Lemniscate envelope

Do you have a question regarding this example, TikZ or LaTeX in general? Just ask in the LaTeX Forum.
Oder frag auf Deutsch auf TeXwelt.de.

\documentclass{article}
\usepackage[margin=0cm,a5paper,landscape]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=\paperwidth, height=\paperheight}
\usepackage{luacode}
\begin{luacode*}
  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
  end
  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)..");")
    end
  end
\end{luacode*}
\begin{document}
\noindent
  \begin{tikzpicture}
    \begin{axis}[xmin=-14.85, xmax=14.85, ymin=-10.5, ymax=10.5,
      hide axis,
    ]
    \directlua{printHyperbola()}
    \end{axis}
\end{tikzpicture}
\end{document}

Comments

Adding comments is currently not enabled.

There are currently 0 comments on this entry.

Features
Tags
Scientific and technical areas

Creative Commons License