On 2008-09-29 12:47-0400 Hezekiah M. Carty wrote:

> This is a follow up to the "Viewport Clipping" thread on plplot-general.
>
> The attached patch transforms the plsc->vpw* values returned by plgvpw
> so that they should be the same values as provided by the user.
> "Should", because there can still be floating point errors in the
> return values.  For example:
>
> plenv(-1.0, 1.0, -1.0, 1.0, 0, 0)
> plgvpw(xmin, xmax, ymin, ymax)
>
> will work as expected, returning (-1.0, 1.0, -1.0, 1.0) but:
>
> plenv(1.0, 0.0, 1.0, 0.0, 0, 0)
> plgvpw(xmin, xmax, ymin, ymax)
>
> returns with a small error: (1.00000000000000022, 0., 1.00000000000000022, 0.)
>
> Greping through the rest of the code in src/, plbox.c and plhist.c
> both seem potentially affected by this change to plgvpw as they have
> functions which call plgvpw.  At least plbox.c would need to be
> changed because as it is, plenv will not print the smallest magnitude
> axis labels in the above two examples.
>
> Given the above issues and those raised in the plplot-general thread,
> perhaps the more prudent approach would be to remove the adjustment
> factor from plwind.c (the functions c_plwind and probably c_plw3d as
> well) and find a way to fix any issues in plbox.c and plhist.c.  There
> are probably 3D plotting functions which would have to be adjusted as
> well if plw3d is changed.
>
> As it is, the attached patch is an example of how to invert the
> plsc->vpw* translations which are currently made, but should probably
> not be applied to the official PLplot tree until a method of
> addressing these problems has been picked.
>
> Any comments or thoughts?

I have had some experience with a number of plotting libraries going back
through at least 1975, and they all have had these little adjustments which
you remove at your peril.  To illustrate that peril, wc gives more than 50
uses for vpwxmi (set in c_plwind) in the source code in the src directory.
Presumably some of those are documentation strings, but still that is a lot
of use.  So my feeling is we should internally stick exactly with the
adjustment in plwind and also return the values exactly as now in plgvpw
(since plgvpw is also used internally in our code).

That leaves the question of whether we should design an additional function
that returns the exact plwind arguments. However, I would argue against that
because it is a good principle to keep our API to a minimum since adding to
it means it has to be propagated to all the languages, it has to be
documented, etc. Note I am generally on the side of expanding our API for
functions where there is a good chance they will get used, but I do recognize
there is a cost involved so I want to avoid such expansion for the case
where the function would be a rarely used part of our API that could be
done by the user for himself (in this case the user could store and
retrieve exact plwind arguments for himself).

Thus, what I would like to do is deal with this issue by improving the
documentation in a way that encourages the user to save their exact plwind
arguments rather than trying to compute them from the plgvpw results.
However, if having considered these arguments others here still feel
strongly that a documentation improvement is not enough and our API should
be expanded to deal with this issue instead, then I am would be
(reluctantly) willing to go along with that.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to