Wrap the real right around the trigonometric circle (Metapost)metapost macro for drawing filled circle not...

What does the British parliament hope to achieve by requesting a third Brexit extension?

Usefulness of Nash embedding theorem

How can a "proper" function have a vertical slope?

Why isn't Hagrid removed from Hogwarts sooner in Harry's would-be 7th year?

What do you call a document which has no content?

Armory Automaton and Dowsing Dagger/Sword of the Animist

Can there be an atomic nucleus where there are more protons than neutrons?

How does Firefox know my ISP login page?

Why do Computer Science degrees contain a high proportion of mathematics?

Satellite for internet... Safe enough?

Why is the empennage design of this Lockheed 1049E so complicated?

Does an excessive table violate normalization rules?

Any Issues with running Workbench 1.3 on a Kickstart 1.2 Amiga 500?

"inuendo" in a piano score

Will Schnorr Multi-signatures completely replace ECDSA?

Why does b+=(4,) work and b = b + (4,) doesn't work when b is a list?

What does すきすき mean here?

Why does Sonny say they call Michael "Giogali"?

Paper status "Accept with Shepherd". What does it really mean?

Wrap the real right around the trigonometric circle (Metapost)

A fast aquatic predator with multiple eyes and pupils. Would these eyes be possible?

Anatomically Correct Baku

What does this text mean with capitalized letters?

Text on old-fashioned differential geometry



Wrap the real right around the trigonometric circle (Metapost)


metapost macro for drawing filled circle not workingPutting circle into a right triangleFull colored Triangle and Circle in MetapostThe array name rule in metapostMetapost won't compile from the command linereal MetaPost spaceHow to use Metapost to draw right-hand rule of structural mechanicsMetapost: get the radius of circle boxThe Metapost path fullcircleHow to draw the intersection of a circle and a path in METAPOST






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{
margin-bottom:0;
}








4

















I am trying to reproduce this figure but I have the impression that alpha does not correspond to the length of the path subpath (0,1.3) of p and that the value -pi/2 is not correct.



  documentclass[border=5mm]{standalone}
usepackage{luatex85}
usepackage{luamplib}
begin{document}
mplibtextextlabel{enable}
begin{mplibcode}

beginfig(1);

numeric u, pi;
u = 10mm;
pi = 3.141592654;

path C, T, xx, yy;

C = fullcircle scaled 5u;

xx = (point 4 of C -- point 0 of C) scaled 1.1;
yy = (point 6 of C -- point 2 of C) scaled 1.1;

T = ((xpart point 0 of C,200) -- (xpart point 0 of C,-200));

numeric l;
l = length subpath(0,1.3) of C;

draw xx;
draw yy;
draw C withpen pencircle scaled 3/4;
draw origin -- (point 1.2 of C) withcolor blue;
draw subpath(0,1.2) of C withcolor blue;
draw T withcolor red;

label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
label.urt("$M$", point 1.3 of C);
label.llft("$O$", origin);
label.lrt("$I$", point 0 of C);
label.ulft("$J$", point 2 of C);
label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

fill fullcircle scaled dotlabeldiam
shifted (xpart point 1.2 of C, ypart point 1.2 of C)
withcolor blue;

endfig;
end{mplibcode}
end{document}


enter image description here










