InterpolationAlgorithm.js 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import DeveloperError from './DeveloperError.js';
  2. /**
  3. * The interface for interpolation algorithms.
  4. *
  5. * @exports InterpolationAlgorithm
  6. *
  7. * @see LagrangePolynomialApproximation
  8. * @see LinearApproximation
  9. * @see HermitePolynomialApproximation
  10. */
  11. var InterpolationAlgorithm = {};
  12. /**
  13. * Gets the name of this interpolation algorithm.
  14. * @type {String}
  15. */
  16. InterpolationAlgorithm.type = undefined;
  17. /**
  18. * Given the desired degree, returns the number of data points required for interpolation.
  19. * @function
  20. *
  21. * @param {Number} degree The desired degree of interpolation.
  22. * @returns {Number} The number of required data points needed for the desired degree of interpolation.
  23. */
  24. InterpolationAlgorithm.getRequiredDataPoints = DeveloperError.throwInstantiationError;
  25. /**
  26. * Performs zero order interpolation.
  27. * @function
  28. *
  29. * @param {Number} x The independent variable for which the dependent variables will be interpolated.
  30. * @param {Number[]} xTable The array of independent variables to use to interpolate. The values
  31. * in this array must be in increasing order and the same value must not occur twice in the array.
  32. * @param {Number[]} yTable The array of dependent variables to use to interpolate. For a set of three
  33. * dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
  34. * @param {Number} yStride The number of dependent variable values in yTable corresponding to
  35. * each independent variable value in xTable.
  36. * @param {Number[]} [result] An existing array into which to store the result.
  37. *
  38. * @returns {Number[]} The array of interpolated values, or the result parameter if one was provided.
  39. */
  40. InterpolationAlgorithm.interpolateOrderZero = DeveloperError.throwInstantiationError;
  41. /**
  42. * Performs higher order interpolation. Not all interpolators need to support high-order interpolation,
  43. * if this function remains undefined on implementing objects, interpolateOrderZero will be used instead.
  44. * @function
  45. * @param {Number} x The independent variable for which the dependent variables will be interpolated.
  46. * @param {Number[]} xTable The array of independent variables to use to interpolate. The values
  47. * in this array must be in increasing order and the same value must not occur twice in the array.
  48. * @param {Number[]} yTable The array of dependent variables to use to interpolate. For a set of three
  49. * dependent values (p,q,w) at time 1 and time 2 this should be as follows: {p1, q1, w1, p2, q2, w2}.
  50. * @param {Number} yStride The number of dependent variable values in yTable corresponding to
  51. * each independent variable value in xTable.
  52. * @param {Number} inputOrder The number of derivatives supplied for input.
  53. * @param {Number} outputOrder The number of derivatives desired for output.
  54. * @param {Number[]} [result] An existing array into which to store the result.
  55. * @returns {Number[]} The array of interpolated values, or the result parameter if one was provided.
  56. */
  57. InterpolationAlgorithm.interpolate = DeveloperError.throwInstantiationError;
  58. export default InterpolationAlgorithm;