[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] Bug in pic? And how to do this right?

From: Ted Harding
Subject: Re: [Groff] Bug in pic? And how to do this right?
Date: Fri, 12 Dec 2003 17:46:50 -0000 (GMT)

On 12-Dec-03 joerg van den hoff wrote:
> Greg 'groggy' Lehey wrote:
>>Two things stop me from doing this:
>>2.  I can't get an arc to start at the bottom of the left hand side.
>>    If I write the code the way it should be, it starts too far to the
>>    left.  If I gradually move the start to the right, it suddenly
>>    jumps past the reference point and leaves a gap.  This behaviour
>>    has been there for several years now.
>>T: ellipse ht .3i wid 4i
>>   line from T.e down 4i
>>   line from T.w down 4i
>>B: arc from T.w+(0,-4) rad 10i to T.e+(0,-4)
> sorry, no solution but only a confirmation that something indeed seems 
> wrong. I modified your script slightly, adding some support lines to
> see how far the arc segment does deviate from the intended ellipse
> segment. especially, it is remarkable, that dashing goes wrong, too,
> in the postscript output.
> joerg

This seems to be a bug in grops.

The output from pic, and the output from troff, seem to be OK is
one does the arithmetic on the numbers.

However, in my groff 1.18.1 the PS code in the PS file output by
grops has the PS command

  288 -322.656 720.002 102 78.5 DA

which, when the definition of /DA is substituted, becomes

  288 -322.656 720.002 102 78.5 newpath arcn stroke

which (in plain language) means:

  draw a clockwise ["n" for negative, as opposed to counterclockwise]
  arc from (288,-322.656) with radius 720.002   [all in points]
  starting at an angle 78.5 deg clockwise from the right
  and ending at an angle 102 deg clockwise.

Now: 102deg - 78.5deg = 23.5deg

However: the angle between the two radii should be

     2 * arcsin(2/10) = 23.07391807deg

and therefore the angle of the arc is too large, by about 0.4deg,
which explains the extra bit protruding on the left.

Now if I go back to old versions of groff which I have:

Groff version 1.11:

  288 -322.656 720.002 101.5369 78.4631 DA

  in which the difference of angles is now

  101.5369deg - 78.4631deg = 23.0738deg

  which, while not quite exact, is much better
  (only 0.0001deg out, and this could be a rounding error).

Groff version 1.16.1:

  288 -322.656 720.002 101.5369 78.4631 DA

  which is the same.

(And both versions draw a perfect picture in the PS file).

Now, from the correct values:  101.5369 78.4631

we can get the groff 1.18.1 values:  102 78.5
by rounding to 3 significant figures. Maybe this is what
recent versions of grops do: in which case it is a definite
bug, because rounding angles in degrees to 3 sig fig is
going to introduce some perceptible errors!


E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 12-Dec-03                                       Time: 17:46:50
------------------------------ XFMail ------------------------------

reply via email to

[Prev in Thread] Current Thread [Next in Thread]