share|improve this question

































    4

















    I am trying to reproduce this figure but I have the impression that alpha does not correspond to the length of the path subpath (0,1.3) of p and that the value -pi/2 is not correct.



      documentclass[border=5mm]{standalone}
    usepackage{luatex85}
    usepackage{luamplib}
    begin{document}
    mplibtextextlabel{enable}
    begin{mplibcode}

    beginfig(1);

    numeric u, pi;
    u = 10mm;
    pi = 3.141592654;

    path C, T, xx, yy;

    C = fullcircle scaled 5u;

    xx = (point 4 of C -- point 0 of C) scaled 1.1;
    yy = (point 6 of C -- point 2 of C) scaled 1.1;

    T = ((xpart point 0 of C,200) -- (xpart point 0 of C,-200));

    numeric l;
    l = length subpath(0,1.3) of C;

    draw xx;
    draw yy;
    draw C withpen pencircle scaled 3/4;
    draw origin -- (point 1.2 of C) withcolor blue;
    draw subpath(0,1.2) of C withcolor blue;
    draw T withcolor red;

    label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
    label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
    label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
    label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
    label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
    label.urt("$M$", point 1.3 of C);
    label.llft("$O$", origin);
    label.lrt("$I$", point 0 of C);
    label.ulft("$J$", point 2 of C);
    label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

    fill fullcircle scaled dotlabeldiam
    shifted (xpart point 1.2 of C, ypart point 1.2 of C)
    withcolor blue;

    endfig;
    end{mplibcode}
    end{document}


    enter image description here










    share|improve this question





























      4












      4








      4








      I am trying to reproduce this figure but I have the impression that alpha does not correspond to the length of the path subpath (0,1.3) of p and that the value -pi/2 is not correct.



        documentclass[border=5mm]{standalone}
      usepackage{luatex85}
      usepackage{luamplib}
      begin{document}
      mplibtextextlabel{enable}
      begin{mplibcode}

      beginfig(1);

      numeric u, pi;
      u = 10mm;
      pi = 3.141592654;

      path C, T, xx, yy;

      C = fullcircle scaled 5u;

      xx = (point 4 of C -- point 0 of C) scaled 1.1;
      yy = (point 6 of C -- point 2 of C) scaled 1.1;

      T = ((xpart point 0 of C,200) -- (xpart point 0 of C,-200));

      numeric l;
      l = length subpath(0,1.3) of C;

      draw xx;
      draw yy;
      draw C withpen pencircle scaled 3/4;
      draw origin -- (point 1.2 of C) withcolor blue;
      draw subpath(0,1.2) of C withcolor blue;
      draw T withcolor red;

      label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
      label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
      label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
      label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
      label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
      label.urt("$M$", point 1.3 of C);
      label.llft("$O$", origin);
      label.lrt("$I$", point 0 of C);
      label.ulft("$J$", point 2 of C);
      label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

      fill fullcircle scaled dotlabeldiam
      shifted (xpart point 1.2 of C, ypart point 1.2 of C)
      withcolor blue;

      endfig;
      end{mplibcode}
      end{document}


      enter image description here










      share|improve this question














      I am trying to reproduce this figure but I have the impression that alpha does not correspond to the length of the path subpath (0,1.3) of p and that the value -pi/2 is not correct.



        documentclass[border=5mm]{standalone}
      usepackage{luatex85}
      usepackage{luamplib}
      begin{document}
      mplibtextextlabel{enable}
      begin{mplibcode}

      beginfig(1);

      numeric u, pi;
      u = 10mm;
      pi = 3.141592654;

      path C, T, xx, yy;

      C = fullcircle scaled 5u;

      xx = (point 4 of C -- point 0 of C) scaled 1.1;
      yy = (point 6 of C -- point 2 of C) scaled 1.1;

      T = ((xpart point 0 of C,200) -- (xpart point 0 of C,-200));

      numeric l;
      l = length subpath(0,1.3) of C;

      draw xx;
      draw yy;
      draw C withpen pencircle scaled 3/4;
      draw origin -- (point 1.2 of C) withcolor blue;
      draw subpath(0,1.2) of C withcolor blue;
      draw T withcolor red;

      label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
      label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
      label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
      label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
      label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
      label.urt("$M$", point 1.3 of C);
      label.llft("$O$", origin);
      label.lrt("$I$", point 0 of C);
      label.ulft("$J$", point 2 of C);
      label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

      fill fullcircle scaled dotlabeldiam
      shifted (xpart point 1.2 of C, ypart point 1.2 of C)
      withcolor blue;

      endfig;
      end{mplibcode}
      end{document}


      enter image description here







      metapost






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question



      share|improve this question










      asked 10 hours ago









      FabriceFabrice

      1,5491 gold badge11 silver badges23 bronze badges




      1,5491 gold badge11 silver badges23 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          5


















          For the labels on your y-axis, you use



          label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
          label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
          label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
          label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
          label.urt("$M$", point 1.3 of C);`


          First, this has a lot of repetitions which makes it hard to adjust, so let's move this into a macro:



          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.urt(t, p);
          enddef;

          labeled(btex $pi$ etex,pi);
          labeled(btex $1$ etex,1);
          labeled(btex $2pi$ etex,2pi);
          labeled(btex $frac{pi}{2}$ etex,pi/2);
          labeled(btex $-frac{pi}{2}$ etex,-pi/2);



          Now we can add little red lines to indicate the exact positions: Add



          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0)  withcolor red;


          to labeled. This gives
          enter image description here



          Now we see why -pi/2 seemed to be in a odd position and not symmetric to pi/2:
          label.urt places the label in an upper right position and therefore moves all labels a bit up. We can use label.rt in labeled instead to avoid this:
          enter image description here



          Now the axis still looks odd: The drawing seems to illustrate the correspondence between the length of the circular arc and the angle in radians, so it only works if the radius of the circle is 1 unit. So we change C = fullcircle scaled 5u; to C = fullcircle scaled 2u; (The diameter should be 2u) This make the entire diagram quite small, so we could also increase u. Our new figure is
          enter image description here



          Now we want to add alpha. First we calculate alpha by asking for the length of the arc (arclength) of the path you are interested in (I use 1.2 instead of 1.3 because that is the path you actually used in your code):



          alpha*u = arclength subpath(0,1.2) of C;


          Then we can add



          labeled(btex $alpha$ etex, alpha);


          enter image description here



          It turns out that this arc has a length slightly below 1, so let's use subpath(0, 1.4) instead to make it look a bit more like your original:
          enter image description here



          Now wwe can make everything a bit bigger and add some alignment to the labels to get:



          documentclass[border=5mm]{standalone}
          usepackage{luatex85}
          usepackage{luamplib}
          begin{document}
          mplibtextextlabel{enable}
          begin{mplibcode}

          beginfig(1);

          numeric u, pi;
          u = 20mm;
          pi = 3.141592654;

          path C, T, xx, yy;

          C = fullcircle scaled 2u;

          xx = (point 4 of C -- point 0 of C) scaled 1.1;
          yy = (point 6 of C -- point 2 of C) scaled 1.1;

          T = ((xpart point 0 of C,6.5u) -- (xpart point 0 of C,-2u));

          alpha*u = arclength subpath(0,1.4) of C;

          draw xx;
          draw yy;
          draw C withpen pencircle scaled 3/4;
          draw origin -- (point 1.4 of C) withcolor blue;
          draw subpath(0,1.4) of C withcolor blue;
          draw T withcolor red;

          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.rt(t, p);
          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0) withcolor red;
          enddef;

          labeled(btex $alpha$ etex,alpha);
          labeled(btex hbox to 1.5em{hfill$pi$} etex,pi);
          labeled(btex hbox to 1.5em{hfill$1$} etex,1);
          labeled(btex hbox to 1.5em{hfill$2pi$} etex,2pi);
          labeled(btex hbox to 1.5em{hfill$frac{pi}{2}$} etex,pi/2);
          labeled(btex hbox to 1.5em{hfill$-frac{pi}{2}$} etex,-pi/2);
          label.urt("$M$", point 1.4 of C);
          label.llft("$O$", origin);
          label.lrt("$I$", point 0 of C);
          label.ulft("$J$", point 2 of C);
          label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

          fill fullcircle scaled dotlabeldiam
          shifted point 1.4 of C
          withcolor blue;

          endfig;
          end{mplibcode}
          end{document}


          enter image description here






          share|improve this answer





























          • Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

            – Fabrice
            5 hours ago











          • In the macro p = (xpart point 0 of C, u*y);

            – Fabrice
            4 hours ago











          • I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

            – Marcel Krüger
            4 hours ago











          • "and add some alignment to the labels " How ?

            – Fabrice
            4 hours ago













          • @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

            – Marcel Krüger
            4 hours ago













          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "85"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });















          draft saved

          draft discarded
















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f511300%2fwrap-the-real-right-around-the-trigonometric-circle-metapost%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown


























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          5


















          For the labels on your y-axis, you use



          label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
          label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
          label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
          label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
          label.urt("$M$", point 1.3 of C);`


          First, this has a lot of repetitions which makes it hard to adjust, so let's move this into a macro:



          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.urt(t, p);
          enddef;

          labeled(btex $pi$ etex,pi);
          labeled(btex $1$ etex,1);
          labeled(btex $2pi$ etex,2pi);
          labeled(btex $frac{pi}{2}$ etex,pi/2);
          labeled(btex $-frac{pi}{2}$ etex,-pi/2);



          Now we can add little red lines to indicate the exact positions: Add



          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0)  withcolor red;


          to labeled. This gives
          enter image description here



          Now we see why -pi/2 seemed to be in a odd position and not symmetric to pi/2:
          label.urt places the label in an upper right position and therefore moves all labels a bit up. We can use label.rt in labeled instead to avoid this:
          enter image description here



          Now the axis still looks odd: The drawing seems to illustrate the correspondence between the length of the circular arc and the angle in radians, so it only works if the radius of the circle is 1 unit. So we change C = fullcircle scaled 5u; to C = fullcircle scaled 2u; (The diameter should be 2u) This make the entire diagram quite small, so we could also increase u. Our new figure is
          enter image description here



          Now we want to add alpha. First we calculate alpha by asking for the length of the arc (arclength) of the path you are interested in (I use 1.2 instead of 1.3 because that is the path you actually used in your code):



          alpha*u = arclength subpath(0,1.2) of C;


          Then we can add



          labeled(btex $alpha$ etex, alpha);


          enter image description here



          It turns out that this arc has a length slightly below 1, so let's use subpath(0, 1.4) instead to make it look a bit more like your original:
          enter image description here



          Now wwe can make everything a bit bigger and add some alignment to the labels to get:



          documentclass[border=5mm]{standalone}
          usepackage{luatex85}
          usepackage{luamplib}
          begin{document}
          mplibtextextlabel{enable}
          begin{mplibcode}

          beginfig(1);

          numeric u, pi;
          u = 20mm;
          pi = 3.141592654;

          path C, T, xx, yy;

          C = fullcircle scaled 2u;

          xx = (point 4 of C -- point 0 of C) scaled 1.1;
          yy = (point 6 of C -- point 2 of C) scaled 1.1;

          T = ((xpart point 0 of C,6.5u) -- (xpart point 0 of C,-2u));

          alpha*u = arclength subpath(0,1.4) of C;

          draw xx;
          draw yy;
          draw C withpen pencircle scaled 3/4;
          draw origin -- (point 1.4 of C) withcolor blue;
          draw subpath(0,1.4) of C withcolor blue;
          draw T withcolor red;

          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.rt(t, p);
          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0) withcolor red;
          enddef;

          labeled(btex $alpha$ etex,alpha);
          labeled(btex hbox to 1.5em{hfill$pi$} etex,pi);
          labeled(btex hbox to 1.5em{hfill$1$} etex,1);
          labeled(btex hbox to 1.5em{hfill$2pi$} etex,2pi);
          labeled(btex hbox to 1.5em{hfill$frac{pi}{2}$} etex,pi/2);
          labeled(btex hbox to 1.5em{hfill$-frac{pi}{2}$} etex,-pi/2);
          label.urt("$M$", point 1.4 of C);
          label.llft("$O$", origin);
          label.lrt("$I$", point 0 of C);
          label.ulft("$J$", point 2 of C);
          label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

          fill fullcircle scaled dotlabeldiam
          shifted point 1.4 of C
          withcolor blue;

          endfig;
          end{mplibcode}
          end{document}


          enter image description here






          share|improve this answer





























          • Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

            – Fabrice
            5 hours ago











          • In the macro p = (xpart point 0 of C, u*y);

            – Fabrice
            4 hours ago











          • I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

            – Marcel Krüger
            4 hours ago











          • "and add some alignment to the labels " How ?

            – Fabrice
            4 hours ago













          • @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

            – Marcel Krüger
            4 hours ago
















          5


















          For the labels on your y-axis, you use



          label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
          label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
          label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
          label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
          label.urt("$M$", point 1.3 of C);`


          First, this has a lot of repetitions which makes it hard to adjust, so let's move this into a macro:



          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.urt(t, p);
          enddef;

          labeled(btex $pi$ etex,pi);
          labeled(btex $1$ etex,1);
          labeled(btex $2pi$ etex,2pi);
          labeled(btex $frac{pi}{2}$ etex,pi/2);
          labeled(btex $-frac{pi}{2}$ etex,-pi/2);



          Now we can add little red lines to indicate the exact positions: Add



          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0)  withcolor red;


          to labeled. This gives
          enter image description here



          Now we see why -pi/2 seemed to be in a odd position and not symmetric to pi/2:
          label.urt places the label in an upper right position and therefore moves all labels a bit up. We can use label.rt in labeled instead to avoid this:
          enter image description here



          Now the axis still looks odd: The drawing seems to illustrate the correspondence between the length of the circular arc and the angle in radians, so it only works if the radius of the circle is 1 unit. So we change C = fullcircle scaled 5u; to C = fullcircle scaled 2u; (The diameter should be 2u) This make the entire diagram quite small, so we could also increase u. Our new figure is
          enter image description here



          Now we want to add alpha. First we calculate alpha by asking for the length of the arc (arclength) of the path you are interested in (I use 1.2 instead of 1.3 because that is the path you actually used in your code):



          alpha*u = arclength subpath(0,1.2) of C;


          Then we can add



          labeled(btex $alpha$ etex, alpha);


          enter image description here



          It turns out that this arc has a length slightly below 1, so let's use subpath(0, 1.4) instead to make it look a bit more like your original:
          enter image description here



          Now wwe can make everything a bit bigger and add some alignment to the labels to get:



          documentclass[border=5mm]{standalone}
          usepackage{luatex85}
          usepackage{luamplib}
          begin{document}
          mplibtextextlabel{enable}
          begin{mplibcode}

          beginfig(1);

          numeric u, pi;
          u = 20mm;
          pi = 3.141592654;

          path C, T, xx, yy;

          C = fullcircle scaled 2u;

          xx = (point 4 of C -- point 0 of C) scaled 1.1;
          yy = (point 6 of C -- point 2 of C) scaled 1.1;

          T = ((xpart point 0 of C,6.5u) -- (xpart point 0 of C,-2u));

          alpha*u = arclength subpath(0,1.4) of C;

          draw xx;
          draw yy;
          draw C withpen pencircle scaled 3/4;
          draw origin -- (point 1.4 of C) withcolor blue;
          draw subpath(0,1.4) of C withcolor blue;
          draw T withcolor red;

          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.rt(t, p);
          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0) withcolor red;
          enddef;

          labeled(btex $alpha$ etex,alpha);
          labeled(btex hbox to 1.5em{hfill$pi$} etex,pi);
          labeled(btex hbox to 1.5em{hfill$1$} etex,1);
          labeled(btex hbox to 1.5em{hfill$2pi$} etex,2pi);
          labeled(btex hbox to 1.5em{hfill$frac{pi}{2}$} etex,pi/2);
          labeled(btex hbox to 1.5em{hfill$-frac{pi}{2}$} etex,-pi/2);
          label.urt("$M$", point 1.4 of C);
          label.llft("$O$", origin);
          label.lrt("$I$", point 0 of C);
          label.ulft("$J$", point 2 of C);
          label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

          fill fullcircle scaled dotlabeldiam
          shifted point 1.4 of C
          withcolor blue;

          endfig;
          end{mplibcode}
          end{document}


          enter image description here






          share|improve this answer





























          • Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

            – Fabrice
            5 hours ago











          • In the macro p = (xpart point 0 of C, u*y);

            – Fabrice
            4 hours ago











          • I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

            – Marcel Krüger
            4 hours ago











          • "and add some alignment to the labels " How ?

            – Fabrice
            4 hours ago













          • @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

            – Marcel Krüger
            4 hours ago














          5














          5










          5









          For the labels on your y-axis, you use



          label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
          label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
          label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
          label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
          label.urt("$M$", point 1.3 of C);`


          First, this has a lot of repetitions which makes it hard to adjust, so let's move this into a macro:



          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.urt(t, p);
          enddef;

          labeled(btex $pi$ etex,pi);
          labeled(btex $1$ etex,1);
          labeled(btex $2pi$ etex,2pi);
          labeled(btex $frac{pi}{2}$ etex,pi/2);
          labeled(btex $-frac{pi}{2}$ etex,-pi/2);



          Now we can add little red lines to indicate the exact positions: Add



          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0)  withcolor red;


          to labeled. This gives
          enter image description here



          Now we see why -pi/2 seemed to be in a odd position and not symmetric to pi/2:
          label.urt places the label in an upper right position and therefore moves all labels a bit up. We can use label.rt in labeled instead to avoid this:
          enter image description here



          Now the axis still looks odd: The drawing seems to illustrate the correspondence between the length of the circular arc and the angle in radians, so it only works if the radius of the circle is 1 unit. So we change C = fullcircle scaled 5u; to C = fullcircle scaled 2u; (The diameter should be 2u) This make the entire diagram quite small, so we could also increase u. Our new figure is
          enter image description here



          Now we want to add alpha. First we calculate alpha by asking for the length of the arc (arclength) of the path you are interested in (I use 1.2 instead of 1.3 because that is the path you actually used in your code):



          alpha*u = arclength subpath(0,1.2) of C;


          Then we can add



          labeled(btex $alpha$ etex, alpha);


          enter image description here



          It turns out that this arc has a length slightly below 1, so let's use subpath(0, 1.4) instead to make it look a bit more like your original:
          enter image description here



          Now wwe can make everything a bit bigger and add some alignment to the labels to get:



          documentclass[border=5mm]{standalone}
          usepackage{luatex85}
          usepackage{luamplib}
          begin{document}
          mplibtextextlabel{enable}
          begin{mplibcode}

          beginfig(1);

          numeric u, pi;
          u = 20mm;
          pi = 3.141592654;

          path C, T, xx, yy;

          C = fullcircle scaled 2u;

          xx = (point 4 of C -- point 0 of C) scaled 1.1;
          yy = (point 6 of C -- point 2 of C) scaled 1.1;

          T = ((xpart point 0 of C,6.5u) -- (xpart point 0 of C,-2u));

          alpha*u = arclength subpath(0,1.4) of C;

          draw xx;
          draw yy;
          draw C withpen pencircle scaled 3/4;
          draw origin -- (point 1.4 of C) withcolor blue;
          draw subpath(0,1.4) of C withcolor blue;
          draw T withcolor red;

          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.rt(t, p);
          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0) withcolor red;
          enddef;

          labeled(btex $alpha$ etex,alpha);
          labeled(btex hbox to 1.5em{hfill$pi$} etex,pi);
          labeled(btex hbox to 1.5em{hfill$1$} etex,1);
          labeled(btex hbox to 1.5em{hfill$2pi$} etex,2pi);
          labeled(btex hbox to 1.5em{hfill$frac{pi}{2}$} etex,pi/2);
          labeled(btex hbox to 1.5em{hfill$-frac{pi}{2}$} etex,-pi/2);
          label.urt("$M$", point 1.4 of C);
          label.llft("$O$", origin);
          label.lrt("$I$", point 0 of C);
          label.ulft("$J$", point 2 of C);
          label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

          fill fullcircle scaled dotlabeldiam
          shifted point 1.4 of C
          withcolor blue;

          endfig;
          end{mplibcode}
          end{document}


          enter image description here






          share|improve this answer
















          For the labels on your y-axis, you use



          label.urt(btex $pi$ etex,(xpart point 0 of C,u*(pi)));
          label.urt(btex $1$ etex,(xpart point 0 of C,u*1));
          label.urt(btex $2pi$ etex,(xpart point 0 of C,u*(2pi)));
          label.urt(btex $frac{pi}{2}$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-frac{pi}{2}$ etex,(xpart point 0 of C,u*(-pi/2)));
          label.urt("$M$", point 1.3 of C);`


          First, this has a lot of repetitions which makes it hard to adjust, so let's move this into a macro:



          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.urt(t, p);
          enddef;

          labeled(btex $pi$ etex,pi);
          labeled(btex $1$ etex,1);
          labeled(btex $2pi$ etex,2pi);
          labeled(btex $frac{pi}{2}$ etex,pi/2);
          labeled(btex $-frac{pi}{2}$ etex,-pi/2);



          Now we can add little red lines to indicate the exact positions: Add



          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0)  withcolor red;


          to labeled. This gives
          enter image description here



          Now we see why -pi/2 seemed to be in a odd position and not symmetric to pi/2:
          label.urt places the label in an upper right position and therefore moves all labels a bit up. We can use label.rt in labeled instead to avoid this:
          enter image description here



          Now the axis still looks odd: The drawing seems to illustrate the correspondence between the length of the circular arc and the angle in radians, so it only works if the radius of the circle is 1 unit. So we change C = fullcircle scaled 5u; to C = fullcircle scaled 2u; (The diameter should be 2u) This make the entire diagram quite small, so we could also increase u. Our new figure is
          enter image description here



          Now we want to add alpha. First we calculate alpha by asking for the length of the arc (arclength) of the path you are interested in (I use 1.2 instead of 1.3 because that is the path you actually used in your code):



          alpha*u = arclength subpath(0,1.2) of C;


          Then we can add



          labeled(btex $alpha$ etex, alpha);


          enter image description here



          It turns out that this arc has a length slightly below 1, so let's use subpath(0, 1.4) instead to make it look a bit more like your original:
          enter image description here



          Now wwe can make everything a bit bigger and add some alignment to the labels to get:



          documentclass[border=5mm]{standalone}
          usepackage{luatex85}
          usepackage{luamplib}
          begin{document}
          mplibtextextlabel{enable}
          begin{mplibcode}

          beginfig(1);

          numeric u, pi;
          u = 20mm;
          pi = 3.141592654;

          path C, T, xx, yy;

          C = fullcircle scaled 2u;

          xx = (point 4 of C -- point 0 of C) scaled 1.1;
          yy = (point 6 of C -- point 2 of C) scaled 1.1;

          T = ((xpart point 0 of C,6.5u) -- (xpart point 0 of C,-2u));

          alpha*u = arclength subpath(0,1.4) of C;

          draw xx;
          draw yy;
          draw C withpen pencircle scaled 3/4;
          draw origin -- (point 1.4 of C) withcolor blue;
          draw subpath(0,1.4) of C withcolor blue;
          draw T withcolor red;

          vardef labeled (expr t, y) =
          save p; pair p;
          p = (xpart point 0 of C, y*u);
          label.rt(t, p);
          draw p shifted (-0.5mm, 0) -- p shifted (0.5mm, 0) withcolor red;
          enddef;

          labeled(btex $alpha$ etex,alpha);
          labeled(btex hbox to 1.5em{hfill$pi$} etex,pi);
          labeled(btex hbox to 1.5em{hfill$1$} etex,1);
          labeled(btex hbox to 1.5em{hfill$2pi$} etex,2pi);
          labeled(btex hbox to 1.5em{hfill$frac{pi}{2}$} etex,pi/2);
          labeled(btex hbox to 1.5em{hfill$-frac{pi}{2}$} etex,-pi/2);
          label.urt("$M$", point 1.4 of C);
          label.llft("$O$", origin);
          label.lrt("$I$", point 0 of C);
          label.ulft("$J$", point 2 of C);
          label.urt(btex $frac{pi}{2}$ etex, point 2 of C);

          fill fullcircle scaled dotlabeldiam
          shifted point 1.4 of C
          withcolor blue;

          endfig;
          end{mplibcode}
          end{document}


          enter image description here







          share|improve this answer















          share|improve this answer




          share|improve this answer



          share|improve this answer








          edited 4 hours ago

























          answered 5 hours ago









          Marcel KrügerMarcel Krüger

          16.1k1 gold badge19 silver badges40 bronze badges




          16.1k1 gold badge19 silver badges40 bronze badges
















          • Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

            – Fabrice
            5 hours ago











          • In the macro p = (xpart point 0 of C, u*y);

            – Fabrice
            4 hours ago











          • I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

            – Marcel Krüger
            4 hours ago











          • "and add some alignment to the labels " How ?

            – Fabrice
            4 hours ago













          • @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

            – Marcel Krüger
            4 hours ago



















          • Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

            – Fabrice
            5 hours ago











          • In the macro p = (xpart point 0 of C, u*y);

            – Fabrice
            4 hours ago











          • I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

            – Marcel Krüger
            4 hours ago











          • "and add some alignment to the labels " How ?

            – Fabrice
            4 hours ago













          • @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

            – Marcel Krüger
            4 hours ago

















          Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

          – Fabrice
          5 hours ago





          Thank you very much, I start with Metapost and I still have a lot to learn. If I dared, because I'm short of time, how to add the trajectories of the points ?

          – Fabrice
          5 hours ago













          In the macro p = (xpart point 0 of C, u*y);

          – Fabrice
          4 hours ago





          In the macro p = (xpart point 0 of C, u*y);

          – Fabrice
          4 hours ago













          I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

          – Marcel Krüger
          4 hours ago





          I'm not sure which trajectories you mean. The green line continuing to the left? I'm not even quite sure what it represents, so I also can't really tell you how to draw it.

          – Marcel Krüger
          4 hours ago













          "and add some alignment to the labels " How ?

          – Fabrice
          4 hours ago







          "and add some alignment to the labels " How ?

          – Fabrice
          4 hours ago















          @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

          – Marcel Krüger
          4 hours ago





          @Fabrice Oh sorry, I forgot to add the final code. Fixed that now, but basically I aligned them by just putting them into a right aligned hbox in TeX.

          – Marcel Krüger
          4 hours ago



















          draft saved

          draft discarded



















































          Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f511300%2fwrap-the-real-right-around-the-trigonometric-circle-metapost%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown









          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...