On Wed, 20 Apr 2005, Jamie C wrote:
I also have a bug where setting the y axis to 0.0 - 0.4 with 5 major
ticks and 20 minor ticks results in the central (0.2) minor and major
tick not being on top of each other. Other similar combinations (i.e
0.00 - 0.04) work perfectly, which is odd.
Sigh, this is a age-old floating point rounding problem...
0.499999999, rounding to nearest integer gets converted to 0, rather than
1 Because we calculate the major and minor ticks differently, one is
slightly above 0.5, and one below. Qt insists on integer pixel values.
Therefore I've modified the rounding code to be
floor(num + 0.5000002)
rather than
floor(num + 0.5)
This should make such bugs happen less often. It's pretty ugly, however.
You probably wouldn't see the problem in the postscript file, as the pixel
sizes are much reduced.
Jeremy
--
Jeremy Sanders <[EMAIL PROTECTED]>
http://www.jeremysanders.net/ Cambridge, UK
Public Key Server PGP Key ID: E1AAE053