On Wed, Jun 3, 2009 at 6:35 PM, Hazen Babcock <hbabc...@mac.com> wrote: > Hezekiah M. Carty wrote: >> >> On Wed, Jun 3, 2009 at 4:36 PM, Hazen Babcock <hbabc...@mac.com> wrote: >>> >>> Hezekiah M. Carty wrote: >>>> >>>> While writing the Cairo backend for plarc, I am having some trouble >>>> getting the transformation from world coordinates to Cairo coordinates >>>> correct. From what I understand, the proper method is: >>>> >>>> cairo_x = plP_wcpcx(world_x); >>>> cairo_y = plP_wcpcx(world_y); >>>> cairo_a = plP_wcpcx(world_x + world_a) - cairo_x; >>>> cairo_b = plP_wcpcy(world_y + world_b) - cairo_y; > > cairo_y = plP_wcpcx(world_y); > ^^^ > A typo perhaps? > > I think you might also need to transform to device coordinates instead of > world coordinates, but I'm not sure. I was looking around in src/plline.c > but I didn't immediately see how plline() handled this transformation.
Good catch, though sadly the typo was only in my transcription of the code, not in the original. From what I can see after digging through plcvt.c, plline.c, plsym.c and plcore.c, the plP_wcpc[xy] functions are the correct ones to use to convert from world coordinates to the coordinates passed on to drivers. Using plP_wcdc[xy] gives values which are much too small, leading to just a point plotted in the lower-left corner of the plot surface. From some simple testing (mostly printf statements), plP_wcpc[xy] seem to give values in the internal "short int" coordinate range of PLplot, while plP_wcdc[xy] give normalized values from 0.0 to 1.0. Passing either one to cairo.c and using what seems to be the appropriate scaling (aStream->downscale or pls->[xy]length, respectively) gives the same offset result. I will continue to dig through the other plotting code paths to try to find what I am missing. If I don't have any luck then I will put out what I have in the hope that someone else can make a suggestion. Hez -- Hezekiah M. Carty Graduate Research Assistant University of Maryland Department of Atmospheric and Oceanic Science ------------------------------------------------------------------------------ OpenSolaris 2009.06 is a cutting edge operating system for enterprises looking to deploy the next generation of Solaris that includes the latest innovations from Sun and the OpenSource community. Download a copy and enjoy capabilities such as Networking, Storage and Virtualization. Go to: http://p.sf.net/sfu/opensolaris-get _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel