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; >>> > > My apologies - I sent the original message with the wrong From: line, > so my original post only made it to Hazen, not the list. > > My intent is/was to ask which transform to do in PLplot core. So > given, in plot-world coordinates: > > point_x, point_y > > how would I translate that location to the values: > > intermediate_x, intermediate_y > > which would be passed to the underlying driver (Cairo, in this > example)? Once they get to Cairo, my understanding from the code and > your comment is that the final Cairo (x, y) would be: > > intermediate_x * aStream->downscale, intermediate_y * aStream->downscale > > I think my problem is that I am not calculating (intermediate_x, > intermediate_y) appropriately. I thought that plP_wcpcx and plwcpcy > would do this, but they give the erroneous results I mentioned in the > original message. I have attached the example plots again for the > list since they didn't make it to the list last time. > > Thank you for your help on this Hazen!
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. -Hazen ------------------------------------------------------------------------------ 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