[metapost] METATYPE1 pen-stroking and tight curves

mskala at ansuz.sooke.bc.ca mskala at ansuz.sooke.bc.ca
Sat Sep 22 22:15:00 CEST 2012


On Thu, 20 Sep 2012, Shriramana Sharma wrote:
> Also, re your previous remarks on how to find and introduce inflection
> points, have you considered testing for the cross-product of the first
> and second derivatives being zero? See

> Do let me know of any progress you have in this regard as I am sure my
> project will also be benefited.

I implemented the cross product approach and it seems to work pretty well.
One gotcha is that after introducing a new node at an inflection point,
it's frequently (maybe even always?) the case that the resulting smaller
segments will have z1=z2, which is exactly what triggers the division by
zero in my tight-curve code.  So if one is doing both, it's necessary to
resolve the division by zero issue for tight-curve code.  It also is
necessary to watch out for numerical imprecision - because splitting does
not actually change the curve, the two split halves will still have
one inflection point between them, and if the split doesn't happen exactly
due to rounding, that inflection point might not be exactly on the split
point and I may end up with a curve segment after the split that
has an inflection point at time 0.0016 or similar.  So I have to ignore
inflection points that appear very close to the end of a segment.

This diff shows my inflection-point code:
  http://sourceforge.jp/projects/tsukurimashou/svn/view/trunk/mp/intro.mp?root=tsukurimashou&r1=255&r2=333

I'm copying this message to the tsukurimashou-devel mailing list, which
has existed for a while but hasn't been used before.  That might be a nice
place to talk about this kind of topic, and about things like FontForge
postprocessing of MT1 output.  MT1 is already a little bit off the main
topic of the Metapost list (we're here because METATYPE1 has no list of
its own); some of the relevant topics are even further away from Metapost;
and I'd like more subscribers for the Tsukurimashou list.

Subscription information here:
   http://lists.sourceforge.jp/mailman/listinfo/tsukurimashou-devel?language=en

Note that although the mailing list software is supposed to support
English, English is what you'll get if you follow the above link, and I
imagine most if not all traffic on the list will be in English,
nonetheless sourceforge.jp tends to default to Japanese and some
list-related pages (such as the archive) may come up in Japanese
regardless of option settings.

-- 
Matthew Skala
mskala at ansuz.sooke.bc.ca                 People before principles.
http://ansuz.sooke.bc.ca/


More information about the metapost mailing list