| 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 |
/** |
| 16 |
* @fileoverview The base interface for one-dimensional data interpolation. |
| 17 |
* |
| 18 |
*/ |
| 19 |
|
| 20 |
goog.provide('goog.math.interpolator.Interpolator1'); |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
/** |
| 25 |
* An interface for one dimensional data interpolation. |
| 26 |
* @interface |
| 27 |
*/ |
| 28 |
goog.math.interpolator.Interpolator1 = function() {}; |
| 29 |
|
| 30 |
|
| 31 |
/** |
| 32 |
* Sets the data to be interpolated. Note that the data points are expected |
| 33 |
* to be sorted according to their abscissa values and not have duplicate |
| 34 |
* values. E.g. calling setData([0, 0, 1], [1, 1, 3]) may give undefined |
| 35 |
* results, the correct call should be setData([0, 1], [1, 3]). |
| 36 |
* Calling setData multiple times does not merge the data samples. The last |
| 37 |
* call to setData is the one used when computing the interpolation. |
| 38 |
* @param {!Array<number>} x The abscissa of the data points. |
| 39 |
* @param {!Array<number>} y The ordinate of the data points. |
| 40 |
*/ |
| 41 |
goog.math.interpolator.Interpolator1.prototype.setData; |
| 42 |
|
| 43 |
|
| 44 |
/** |
| 45 |
* Computes the interpolated value at abscissa x. If x is outside the range |
| 46 |
* of the data points passed in setData, the value is extrapolated. |
| 47 |
* @param {number} x The abscissa to sample at. |
| 48 |
* @return {number} The interpolated value at abscissa x. |
| 49 |
*/ |
| 50 |
goog.math.interpolator.Interpolator1.prototype.interpolate; |
| 51 |
|
| 52 |
|
| 53 |
/** |
| 54 |
* Computes the inverse interpolator. That is, it returns invInterp s.t. |
| 55 |
* this.interpolate(invInterp.interpolate(t))) = t. Note that the inverse |
| 56 |
* interpolator is only well defined if the data being interpolated is |
| 57 |
* 'invertible', i.e. it represents a bijective function. |
| 58 |
* In addition, the returned interpolator is only guaranteed to give the exact |
| 59 |
* inverse at the input data passed in getData. |
| 60 |
* If 'this' has no data, the returned Interpolator will be empty as well. |
| 61 |
* @return {!goog.math.interpolator.Interpolator1} The inverse interpolator. |
| 62 |
*/ |
| 63 |
goog.math.interpolator.Interpolator1.prototype.getInverse; |