Text rotation bug?

[email protected] (Ethan Merritt) Tue, 24 Feb 2009 13:28:04 -0800
Newsgroups php.gd.devel
Organization University of Washington
Message-ID <[email protected]>
In tracking down a reported problem with rotated text in gnuplot's png
terminal,  I found what appears to be a bug, or at least a limitation 
in libgd.  Rotation angles outside the range  -pi < angle <  pi are
slightly wrong or possibly just overly sensitive to the precision of 
the angle provided.

In particular, rotation of +90 degrees   (1.570796 radians) is fine
But rotation of -270 degress (-4.712389 radians) is ever so slightly off.
The rotation values were provided to greater precision than shown above.

According to the original reporter, the problem is visible with
libgd 2.0.34 and several earlier versions.  I have not been able to
reproduce it myself using 2.0.35 built from source, but I don't know
if that is because something was fixed or whether it is a difference
in machine configurations, math libraries, compilers or what, exactly. 

I can work around this in gnuplot by adjusting angles to lie in the 
range [-pi : pi], but I suggest that libgd should do the same internally.  
Probably angles within some slop factor of N*(pi/2) should
be "snapped" to perfect alignment.

	Ethan

-- 
Ethan A Merritt