fireball/lib/math/interpolants/DiscreteInterpolant.js
2018-12-25 17:29:22 +03:30

31 lines
625 B
JavaScript

import { Interpolant } from '../Interpolant.js';
/**
*
* Interpolant that evaluates to the sample value at the position preceeding
* the parameter.
*
* @author tschw
*/
function DiscreteInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
}
DiscreteInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: DiscreteInterpolant,
interpolate_: function ( i1 /*, t0, t, t1 */ ) {
return this.copySampleValue_( i1 - 1 );
}
} );
export { DiscreteInterpolant };