fireball/lib/math/interpolants/DiscreteInterpolant.js

31 lines
625 B
JavaScript
Raw Normal View History

2018-12-25 13:59:22 +00:00
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 };