From: Hezekiah M. C. <hez...@us...> - 2009-06-30 21:45:19
|
On Sat, Jun 6, 2009 at 9:10 PM, Hazen Babcock<hba...@ma...> wrote: > Hezekiah M. Carty wrote: >> >> On Wed, Jun 3, 2009 at 3:40 PM, Hezekiah M. Carty<hc...@at...> >> wrote: >>> >>> While writing the Cairo backend for plarc, I am having some trouble >>> getting the transformation from world coordinates to Cairo coordinates >>> correct. >> >> I have attached a patch which implements the plarc function, adds >> Cairo-specific support for arc outlines and fills, and updates example >> 3 to use plarc for the polar plot circles. It is my hope that someone >> with more experience with the PLplot internals can point out what I am >> doing wrong with the scaling of the coordinates. The implementation >> is still incomplete as plot-device-accelerated plarc calls are not >> added to the plot buffer yet. It is complete enough to compare the >> "proper" results (ex. using the xwin device) with the incorrectly >> scaled results (ex. using the xcairo device). >> >>> From what I understand, the problem is in src/plarc.c in the c_plarc >> >> function, somewhere between lines 128 and 144 where arc-capable >> devices are handled. The Cairo rendering function is in >> drivers/cairo.c and is called arc(). >> >> Thank you for any insight you can provide on this. > > What is missing is that coordinates from plline(), etc... are run through a > final transformation function called difilt() in plcore.c. > < a working example ... > > > I don't think this will play nicely with arbitrary plot rotations though, > which I think that we support. Thank you for the code. It does work properly for the unrotated case and as you mention, it does not work with rotated plots. The simplest work-around for this is probably to disable the driver-specific rendering path if the the orientation is anything other than the default 0. > Also, you should add a comment about what the rotation parameters does. I may remove this option from the plarc command if there are no objections. "rotation" is meant to map to the Cairo and Qt (and probably SVG as well) full-arc rotation parameters. So an ellipse with a rotation value of 45 degrees would be drawn with the entire shape rotated by 45 degrees about its center. I do not know the proper way to handle non-square aspect ratios in this case. Should the ellipse keep the same shape it would have if rotation were 0 degrees, or should it be stretched according to the plot's aspect ratio? The first option is the Cairo default, while the second is what the plline/plfill fallback method would default to. Comments? Hez -- Hezekiah M. Carty Graduate Research Assistant University of Maryland Department of Atmospheric and Oceanic Science |