summaryrefslogtreecommitdiff
path: root/info/drawing-with-metapost/src/func-lemniscate.mp
blob: cf56cede6b79abc406e28ff0d8ea262edf7347d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
\documentclass{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1); 
numeric a, c; c = 100; a = sqrt(2) * c;
vardef f(expr x) = a * cosd(x) / (1 + sind(x) ** 2) enddef;
vardef g(expr x) = f(x) * sind(x) enddef;
numeric mint, maxt, s; mint = 0; s = 30; maxt = 360;
path p; 
p = for t = mint step s until maxt - s: 
    (f(t), g(t)) ...
endfor cycle;
draw p withcolor 3/4 blue;
path xx, yy;
xx = (left -- right) scaled 150;
yy = (down -- up) scaled 55;
drawarrow xx; label.rt("$x$", point 1 of xx);
drawarrow yy; label.top("$y$", point 1 of yy);
dotlabel.bot("$F_1$", c * left);
dotlabel.bot("$F_2$", c * right);
endfig;
\end{mplibcode}
\end{document}