interpolator1.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // Copyright 2012 The Closure Library Authors. All Rights Reserved.
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS-IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /**
  15. * @fileoverview The base interface for one-dimensional data interpolation.
  16. *
  17. */
  18. goog.provide('goog.math.interpolator.Interpolator1');
  19. /**
  20. * An interface for one dimensional data interpolation.
  21. * @interface
  22. */
  23. goog.math.interpolator.Interpolator1 = function() {};
  24. /**
  25. * Sets the data to be interpolated. Note that the data points are expected
  26. * to be sorted according to their abscissa values and not have duplicate
  27. * values. E.g. calling setData([0, 0, 1], [1, 1, 3]) may give undefined
  28. * results, the correct call should be setData([0, 1], [1, 3]).
  29. * Calling setData multiple times does not merge the data samples. The last
  30. * call to setData is the one used when computing the interpolation.
  31. * @param {!Array<number>} x The abscissa of the data points.
  32. * @param {!Array<number>} y The ordinate of the data points.
  33. */
  34. goog.math.interpolator.Interpolator1.prototype.setData;
  35. /**
  36. * Computes the interpolated value at abscissa x. If x is outside the range
  37. * of the data points passed in setData, the value is extrapolated.
  38. * @param {number} x The abscissa to sample at.
  39. * @return {number} The interpolated value at abscissa x.
  40. */
  41. goog.math.interpolator.Interpolator1.prototype.interpolate;
  42. /**
  43. * Computes the inverse interpolator. That is, it returns invInterp s.t.
  44. * this.interpolate(invInterp.interpolate(t))) = t. Note that the inverse
  45. * interpolator is only well defined if the data being interpolated is
  46. * 'invertible', i.e. it represents a bijective function.
  47. * In addition, the returned interpolator is only guaranteed to give the exact
  48. * inverse at the input data passed in getData.
  49. * If 'this' has no data, the returned Interpolator will be empty as well.
  50. * @return {!goog.math.interpolator.Interpolator1} The inverse interpolator.
  51. */
  52. goog.math.interpolator.Interpolator1.prototype.getInverse;