summaryrefslogtreecommitdiff
path: root/info/drawing-with-metapost/src/curves-hyperbola-function.mp
blob: d13ae0c09fa92a576f5c8da41316e451cb09e5a1 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
beginfig(1);
    numeric alpha; alpha = 34;
    transform t;
    origin transformed t = origin;
    right transformed t = dir -alpha;
    up transformed t = dir alpha;

    path xx, yy;
    xx = (origin--right) scaled 144;
    yy = (origin--up) scaled 144;

    numeric a, s; s = 1/64; a = 3/2;
    path hh;
    for x = 8 * a * s step s until 8/a:
        hh := if known hh: hh ... fi (a * x, a / x);
    endfor;
    hh := hh scaled 16;     
    path C; C = fullcircle scaled 2a scaled sqrt(2) scaled 16;
    pair F; F = (xpart point 0 of C, ypart point 2 of C);

    interim ahangle := 30;
    picture P[];
    P1 = image(
        draw point 0 of C -- F -- point 2 of C withcolor 3/4[blue, white];
        draw subpath (-1/2, 5/2) of C withcolor 3/4[blue, white];
        drawarrow xx withcolor 1/2;
        drawarrow yy withcolor 1/2;
        draw hh withcolor 2/3 red;  dotlabel.urt("$S$", F);
    );
    P2 = image(
        hh := hh transformed t;
        C := fullcircle scaled 2 abs(point directiontime down of hh of hh);
        F := F rotated -45;
        (p, whatever) = C intersectiontimes (fullcircle scaled abs(F) shifted 1/2 F);
        draw point p of C -- F -- point -p of C withcolor 3/4[blue, white];
        draw subpath (-alpha/30, alpha/30) of C withcolor 3/4[blue, white];
        drawarrow xx transformed t withcolor 1/2;
        drawarrow yy transformed t withcolor 1/2;
        draw hh withcolor 2/3 red;  
        dotlabel.urt("$S$", F);
    );

    label.lft(P1, 10 left);
    label.rt(P2, 10 right);



    %path C;
    %C = fullcircle scaled 4 cosd(alpha) scaled 32a ; 
    %draw C withcolor 1/2;

    %pair S;
    %S = whatever[precontrol +alpha/45 of C, postcontrol +alpha/45 of C]
    %  = whatever[precontrol -alpha/45 of C, postcontrol -alpha/45 of C];
    %draw (64a * right) withpen pencircle scaled 3 withcolor 3/4[blue, white];
    %draw S withpen pencircle scaled 3/2 withcolor red;

    %draw hh withcolor 2/3 red;
    %%draw hh rotated 180 withcolor 2/3 red;

    %% path t;
    %% t = point 4 of hh -- point 80 of hh -- point 400 of hh -- cycle;
    
    %% pair a, b, c;
    %% a = whatever[point 0 of t, point 1 of t]; point 2 of t - a = whatever * (point 0 of t-point 1 of t) rotated 90;
    %% b = whatever[point 2 of t, point 1 of t]; point 0 of t - b = whatever * (point 2 of t-point 1 of t) rotated 90;

    %% draw t;  c = whatever[point 2 of t, a] = whatever[point 0 of t, b];

    %% draw c withpen pencircle scaled 3;



endfig;
\end{mplibcode}
\end{document}