[metapost] pens and number of points

Peter Rolf indiego at gmx.net
Mon Nov 5 15:20:18 CET 2007

Peter Rolf schrieb:
> Taco Hoekwater schrieb:
>> Peter Rolf wrote:
>>> Hi,
>>> please excuse my ignorance. Why does MetaPost (1.000) need 18(!) points
>>> for drawing a square with a squared pen, while it only needs (the
>>> expected) four in case of a circled pen? Is this PS related?
>> The suprising thing is that it needs only 4 for the pencircle.
> not from my (naive) point of view ;)
>> There is special optimization code in metapost because manipulating
>> elliptical pens is supported by the PS interpreter itself. That is
>> not possible for other types of pens.
> ok
>> As seen in your second example, it is possible in PS to draw this
>> particular case with only 8 points, but that is only true because
>> all the pen sides are modulo 90 to the path sides. From a programming
>> viewpoint, that is pretty unlikely (and in general, hard to test).
> I see that there is no general solution for this problem (pen can be any
> closed path). In this special test case using *pencircle* in combination
> with
> interim linejoin:= mitered;
> interim lincut:= squared;

just changing some of my graphics and it didn't work with the
copied&pasted values from this mail :D


> also results in a nice squared frame with only four points. Suprise again ;)
> I have tried some non modulo 90 angles, not equal sized squared pens and
> it worked without any problems (this quadrature of a circle [pen] seems
> to be supported by PS).
> IMO the only point that is speaking for the usage of pensquare is the
> possiblity to rotate the pen (untested). If there is more, please let me
> know.
>> Best wishes,
>> Taco
> Thanks for the info.
> Cheers, Peter
> --
> http://tug.org/mailman/listinfo/metapost

More information about the metapost mailing list