Hezekiah M. Carty wrote: > On Wed, Jun 3, 2009 at 3:40 PM, Hezekiah M. Carty<hca...@atmos.umd.edu> 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. The best solution I was able to come up with is something like this: PLINT xscl[2], yscl[2]; PLINT clpxmi, clpxma, clpymi, clpyma; arc_struct *arc_info; if (plsc->dev_arc) { /* If the driver can handle arcs, let it */ arc_info = (arc_struct *) malloc((size_t) sizeof(arc_struct)); xscl[0] = plP_wcpcx(x-a); xscl[1] = plP_wcpcx(x+a); yscl[0] = plP_wcpcy(y-b); yscl[1] = plP_wcpcy(y+b); difilt(xscl,yscl,2,&clpxmi,&clpxma,&clpymi,&clpyma); arc_info->x = 0.5 * (xscl[1] + xscl[0]); arc_info->y = 0.5 * (yscl[1] + yscl[0]); arc_info->a = 0.5 * (xscl[1] - xscl[0]); arc_info->b = 0.5 * (yscl[1] - yscl[0]); I don't think this will play nicely with arbitrary plot rotations though, which I think that we support. Also, you should add a comment about what the rotation parameters does. best, -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