Michael Bedward ha scritto: > Hi folks, > > I'm working on putting some flesh onto the bones of > InterpolationFunction which have been sitting in the render module for > some time (thanks Jody for pointing me to this). > > I've got the basics of linear, cosine and cubic interpolation working > for numeric values. Next it's on to Color and after that raster > support. > > I'm following the Symbology Encoding 1.1 specs but they are silent on > what to do in a few exceptional cases. In the following, > 'interpolation point' refers to each of the data:value pairs provided > to the function by the user... > > 1. What to do if no interpolation points are provided ? Be generous > and just return the lookup value or be strict and throw an Exception ?
I would go for the "crap in, crap out" approach for this one. The user gave us something it's not possible to work with, we throw an Exception. > 2. What to do if only one interpolation point is provided ? Use it's > value as the return or throw an Exception ? By reading the spec it seems we should just return its value, yes. > 3. For cubic interpolation, if less than 4 points are provided I'm > presently falling back to cosine interpolation and logging a warning, > but perhaps it should be an Exception ? > 4. For cubic interpolation we need an interpolation point on either > side of the pair that define the segment defining the interval that > contains the lookup value: > > o--------o----x----o--------o > > But what to do in cases like this... > > o--------o--------o----x----o > > Fall back to cosine ? Return the value of the second last point ? Hard questions, the spec does not say anything. It however says that any data point below the first gets the first point value, and any data point greater than the last gets the last point value. So, can we can a continuous interpolation out of that? Maybe by adding missing points outside of the specified range to make the cubic algorithm work? By the way I read the spec we can imagine repeating the first and the last point indefinitely below and above what was specified without really changing the outcome? So I guess we could add one copy of the first point below the first point and one copy of the last point above the last point just to handle the corner case of X falling in the area we cannot cover with the given points. Wondering, would doubling the point in place work? Like, we assume the first point is there two times in the expression? And same for the last? Would that provide a continuous output? Cheers Andrea -- Andrea Aime OpenGeo - http://opengeo.org Expert service straight from the developers. ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ Geotools-devel mailing list Geotools-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel