2

Is the MetaPost path fullcircle cyclic?

I attempted to find the answer in "METAPOST - A User's Manual" but had no luck.

UPDATE:

show cycle fullcircle;

will print the answer true.

  • 2
    How do you mean? Have you tried. Afair a closed curve in mp is cyclic as in you can go around as many times you want. (though I don't use metapost that much any more) – daleif Dec 30 '18 at 21:36
  • I know that there is an operator cycle, but I don't know how to print the result of cycle fullcircle. – soegaard Dec 30 '18 at 21:37
  • 1
    Draw a point at certain times on the curve. Afair fullcircle goes 0 1 2 3 4 0, as in (assuming complex plane), 1, I, -1, -i, 1. So at time 2 it is at (-1,0). – daleif Dec 30 '18 at 21:40
  • 2
    Perhaps you should explain why you need to know if a given path is closed? What do you need this information for? – daleif Dec 30 '18 at 21:46
  • 1
    Tak for tippet. – soegaard Dec 30 '18 at 22:34
5

A path such as

(0,0)..(1,0)..(1,1)..(0,1)..(0,0)

is open. You can check this by doing

*path p;

*p:=(0,0)..(1,0)..(1,1)..(0,1)..(0,0);

*show point 3 of p;
>> (0,1)
*show point 3.5 of p;
>> (-0.20709,0.49998)
*show point 4 of p;
>> (0,0)
*show point 4.1 of p;
>> (0,0)
*show point 10 of p;
>> (0,0)
*show point 12 of p;
>> (0,0)

On the other hand, we can see

*p:=(0,0)..(1,0)..(1,1)..(0,1)..cycle;

*show point 3 of p;
>> (0,1)
*show point 3.5 of p;
>> (-0.20709,0.49998)
*show point 4 of p;
>> (0,0)
*show point 4.1 of p;
>> (0.08765,-0.07457)
*show point 10 of p;
>> (1,1)
*show point 12 of p;
>> (0,0)

Going on:

*p:=(0,0)..(1,0)..(1,1)..(0,1)..(0,0);

*show cycle p;
>> false
*p:=(0,0)..(1,0)..(1,1)..(0,1)..cycle;

*show cycle p;
>> true

You can get the definition of fullcircle:

*show fullcircle;
>> Path at line 0:
(0.5,0)..controls (0.5,0.13261) and (0.44731,0.25978)
 ..(0.35355,0.35355)..controls (0.25978,0.44731) and (0.13261,0.5)
 ..(0,0.5)..controls (-0.13261,0.5) and (-0.25978,0.44731)
 ..(-0.35355,0.35355)..controls (-0.44731,0.25978) and (-0.5,0.13261)
 ..(-0.5,0)..controls (-0.5,-0.13261) and (-0.44731,-0.25978)
 ..(-0.35355,-0.35355)..controls (-0.25978,-0.44731) and (-0.13261,-0.5)
 ..(0,-0.5)..controls (0.13261,-0.5) and (0.25978,-0.44731)
 ..(0.35355,-0.35355)..controls (0.44731,-0.25978) and (0.5,-0.13261)
 ..cycle

and this is cyclic.

Actually you don't find the definition in plain.mp, because fullcircle is defined by fullcircle = makepath pencircle;, but when the path has been built it can be shown.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.