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;

On 06/12/2024 19:16, Wolfgang Schuster wrote:
Hi,

are there now better ways to create rounded pens without adding many support points?

\starttext

\startMPpage[offset=1dk]

path Halfcircle ; Halfcircle = (1,0){up} for i = 1 upto 180 : .. ((1,0) rotated i) endfor -- cycle ;

draw Halfcircle scaled 10 shifted (0,12) ;

pen HalfcirclePen ; HalfcirclePen := makepen Halfcircle ;

draw ((0,1) -- (1,1)) scaled 10 withpen HalfcirclePen ;
draw ((0,0) -- (0,1)) scaled 10 withpen HalfcirclePen rotated 90 ;
draw ((1,0) -- (1,1)) scaled 10 withpen HalfcirclePen rotated 270 ;
draw ((0,0) -- (1,0)) scaled 10 withpen HalfcirclePen rotated 180 ;

\stopMPpage

\startMPpage[offset=1dk]

path RoundedRectangle ; RoundedRectangle = (-1,0){up} for i = 180 step -1 until 89 : .. ((1,0) rotated i) endfor -- (1,1){down} for i = 360 step -1 until 269 : .. ((1,0) rotated i shifted (0,1)) endfor -- cycle ;

draw RoundedRectangle scaled 10 shifted (0,12) ;

pen RoundedRectanglePen ; RoundedRectanglePen := makepen RoundedRectangle ;

draw ((1,0) -- (1,1)) scaled 10 withpen RoundedRectanglePen reflectedabout (up,down) rotated 270 ;
draw ((0,0) -- (1,0)) scaled 10 withpen RoundedRectanglePen rotated 180 ;

\stopMPpage

\stoptext

Wolfgang

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________