From: Alan W. I. <ir...@be...> - 2010-05-21 06:58:10
|
For those unaware of what the parallelogram issue is, please have a look at the first attachment which was generated by examples/c/x01c -dev pngcairo -geometry 800x400 -ori 0.2 -o test.png This 18 deg rotation has turned the rectangles of this example into parallelograms, and the text rendered by the device driver is obviously written at incorrect angles. If you try similar experiments with -dev xwin or -dev qtwidget you also get identical incorrect parallelograms. The issue disappears for unity aspect ratios, and for integral -ori values so we haven't worried about it that much over the years, but nevertheless it has always nagged me that nobody could figure this out. The relevant affine transformations are implemented in calc_diori in plcore.c via calls to various plP_affine* functions. There is also commented out code there that has the same effect, but I replaced that quite a while ago with the series of plP_affine* calls because I thought that gave a better feeling for all the fundamental affine transformations involved. Today, I did an experiment with gdb that showed that internal coordinates were used for the scaling part of the affine transformation rather than raw device coordinates. In retrospect this should make no difference since device coordinates are simply scaled by the same factor in X and Y. But at the time, I thought I was on to something so I starting experimenting and discovered that if lx (the X length) was divided by the device's aspect ratio, all the parallelogram issues go away (see attached second plot which was generated like the first plot except for the code change [currently commented out] to divide lx by the device aspect ratio). I currently don't understand why this correction works; and the results do not preserve the aspect ratio of the original (say for -ori 1), have severe cropping issues, and also have character aspect ratio issues for Hershey fonts (circles are rendered as ellipses). So I have commented out the correction (revision revision 11017). But I feel I am close to the correct solution because the second plot looks so much better than the first, and at least the character aspect ratio issue can be ascribed to an old experimental correction which likely now needs to be adjusted to be consistent with this latest fix (once it is uncommented). Anyhow, I hope that the nice second plot I have attached will inspire somebody with more knowledge than I have of the various PLplot coordinate systems to try and understand why this correction works, and to use that understanding to deal with the other issues that I have observed with the experimental correction. Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); PLplot scientific plotting software package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |