[metapost] Pen stroking and tight curves

xiolyxioly xiolyxioly at yahoo.com
Mon Oct 22 05:15:08 CEST 2012


> The problem isn't "find where on the curve the radius is less than the pen
> radius" but "find a cubic spline that approximates the ideal envelope."
 
Understood. But the approximation process should not be applied to the loop
areas, so we have to eliminate those first, right ? Once that is done, well-known
approximation techniques can be applied to what remains.

> We're already in Heuristics Land as soon as we want the result to be a
> cubic spline, because the ideal envelope is a higher-order curve.
 
I would say we're in "approximation land". That's different from "heuristics
land" (in my view).
 
Anyway, my main point was that numerical (rrot-finding) methods seem
like the right approach, to me, and, from personal experience, I know that
this is how these problems are solved in CAD systems.


--- On Mon, 10/22/12, mskala at ansuz.sooke.bc.ca <mskala at ansuz.sooke.bc.ca> wrote:


From: mskala at ansuz.sooke.bc.ca <mskala at ansuz.sooke.bc.ca>
Subject: Re: [metapost] Pen stroking and tight curves
To: "xiolyxioly" <xiolyxioly at yahoo.com>
Cc: metapost at tug.org
Date: Monday, October 22, 2012, 10:39 AM


On Sun, 21 Oct 2012, xiolyxioly wrote:
> It seems to me that the methods being proposed are all somewhat heuiristic.
> I don't think it's very difficult to do this "rigorously".

> The curvature of a Bezier cubic curve R(t) is a continuous function. We are
> looking for "tight" regions where it's value is less than the pen radius

The problem isn't "find where on the curve the radius is less than the pen
radius" but "find a cubic spline that approximates the ideal envelope."
We're already in Heuristics Land as soon as we want the result to be a
cubic spline, because the ideal envelope is a higher-order curve.

> I have similar thoughts on the problem of detecting inflexions. Again, it's
> just a problem of finding the zeros of a real-valued function. I think there
> can be no more than 2 inflexions on a Bezier cubic. Again, CAD systems
> frequently do this computation, so code exists.

Indeed, Metapost code for it is in this commit:
   http://sourceforge.jp/projects/tsukurimashou/svn/view/trunk/mp/intro.mp?root=tsukurimashou&r1=332&r2=333

A few tricky numerical cases have been tweaked since that version, but
the linked page contains an interface through which the current version is
available, and looking at the file as a whole would make it harder to see
the relevant bits.
-- 
Matthew Skala
mskala at ansuz.sooke.bc.ca                 People before principles.
http://ansuz.sooke.bc.ca/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/metapost/attachments/20121021/d5a9422b/attachment.html>


More information about the metapost mailing list