[metapost] pens and number of points

Taco Hoekwater taco at elvenkind.com
Mon Nov 5 09:19:24 CET 2007


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.

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.

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).

Best wishes,
Taco


More information about the metapost mailing list