[metapost] wrong bounding box with pencircle
Stephan Hennig
mailing_list at arcor.de
Sun Jun 23 01:01:53 CEST 2013
Hi,
Am 22.06.2013 19:30, schrieb Boguslaw Jackowski:
> I believe that it is a long-standing issue.
> [...]
> Then, the problem several times "payed a visit" to the MF/MP discussion
> list. In particular, the problem was disscussed in the thread
> "some question about pens", triggered by Stephan Hennig 01 Apr 2008. :-)
Oh, I don't remember any more. But I do remember MetaPost "recently"
fixing some pen and bounding box related issue, which (the fix) even
affected Knuth. ... OK, that must have been in 2007,
<URL:http://tug.org/pipermail/tex-k/2007-November/001771.html>, so
before the above mentioned discussion.
> In this thread, Hartmut Henkel <hartmut_henkel at gmx.de> pointed out that
>
> metapost doesn't calculate the bounding box right in this case, see:
> prologues := 3;
> beginfig(1);
> path hc;
> hc := halfcircle scaled 200;
> linecap := squared;
> draw hc shifted (150,300) withpen pencircle scaled 50;
> draw bbox(currentpicture) withcolor red;
> currentpicture := currentpicture shifted -llcorner(currentpicture);
> endfig;
> end
> if you comment out the linecap line, you get a tight bounding box.
Looks very familiar. :-) I did search in the Mantis bug tracker
<URL:http://tracker.luatex.org./my_view_page.php>, where I didn't find
anything related and at supelec
<URL:https://foundry.supelec.fr/projects/metapost/> where I not even
found an issue tracker any more. :(
> and Dan Luecking <luecking at uark.edu> provided an example showing that
> miter-limitted paths can get wrong bounding boxes:
>
> beginfig(100)
> miterlimit := 11;
> linejoin := mitered;
> draw (0,0)--(72,7)--(0,14) withpen pencircle scaled 2bp;
> endfig;
> end.
I do remember this one, though.
> All in all, there is much to be done with MP strokes. On the theoretical
> part too. (Maybe here also using bitmaps as an auxiliary mean could
> be a help?)
I don't know too much about this envelope tracing, but could you please
explain (no details please) in what way the current implementation is
imperfect?
* Does Hobby's algorithm just miss to cover some corner cases?
(Some of the graphics posted here to me look like that.)
* Or is there an inherent instability in the algorithm?
(Can't +/-180 degree ambiguities be solved by looking at context,
i.e., some dt before or after ambiguous time values?)
* Or is it a mathematically relatively easy, but in such a way a
convoluted problem that is difficult to implement right?
Another question, if the problem of analytical envelope tracing of rigid
polygonal pens were fully solved, would that automatically solve the
problem of tracing the envelope of polygonal pens that are turned (or
otherwise transformed) along the stroke (similar to MetaFont)?
Best regards,
Stephan Hennig
More information about the metapost
mailing list