Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Hazen Babcock <hbabcock@ma...>  20090607 01:11:08

Hezekiah M. Carty wrote: > On Wed, Jun 3, 2009 at 3:40 PM, Hezekiah M. Carty<hcarty@...> 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 > Cairospecific 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 plotdeviceaccelerated 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 arccapable > 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(xa); xscl[1] = plP_wcpcx(x+a); yscl[0] = plP_wcpcy(yb); 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 