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

How does Firefox know my ISP login page?

Is there a historical explanation as to why the USA people are so litigious compared to France?

Why was the wedding ring missing during the twist of The Sixth Sense

Front hydraulic disk brake is too powerful on MTB — solutions?

How can I turn on Adventure Sync?

How is Smough's name pronounced?

Can you set fire to beer barrels?

My Villain scrys on the party, but I forgot about the sensor!

Advisor asked my whole slide presentation so she could give the presentation at international conference

Rule of thumb: how far before changing my chain to prevent cassette wear

What is the name for a fluid transition between two tones? When did it first appear?

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

How to print and use a command output in a one-liner?

How was the boat murder performed?

Incorrect mmap behavior when assembly files included in the project

Is the algebra of compact operators flat?

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

3-prong to 4-prong conversion - EXTRA MISLABELLED WIRES - Dryer cable upgrade and installation

I got this nail stuck in my tire, should I plug or replace?

Is it now possible to undetectably cross the Arctic Ocean on ski/kayak?

How to see time in ~/.bash_history file

How to protect my Wi-Fi password from being displayed by Android phones when sharing it with QR code?

Wrap the real right around the trigonometric circle (Metapost)

Can digital computers understand infinity?



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
usepackageluatex85
usepackageluamplib
begindocument
mplibtextextlabelenable
beginmplibcode

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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
label.urt(btex $-fracpi2$ 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 $fracpi2$ 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;
endmplibcode
enddocument


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
    usepackageluatex85
    usepackageluamplib
    begindocument
    mplibtextextlabelenable
    beginmplibcode

    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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
    label.urt(btex $-fracpi2$ 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 $fracpi2$ 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;
    endmplibcode
    enddocument


    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
      usepackageluatex85
      usepackageluamplib
      begindocument
      mplibtextextlabelenable
      beginmplibcode

      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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
      label.urt(btex $-fracpi2$ 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 $fracpi2$ 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;
      endmplibcode
      enddocument


      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
      usepackageluatex85
      usepackageluamplib
      begindocument
      mplibtextextlabelenable
      beginmplibcode

      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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
      label.urt(btex $-fracpi2$ 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 $fracpi2$ 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;
      endmplibcode
      enddocument


      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 8 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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-fracpi2$ 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 $fracpi2$ etex,pi/2);
          labeled(btex $-fracpi2$ 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
          usepackageluatex85
          usepackageluamplib
          begindocument
          mplibtextextlabelenable
          beginmplibcode

          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.5emhfill$pi$ etex,pi);
          labeled(btex hbox to 1.5emhfill$1$ etex,1);
          labeled(btex hbox to 1.5emhfill$2pi$ etex,2pi);
          labeled(btex hbox to 1.5emhfill$fracpi2$ etex,pi/2);
          labeled(btex hbox to 1.5emhfill$-fracpi2$ 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 $fracpi2$ etex, point 2 of C);

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

          endfig;
          endmplibcode
          enddocument


          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
            2 hours ago











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

            – Fabrice
            2 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
            1 hour ago











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

            – Fabrice
            1 hour 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
            1 hour 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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-fracpi2$ 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 $fracpi2$ etex,pi/2);
          labeled(btex $-fracpi2$ 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
          usepackageluatex85
          usepackageluamplib
          begindocument
          mplibtextextlabelenable
          beginmplibcode

          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.5emhfill$pi$ etex,pi);
          labeled(btex hbox to 1.5emhfill$1$ etex,1);
          labeled(btex hbox to 1.5emhfill$2pi$ etex,2pi);
          labeled(btex hbox to 1.5emhfill$fracpi2$ etex,pi/2);
          labeled(btex hbox to 1.5emhfill$-fracpi2$ 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 $fracpi2$ etex, point 2 of C);

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

          endfig;
          endmplibcode
          enddocument


          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
            2 hours ago











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

            – Fabrice
            2 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
            1 hour ago











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

            – Fabrice
            1 hour 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
            1 hour 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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-fracpi2$ 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 $fracpi2$ etex,pi/2);
          labeled(btex $-fracpi2$ 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
          usepackageluatex85
          usepackageluamplib
          begindocument
          mplibtextextlabelenable
          beginmplibcode

          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.5emhfill$pi$ etex,pi);
          labeled(btex hbox to 1.5emhfill$1$ etex,1);
          labeled(btex hbox to 1.5emhfill$2pi$ etex,2pi);
          labeled(btex hbox to 1.5emhfill$fracpi2$ etex,pi/2);
          labeled(btex hbox to 1.5emhfill$-fracpi2$ 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 $fracpi2$ etex, point 2 of C);

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

          endfig;
          endmplibcode
          enddocument


          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
            2 hours ago











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

            – Fabrice
            2 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
            1 hour ago











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

            – Fabrice
            1 hour 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
            1 hour 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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-fracpi2$ 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 $fracpi2$ etex,pi/2);
          labeled(btex $-fracpi2$ 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
          usepackageluatex85
          usepackageluamplib
          begindocument
          mplibtextextlabelenable
          beginmplibcode

          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.5emhfill$pi$ etex,pi);
          labeled(btex hbox to 1.5emhfill$1$ etex,1);
          labeled(btex hbox to 1.5emhfill$2pi$ etex,2pi);
          labeled(btex hbox to 1.5emhfill$fracpi2$ etex,pi/2);
          labeled(btex hbox to 1.5emhfill$-fracpi2$ 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 $fracpi2$ etex, point 2 of C);

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

          endfig;
          endmplibcode
          enddocument


          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 $fracpi2$ etex,(xpart point 0 of C,u*(pi/2)));
          label.urt(btex $-fracpi2$ 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 $fracpi2$ etex,pi/2);
          labeled(btex $-fracpi2$ 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
          usepackageluatex85
          usepackageluamplib
          begindocument
          mplibtextextlabelenable
          beginmplibcode

          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.5emhfill$pi$ etex,pi);
          labeled(btex hbox to 1.5emhfill$1$ etex,1);
          labeled(btex hbox to 1.5emhfill$2pi$ etex,2pi);
          labeled(btex hbox to 1.5emhfill$fracpi2$ etex,pi/2);
          labeled(btex hbox to 1.5emhfill$-fracpi2$ 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 $fracpi2$ etex, point 2 of C);

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

          endfig;
          endmplibcode
          enddocument


          enter image description here







          share|improve this answer















          share|improve this answer




          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 3 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
            2 hours ago











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

            – Fabrice
            2 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
            1 hour ago











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

            – Fabrice
            1 hour 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
            1 hour 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
            2 hours ago











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

            – Fabrice
            2 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
            1 hour ago











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

            – Fabrice
            1 hour 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
            1 hour 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
          2 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
          2 hours ago













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

          – Fabrice
          2 hours ago





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

          – Fabrice
          2 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
          1 hour 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
          1 hour ago













          "and add some alignment to the labels " How ?

          – Fabrice
          1 hour ago






          "and add some alignment to the labels " How ?

          – Fabrice
          1 hour 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
          1 hour 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
          1 hour 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

          Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

          Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

          François Viète Contents Biography Work and thought Bibliography See also Notes Further reading External links Navigation menup. 21Google Bookspp. 75–77Google BooksDe thou (from University of Saint Andrews)ArchivedGoogle BooksGoogle BooksGoogle BooksGoogle booksGoogle Bookscc-parthenay.frL'histoire universelle (fr)Universal History (en)ArchivedAdsabs.harvard.eduPagesperso-orange.frArchive.orgChikara Sasaki. Descartes' mathematical thought p.259Google BooksGoogle BooksGoogle Bookspp. 152 and onwardGoogle BooksGoogle BooksScribd.comGoogle Books1257-7979Google BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGoogle BooksGallica.bnf.frGoogle BooksGoogle Books"François Viète"Francois Viète: Father of Modern Algebraic NotationThe Lawyer and the GamblerAbout TarporleySite de Jean-Paul GuichardL'algèbre nouvelle"About the Harmonicon"cb120511976(data)1188044800000 0001 0913 5903n82164680ola2013766880073431702w6vt1sb70287374827140948071409480