<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=windows-1250"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Nice, Luigi,<br>
but the envelope seems to be quite new and not yet documented in mp
manual?<br>
All the best,<br>
Karel<br>
<blockquote
cite="mid:CAG5iGsC5VzBnGUsmm0HL6954HSv65H8JTkb8GHXVDHpiLhXVOQ@mail.gmail.com"
type="cite">
<pre wrap="">On Fri, Feb 9, 2018 at 4:36 AM, Kevin Keith <a class="moz-txt-link-rfc2396E" href="mailto:krfkeith@gmail.com"><krfkeith@gmail.com></a> wrote:
</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Among other issues, the envelope of a path defined by cubic splines is not
itself a cubic spline, so you need to do some approximation, and coming up
with rules for how close the approximation needs to be, that cover all
cases,
is difficult.
</pre>
</blockquote>
<pre wrap="">Of course, but how does Metapost output pen strokes to eps or svg as it is?
Surely
it must already have a mechanism to approximate these higher-order splines
with
cubic bezier curves?
</pre>
<blockquote type="cite">
<pre wrap="">I can think about it, but first I need a small set of significant
examples (quite unlikely that I will implement something new for the
next texlive, btw) .
</pre>
</blockquote>
<pre wrap="">I'll give you the main issue I've run into: say I'm trying to design a font
which
is composed of pen strokes, but I want them to be joined smoothly. This is a
rather
contrived example, but I've put together an illustration of what I mean:
<a class="moz-txt-link-freetext" href="https://i.stack.imgur.com/pzy8e.png">https://i.stack.imgur.com/pzy8e.png</a>
</pre>
</blockquote>
<pre wrap=""><!---->envelope of a cubic spline is tricky
and Metafont makes a polygonal approximation of the elliptical pen
(ie a linearization of the problem).
Metapost has the envelope instruction that works with
polygonal pen;
one can make an approximation of a pen and with the availability of
several numbersystem
the precision is not more a problem.
beginfig(1);
path p[] ;
pen mypen ;
pen mypenC;
numeric L ;
numeric S ;
L:=10;
Sa:=1;
Sb:=2;
Rot=32;
p[-1] := ( (Sa*cosd(0),Sb*sind(0)) for i=1 upto L-1: --
(Sa*cosd(i/L*360), Sb*sind(i/L*360)) endfor -- cycle ) rotated Rot;
mypen := makepen(p[-1]) ;
mypenC:= (pencircle xscaled 2Sa yscaled 2Sb) rotated Rot;
p0 := (0,0){down} .. {up} (100,0) ;
p1 := envelope mypen of p0 ;
message "length p1=" & decimal(length(p1));
draw p1 withcolor blue withpen pencircle scaled 0.25pt ;
draw p0 withcolor 0.8white withpen mypenC;
for t=1 upto length(p1):
draw (point t of p1) withcolor red withpen pencircle scaled 0.3pt;
endfor;
currentpicture := currentpicture scaled 10 ;
endfig;
end
</pre>
</blockquote>
<br>
</body>
</html>