Path: blob/trunk/third_party/closure/goog/math/interpolator/interpolator1.js
2868 views
// Copyright 2012 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.1314/**15* @fileoverview The base interface for one-dimensional data interpolation.16*17*/1819goog.provide('goog.math.interpolator.Interpolator1');20212223/**24* An interface for one dimensional data interpolation.25* @interface26*/27goog.math.interpolator.Interpolator1 = function() {};282930/**31* Sets the data to be interpolated. Note that the data points are expected32* to be sorted according to their abscissa values and not have duplicate33* values. E.g. calling setData([0, 0, 1], [1, 1, 3]) may give undefined34* results, the correct call should be setData([0, 1], [1, 3]).35* Calling setData multiple times does not merge the data samples. The last36* call to setData is the one used when computing the interpolation.37* @param {!Array<number>} x The abscissa of the data points.38* @param {!Array<number>} y The ordinate of the data points.39*/40goog.math.interpolator.Interpolator1.prototype.setData;414243/**44* Computes the interpolated value at abscissa x. If x is outside the range45* of the data points passed in setData, the value is extrapolated.46* @param {number} x The abscissa to sample at.47* @return {number} The interpolated value at abscissa x.48*/49goog.math.interpolator.Interpolator1.prototype.interpolate;505152/**53* Computes the inverse interpolator. That is, it returns invInterp s.t.54* this.interpolate(invInterp.interpolate(t))) = t. Note that the inverse55* interpolator is only well defined if the data being interpolated is56* 'invertible', i.e. it represents a bijective function.57* In addition, the returned interpolator is only guaranteed to give the exact58* inverse at the input data passed in getData.59* If 'this' has no data, the returned Interpolator will be empty as well.60* @return {!goog.math.interpolator.Interpolator1} The inverse interpolator.61*/62goog.math.interpolator.Interpolator1.prototype.getInverse;636465