Buckets:

imerfanrajabee's picture
download
raw
1.09 kB
import { Interpolant } from '../Interpolant.js';
/**
* A basic linear interpolant.
*
* @augments Interpolant
*/
class LinearInterpolant extends Interpolant {
/**
* Constructs a new linear interpolant.
*
* @param {TypedArray} parameterPositions - The parameter positions hold the interpolation factors.
* @param {TypedArray} sampleValues - The sample values.
* @param {number} sampleSize - The sample size
* @param {TypedArray} [resultBuffer] - The result buffer.
*/
constructor( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
super( parameterPositions, sampleValues, sampleSize, resultBuffer );
}
interpolate_( i1, t0, t, t1 ) {
const result = this.resultBuffer,
values = this.sampleValues,
stride = this.valueSize,
offset1 = i1 * stride,
offset0 = offset1 - stride,
weight1 = ( t - t0 ) / ( t1 - t0 ),
weight0 = 1 - weight1;
for ( let i = 0; i !== stride; ++ i ) {
result[ i ] =
values[ offset0 + i ] * weight0 +
values[ offset1 + i ] * weight1;
}
return result;
}
}
export { LinearInterpolant };

Xet Storage Details

Size:
1.09 kB
·
Xet hash:
d67ab3db92d64327a51bcf2e32c00e70b3150c0eaca42d9f250c1eab98ded67d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.