Download node_modules/three/src/math/interpolants/LinearInterpolant.js from SimWorld-AI/industrial-harbor-viewer: direct link, hf CLI and curl.
- Browser
- Download file 704 Bytes
-
https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/math/interpolants/LinearInterpolant.js
- Command line
-
hf download hf://spaces/SimWorld-AI/industrial-harbor-viewer/node_modules/three/src/math/interpolants/LinearInterpolant.js
-
curl -L -o LinearInterpolant.js https://huggingface.co/spaces/SimWorld-AI/industrial-harbor-viewer/resolve/main/node_modules/three/src/math/interpolants/LinearInterpolant.js
704 Bytes
| import { Interpolant } from '../Interpolant.js'; | |
| class LinearInterpolant extends Interpolant { | |
| 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 }; | |