Hi,
as far as I have understood one can only either use a circle (and
then, lowlevel, Postscript/PDF uses that) or a polygon (and then that
is used low-level).
Since a few weeks (not sure if it is in distribution yet) there is
also a penstroked macro that imitates the penstroke a bit (one can
make variants of it). Example:
\startMPpage[offset=1dk]
fill function(2,"x","sin(x)",0,epsed(6*pi),0.1)
scaled 20
penstroked
function(2,"x","1+7*(sin(x)^2)",0,epsed(pi),0.001)
withcolor "orange" ;
\stopMPpage
/Mikael
On Fri, Dec 6, 2024 at 8:19 PM Wolfgang Schuster
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 ___________________________________________________________________________________