Re: envelope

Hans Hagen <[email protected]>
Newsgroups gmane.comp.tex.metapost
Message-ID <[email protected]>
On 9/15/2016 8:27 PM, Daniel H. Luecking wrote:
> Nicola:
>
> The syntax is
>    envelope <polygonal pen> of <path primary>
>
> For example,
>   path p;
>   p := envelope pensquare of (up--left);
>
> It returns the path which, when filled, produces the effect of stroking
> the pen along the path. Elliptical pens (e.g., pencircle) produce an error.
>
> Stroking an elliptical pen is simply passed on to PostScript. But polygonal
> pens (inherited from metafont) require this as a workaround.
>
> I deduced this by a little trial and error based on some descriptions in
> the web source mp.w.

Here's what happens in the result.


\starttext

\startMPpage
draw envelope pensquare of (up--left) ;
\stopMPpage

% 0.500000000 w
% 0.500000000 0.500000000 m
% 0.500000000 0.500000000 0.500000000 1.500000000 0.500000000 1.500000000 c
% 0.500000000 1.500000000 -0.500000000 1.500000000 -0.500000000 
1.500000000 c
% -1.500000000 0.500000000 l
% -1.500000000 0.500000000 -1.500000000 -0.500000000 -1.500000000 
-0.500000000 c
% -1.500000000 -0.500000000 -0.500000000 -0.500000000 -0.500000000 
-0.500000000 c
% 0.500000000 0.500000000 l
% h S

\startMPpage
draw (up--left) withpen pensquare ;
\stopMPpage

% 0.500000000 0.500000000 m
% 0.500000000 0.500000000 0.500000000 1.500000000 0.500000000 1.500000000 c
% 0.500000000 1.500000000 -0.500000000 1.500000000 -0.500000000 
1.500000000 c
% -1.500000000 0.500000000 l
% -1.500000000 0.500000000 -1.500000000 -0.500000000 -1.500000000 
-0.500000000 c
% -1.500000000 -0.500000000 -0.500000000 -0.500000000 -0.500000000 
-0.500000000 c
% 0.500000000 0.500000000 l
% h f

\startMPpage
draw fullcircle ;
\stopMPpage

% 0.500000000 w
% 0.500000000 0 m
% 0.500000000 0.132614136 0.447311401 0.259780884 0.353546143 0.353546143 c
% 0.259780884 0.447311401 0.132614136 0.500000000 0 0.500000000 c
% -0.132614136 0.500000000 -0.259780884 0.447311401 -0.353546143 
0.353546143 c
% -0.447311401 0.259780884 -0.500000000 0.132614136 -0.500000000 0 c
% -0.500000000 -0.132614136 -0.447311401 -0.259780884 -0.353546143 
-0.353546143 c
% -0.259780884 -0.447311401 -0.132614136 -0.500000000 0 -0.500000000 c
% 0.132614136 -0.500000000 0.259780884 -0.447311401 0.353546143 
-0.353546143 c
% 0.447311401 -0.259780884 0.500000000 -0.132614136 0.500000000 0 c
% h S

\startMPpage
draw envelope pensquare of fullcircle ;
\stopMPpage

% 0.500000000 w
% 1 0.500000000 m
% 1 0.632614136 0.947311401 0.759780884 0.853546143 0.853546143 c
% 0.759780884 0.947311401 0.632614136 1 0.500000000 1 c
% 0.500000000 1 -0.500000000 1 -0.500000000 1 c
% -0.500000000 1 l
% -0.632614136 1 -0.759780884 0.947311401 -0.853546143 0.853546143 c
% -0.947311401 0.759780884 -1 0.632614136 -1 0.500000000 c
% -1 0.500000000 -1 -0.500000000 -1 -0.500000000 c
% -1 -0.500000000 l
% -1 -0.632614136 -0.947311401 -0.759780884 -0.853546143 -0.853546143 c
% -0.759780884 -0.947311401 -0.632614136 -1 -0.500000000 -1 c
% -0.500000000 -1 0.500000000 -1 0.500000000 -1 c
% 0.500000000 -1 l
% 0.632614136 -1 0.759780884 -0.947311401 0.853546143 -0.853546143 c
% 0.947311401 -0.759780884 1 -0.632614136 1 -0.500000000 c
% 1 -0.500000000 1 0.500000000 1 0.500000000 c
% 1 0.500000000 l
% h S

\startMPpage
draw fullcircle withpen pensquare ;
\stopMPpage

