[metapost] Accuracy of "angle"

Dirk Laurie dpl at sun.ac.za
Tue Oct 26 10:48:48 CEST 2010

I am at present revising my package Napoleon which makes geometry
drawings using Metapost.  I noticed that when the drawing is large,
the incircle of a triangle fails to touch the sides to an unacceptably
large extent.  I traced the problem to inaccurate bisectors.  I used
the following equation for a point z on the bisector of angle z0--z1--z2:

    z = z1 + whatever*((z1-z0) rotated (angle((z2-z1) _zdiv (z0-z1))/2)) 

where a _zdiv b is complex division, defined by

    a transformed inverse (identity zscaled b)

I then changed the equation to one based on the theorem that the
diagonals of a rhombus bisect its angles:

    z = z1 + whatever*(unitvector(z0-z1)+unitvector(z2-z1))

and the incircle is now accurate.

The unitvector computations basically need to do the same as what 
_zdiv does, so I suspect the "angle" function as the source of the

I'm using Metapost 1.208 as supplied with texmf-texlive under Lucid 

Does any member of this list know whether accuracy specifications for
builtins like "angle" exist?


More information about the metapost mailing list