Keith McKay schrieb am 07.12.2024 um 13:29:

Hi Wolfgang

I thought using the metapost variable tcircle as a pen would work but for some reason it does not give rounded corners for the square in the first MPpage. Not a solution unfortunately.

Best Wishes

Keith

path Tcircle; Tcircle := tcircle;

draw Tcircle scaled 20 shifted(0,24) withcolor red;

pen TcirclePen ; TcirclePen := makepen Tcircle ;

draw ((0,1) -- (1,1)) scaled 10 withpen TcirclePen shifted (12,12) withcolor red;

draw ((0,0) -- (0,1)) scaled 10 withpen TcirclePen rotated 90 shifted (12,12) withcolor red;

draw ((1,0) -- (1,1)) scaled 10 withpen TcirclePen rotated 270 shifted (12,12) withcolor red;

draw ((0,0) -- (1,0)) scaled 10 withpen TcirclePen rotated 180 shifted (12,12) withcolor red;


This is the first thing I tried but it doesn't work with pens.

The following example shows how the curve gets rounder with the number of steps.

\starttext

\doloopoverlist
  {90,60,45,30,20,15,10,5,1}
  {\recursestring:
   \startMPcode
    draw ((-1cm,0)--(5cm,0)) shifted (0,1cm) withcolor (1,0,0);
    pen testpen ; testpen := makepen ((1,0){up} for i = 1 step \recursestring\space until 181 : .. ((1,0) rotated i) endfor -- cycle) ;
    draw (0,0)--(4cm,0) withpen testpen scaled 1cm;
    \stopMPcode
    \blank}

\stoptext

Wolfgang