% 0 -0.500000000 m
% 0 -0.500000000 1 -0.500000000 1 -0.500000000 c
% 1 -0.500000000 1 0.500000000 1 0.500000000 c
% 1 0.632614136 0.947311401 0.759780884 0.853546143 0.853546143 c
% 0.759780884 0.947311401 0.632614136 1 0.500000000 1 c
% 0.500000000 1 -0.500000000 1 -0.500000000 1 c
% -0.500000000 1 l
% -0.632614136 1 -0.759780884 0.947311401 -0.853546143 0.853546143 c
% -0.947311401 0.759780884 -1 0.632614136 -1 0.500000000 c
% -1 0.500000000 -1 -0.500000000 -1 -0.500000000 c
% -1 -0.500000000 l
% -1 -0.632614136 -0.947311401 -0.759780884 -0.853546143 -0.853546143 c
% -0.759780884 -0.947311401 -0.632614136 -1 -0.500000000 -1 c
% -0.500000000 -1 0.500000000 -1 0.500000000 -1 c
% 0.500000000 -1 l
% 0.632614136 -1 0.759780884 -0.947311401 0.853546143 -0.853546143 c
% 0.947311401 -0.759780884 1 -0.632614136 1 -0.500000000 c
% 1 -0.500000000 1 0.500000000 1 0.500000000 c
% 1 0.500000000 l
% 1 0.500000000 0 0.500000000 0 0.500000000 c
% 0 0.367385864 -0.052688599 0.240219116 -0.146453857 0.146453857 c
% -0.240219116 0.052688599 -0.367385864 0 -0.500000000 0 c
% -0.500000000 0 0.500000000 0 0.500000000 0 c
% 0.367385864 0 0.240219116 0.052688599 0.146453857 0.146453857 c
% 0.052688599 0.240219116 0 0.367385864 0 0.500000000 c
% 0 0.500000000 l
% 0 0.500000000 0 -0.500000000 0 -0.500000000 c
% 0 -0.367385864 0.052688599 -0.240219116 0.146453857 -0.146453857 c
% 0.240219116 -0.052688599 0.367385864 0 0.500000000 0 c
% 0.500000000 0 l
% 0.500000000 0 -0.500000000 0 -0.500000000 0 c
% -0.367385864 0 -0.240219116 -0.052688599 -0.146453857 -0.146453857 c
% -0.052688599 -0.240219116 0 -0.367385864 0 -0.500000000 c
% h f

\startMPpage
draw fullcircle withpen pensquare ;
\stopMPpage

% 0 -0.500000000 m
% 0 -0.500000000 1 -0.500000000 1 -0.500000000 c
% 1 -0.500000000 1 0.500000000 1 0.500000000 c
% 1 0.632614136 0.947311401 0.759780884 0.853546143 0.853546143 c
% 0.759780884 0.947311401 0.632614136 1 0.500000000 1 c
% 0.500000000 1 -0.500000000 1 -0.500000000 1 c
% -0.500000000 1 l
% -0.632614136 1 -0.759780884 0.947311401 -0.853546143 0.853546143 c
% -0.947311401 0.759780884 -1 0.632614136 -1 0.500000000 c
% -1 0.500000000 -1 -0.500000000 -1 -0.500000000 c
% -1 -0.500000000 l
% -1 -0.632614136 -0.947311401 -0.759780884 -0.853546143 -0.853546143 c
% -0.759780884 -0.947311401 -0.632614136 -1 -0.500000000 -1 c
% -0.500000000 -1 0.500000000 -1 0.500000000 -1 c
% 0.500000000 -1 l
% 0.632614136 -1 0.759780884 -0.947311401 0.853546143 -0.853546143 c
% 0.947311401 -0.759780884 1 -0.632614136 1 -0.500000000 c
% 1 -0.500000000 1 0.500000000 1 0.500000000 c
% 1 0.500000000 l
% 1 0.500000000 0 0.500000000 0 0.500000000 c
% 0 0.367385864 -0.052688599 0.240219116 -0.146453857 0.146453857 c
% -0.240219116 0.052688599 -0.367385864 0 -0.500000000 0 c
% -0.500000000 0 0.500000000 0 0.500000000 0 c
% 0.367385864 0 0.240219116 0.052688599 0.146453857 0.146453857 c
% 0.052688599 0.240219116 0 0.367385864 0 0.500000000 c
% 0 0.500000000 l
% 0 0.500000000 0 -0.500000000 0 -0.500000000 c
% 0 -0.367385864 0.052688599 -0.240219116 0.146453857 -0.146453857 c
% 0.240219116 -0.052688599 0.367385864 0 0.500000000 0 c
% 0.500000000 0 l
% 0.500000000 0 -0.500000000 0 -0.500000000 0 c
% -0.367385864 0 -0.240219116 -0.052688599 -0.146453857 -0.146453857 c
% -0.052688599 -0.240219116 0 -0.367385864 0 -0.500000000 c
% h f

\startMPpage
draw fullcircle withpen pencircle ;
\stopMPpage

% 1 w
% 0.500000000 0 m
% 0.500000000 0.132614136 0.447311401 0.259780884 0.353546143 0.353546143 c
% 0.259780884 0.447311401 0.132614136 0.500000000 0 0.500000000 c
% -0.132614136 0.500000000 -0.259780884 0.447311401 -0.353546143 
0.353546143 c
% -0.447311401 0.259780884 -0.500000000 0.132614136 -0.500000000 0 c
% -0.500000000 -0.132614136 -0.447311401 -0.259780884 -0.353546143 
-0.353546143 c
% -0.259780884 -0.447311401 -0.132614136 -0.500000000 0 -0.500000000 c
% 0.132614136 -0.500000000 0.259780884 -0.447311401 0.353546143 
-0.353546143 c
% 0.447311401 -0.259780884 0.500000000 -0.132614136 0.500000000 0 c
% h S

\stoptext




-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
--
http://tug.org/metapost/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.