InterpolationAlgorithm.js 3.0 KB

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