From: <ai...@us...> - 2008-10-21 01:43:06
|
Revision: 8942 http://plplot.svn.sourceforge.net/plplot/?rev=8942&view=rev Author: airwin Date: 2008-10-21 01:42:57 +0000 (Tue, 21 Oct 2008) Log Message: ----------- Commit of a modified form of a patch submitted by Hezekiah M. Carty to make sure that the stream variables plsc->vpwxmi, plsc->vpwxma, plsc->vpwymi, and plsc->vpwyma retain the exact values specified by the user's call to plwind so those exact values are delivered back by plgvpw. An internal function called plP_xgvpw is now used to deliver the (slightly) extended versions of these variables that PLplot uses internally so that the end limits will be on the graph. The net result of this change is that C/C++ users who access the raw stream variables and all language users who use the plgvpw function to access them will get the exact values input by the user in plwind rather than the slightly extended values. However, after some discussion, Maurice decided this downside of the change was okay because this change will affect a relatively small percentage of our legacy users, and I am certainly willing to go along with his conclusions on this. The examples do not use either the raw stream variables or plgvpw so they should come out identically to before. This happens for *.psc, *.psttfc, *.png, and *.svg. In contrast to these voluminous expected results *.pscairo has differences for examples 7, 12, 23, 24, and 29 and *.pngcairo has differences for all examples. It turns out the *.pngcairo differences are due to timestamps (see list discussion for the evidence) so that is okay, and the only worry is the *.pscairo differences. Those turn out to be something to do with fonts and probably nothing to do with the present changes which is why I am going ahead and making this commit. Modified Paths: -------------- trunk/include/plplotP.h trunk/src/plbox.c trunk/src/plcore.c trunk/src/plhist.c trunk/src/plwind.c Modified: trunk/include/plplotP.h =================================================================== --- trunk/include/plplotP.h 2008-10-20 12:46:29 UTC (rev 8941) +++ trunk/include/plplotP.h 2008-10-21 01:42:57 UTC (rev 8942) @@ -624,6 +624,11 @@ void cont_clean_store(CONT_LEVEL *ct); +/* Get the viewport boundaries in world coordinates, expanded slightly */ + +void +plP_xgvpw(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax); + /* Get x-y domain in world coordinates for 3d plots */ void Modified: trunk/src/plbox.c =================================================================== --- trunk/src/plbox.c 2008-10-20 12:46:29 UTC (rev 8941) +++ trunk/src/plbox.c 2008-10-21 01:42:57 UTC (rev 8942) @@ -182,7 +182,7 @@ xtick1 = llx ? 1.0 : xtick; ytick1 = lly ? 1.0 : ytick; - plgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); + plP_xgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); /* n.b. large change; vpwxmi always numerically less than vpwxma, and * similarly for vpwymi */ vpwxmi = (vpwxmax > vpwxmin) ? vpwxmin : vpwxmax; @@ -1110,7 +1110,7 @@ lhy = plP_stsearch(yopt, 'h'); lly = plP_stsearch(yopt, 'l'); - plgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); + plP_xgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); /* n.b. large change; vpwxmi always numerically less than vpwxma, and * similarly for vpwymi */ vpwxmi = (vpwxmax > vpwxmin) ? vpwxmin : vpwxmax; @@ -1221,7 +1221,7 @@ lty = plP_stsearch(yopt, 't'); lvy = plP_stsearch(yopt, 'v'); - plgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); + plP_xgvpw(&vpwxmin, &vpwxmax, &vpwymin, &vpwymax); /* n.b. large change; vpwxmi always numerically less than vpwxma, and * similarly for vpwymi */ vpwxmi = (vpwxmax > vpwxmin) ? vpwxmin : vpwxmax; Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2008-10-20 12:46:29 UTC (rev 8941) +++ trunk/src/plcore.c 2008-10-21 01:42:57 UTC (rev 8942) @@ -3202,6 +3202,24 @@ *p_ymax = plsc->vpwyma; } +/* Get the viewport boundaries in world coordinates, expanded slightly */ +void +plP_xgvpw(PLFLT *p_xmin, PLFLT *p_xmax, PLFLT *p_ymin, PLFLT *p_ymax) +{ + PLFLT dx, dy; + + dx = (plsc->vpwxma - plsc->vpwxmi) * 1.0e-5; + dy = (plsc->vpwyma - plsc->vpwymi) * 1.0e-5; + + /* The plot window is made slightly larger than requested so that */ + /* the end limits will be on the graph */ + + *p_xmin = plsc->vpwxmi - dx; + *p_xmax = plsc->vpwxma + dx; + *p_ymin = plsc->vpwymi - dy; + *p_ymax = plsc->vpwyma + dy; +} + /*--------------------------------------------------------------------------*\ * These should not be called by the user. \*--------------------------------------------------------------------------*/ Modified: trunk/src/plhist.c =================================================================== --- trunk/src/plhist.c 2008-10-20 12:46:29 UTC (rev 8941) +++ trunk/src/plhist.c 2008-10-21 01:42:57 UTC (rev 8942) @@ -131,7 +131,7 @@ } } - plgvpw(&vpwxmi, &vpwxma, &vpwymi, &vpwyma); + plP_xgvpw(&vpwxmi, &vpwxma, &vpwymi, &vpwyma); if (!(flags & 1)) { for (i = 0; i < nbin - 1; i++) { if (!(flags & 4) || (y[i] != vpwymi)) { Modified: trunk/src/plwind.c =================================================================== --- trunk/src/plwind.c 2008-10-20 12:46:29 UTC (rev 8941) +++ trunk/src/plwind.c 2008-10-21 01:42:57 UTC (rev 8942) @@ -35,6 +35,7 @@ c_plwind(PLFLT xmin, PLFLT xmax, PLFLT ymin, PLFLT ymax) { PLFLT dx, dy, mmxmi, mmxma, mmymi, mmyma; + PLFLT xvpwxmin, xvpwxmax, xvpwymin, xvpwymax; PLWindow w; if (plsc->level < 2) { @@ -53,21 +54,20 @@ ymin--; ymax++; } - dx = (xmax - xmin) * 1.0e-5; - dy = (ymax - ymin) * 1.0e-5; - + plsc->vpwxmi = xmin; + plsc->vpwxma = xmax; + plsc->vpwymi = ymin; + plsc->vpwyma = ymax; + /* The true plot window is made slightly larger than requested so that */ /* the end limits will be on the graph */ +/* Get the (slightly extended) window limits. */ + plP_xgvpw(&xvpwxmin, &xvpwxmax, &xvpwymin, &xvpwymax); - plsc->vpwxmi = xmin - dx; - plsc->vpwxma = xmax + dx; - plsc->vpwymi = ymin - dy; - plsc->vpwyma = ymax + dy; - /* Compute the scaling between coordinate systems */ - dx = plsc->vpwxma - plsc->vpwxmi; - dy = plsc->vpwyma - plsc->vpwymi; + dx = xvpwxmax - xvpwxmin; + dy = xvpwymax - xvpwymin; plsc->wpxscl = (plsc->vppxma - plsc->vppxmi) / dx; plsc->wpxoff = (xmax * plsc->vppxmi - xmin * plsc->vppxma) / dx; @@ -100,10 +100,10 @@ w.dymi = plsc->vpdymi; w.dyma = plsc->vpdyma; - w.wxmi = plsc->vpwxmi; - w.wxma = plsc->vpwxma; - w.wymi = plsc->vpwymi; - w.wyma = plsc->vpwyma; + w.wxmi = xvpwxmin; + w.wxma = xvpwxmax; + w.wymi = xvpwymin; + w.wyma = xvpwymax; plP_swin(&w); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |