forked from UL-FRI-LGM/RenderCore
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuaternionLinearInterpolant.js
More file actions
executable file
·43 lines (25 loc) · 968 Bytes
/
Copy pathQuaternionLinearInterpolant.js
File metadata and controls
executable file
·43 lines (25 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import { Interpolant } from '../Interpolant.js';
import { Quaternion } from '../Quaternion.js';
/**
* Spherical linear unit quaternion interpolant.
*
* Copyright © 2010-2021 three.js authors
*/
function QuaternionLinearInterpolant( parameterPositions, sampleValues, sampleSize, resultBuffer ) {
Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
}
QuaternionLinearInterpolant.prototype = Object.assign( Object.create( Interpolant.prototype ), {
constructor: QuaternionLinearInterpolant,
interpolate_: function ( i1, t0, t, t1 ) {
var result = this.resultBuffer,
values = this.sampleValues,
stride = this.valueSize,
offset = i1 * stride,
alpha = ( t - t0 ) / ( t1 - t0 );
for ( var end = offset + stride; offset !== end; offset += 4 ) {
Quaternion.slerpFlat( result, 0, values, offset - stride, values, offset, alpha );
}
return result;
}
} );
export { QuaternionLinearInterpolant };