@pawells/math-extended 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +319 -0
- package/build/angles.d.ts +31 -0
- package/build/angles.d.ts.map +1 -0
- package/build/angles.js +85 -0
- package/build/angles.js.map +1 -0
- package/build/angles.spec.d.ts +2 -0
- package/build/angles.spec.d.ts.map +1 -0
- package/build/angles.spec.js +147 -0
- package/build/angles.spec.js.map +1 -0
- package/build/clamp.d.ts +17 -0
- package/build/clamp.d.ts.map +1 -0
- package/build/clamp.js +19 -0
- package/build/clamp.js.map +1 -0
- package/build/clamp.spec.d.ts +2 -0
- package/build/clamp.spec.d.ts.map +1 -0
- package/build/clamp.spec.js +19 -0
- package/build/clamp.spec.js.map +1 -0
- package/build/documentation-validation.spec.d.ts +11 -0
- package/build/documentation-validation.spec.d.ts.map +1 -0
- package/build/documentation-validation.spec.js +401 -0
- package/build/documentation-validation.spec.js.map +1 -0
- package/build/index.d.ts +8 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +8 -0
- package/build/index.js.map +1 -0
- package/build/interpolation.d.ts +175 -0
- package/build/interpolation.d.ts.map +1 -0
- package/build/interpolation.js +369 -0
- package/build/interpolation.js.map +1 -0
- package/build/interpolation.spec.d.ts +2 -0
- package/build/interpolation.spec.d.ts.map +1 -0
- package/build/interpolation.spec.js +480 -0
- package/build/interpolation.spec.js.map +1 -0
- package/build/matrices/arithmetic.d.ts +411 -0
- package/build/matrices/arithmetic.d.ts.map +1 -0
- package/build/matrices/arithmetic.js +954 -0
- package/build/matrices/arithmetic.js.map +1 -0
- package/build/matrices/arithmetic.spec.d.ts +2 -0
- package/build/matrices/arithmetic.spec.d.ts.map +1 -0
- package/build/matrices/arithmetic.spec.js +915 -0
- package/build/matrices/arithmetic.spec.js.map +1 -0
- package/build/matrices/asserts.d.ts +306 -0
- package/build/matrices/asserts.d.ts.map +1 -0
- package/build/matrices/asserts.js +396 -0
- package/build/matrices/asserts.js.map +1 -0
- package/build/matrices/asserts.spec.d.ts +2 -0
- package/build/matrices/asserts.spec.d.ts.map +1 -0
- package/build/matrices/asserts.spec.js +565 -0
- package/build/matrices/asserts.spec.js.map +1 -0
- package/build/matrices/core.d.ts +168 -0
- package/build/matrices/core.d.ts.map +1 -0
- package/build/matrices/core.js +457 -0
- package/build/matrices/core.js.map +1 -0
- package/build/matrices/core.spec.d.ts +2 -0
- package/build/matrices/core.spec.d.ts.map +1 -0
- package/build/matrices/core.spec.js +634 -0
- package/build/matrices/core.spec.js.map +1 -0
- package/build/matrices/decompositions.d.ts +326 -0
- package/build/matrices/decompositions.d.ts.map +1 -0
- package/build/matrices/decompositions.js +816 -0
- package/build/matrices/decompositions.js.map +1 -0
- package/build/matrices/decompositions.spec.d.ts +2 -0
- package/build/matrices/decompositions.spec.d.ts.map +1 -0
- package/build/matrices/decompositions.spec.js +195 -0
- package/build/matrices/decompositions.spec.js.map +1 -0
- package/build/matrices/index.d.ts +9 -0
- package/build/matrices/index.d.ts.map +1 -0
- package/build/matrices/index.js +9 -0
- package/build/matrices/index.js.map +1 -0
- package/build/matrices/linear-algebra.d.ts +64 -0
- package/build/matrices/linear-algebra.d.ts.map +1 -0
- package/build/matrices/linear-algebra.js +253 -0
- package/build/matrices/linear-algebra.js.map +1 -0
- package/build/matrices/linear-algebra.spec.d.ts +2 -0
- package/build/matrices/linear-algebra.spec.d.ts.map +1 -0
- package/build/matrices/linear-algebra.spec.js +355 -0
- package/build/matrices/linear-algebra.spec.js.map +1 -0
- package/build/matrices/normalization.d.ts +62 -0
- package/build/matrices/normalization.d.ts.map +1 -0
- package/build/matrices/normalization.js +167 -0
- package/build/matrices/normalization.js.map +1 -0
- package/build/matrices/normalization.spec.d.ts +2 -0
- package/build/matrices/normalization.spec.d.ts.map +1 -0
- package/build/matrices/normalization.spec.js +335 -0
- package/build/matrices/normalization.spec.js.map +1 -0
- package/build/matrices/transformations.d.ts +484 -0
- package/build/matrices/transformations.d.ts.map +1 -0
- package/build/matrices/transformations.js +592 -0
- package/build/matrices/transformations.js.map +1 -0
- package/build/matrices/transformations.spec.d.ts +2 -0
- package/build/matrices/transformations.spec.d.ts.map +1 -0
- package/build/matrices/transformations.spec.js +755 -0
- package/build/matrices/transformations.spec.js.map +1 -0
- package/build/matrices/types.d.ts +134 -0
- package/build/matrices/types.d.ts.map +1 -0
- package/build/matrices/types.js +6 -0
- package/build/matrices/types.js.map +1 -0
- package/build/quaternions/asserts.d.ts +77 -0
- package/build/quaternions/asserts.d.ts.map +1 -0
- package/build/quaternions/asserts.js +175 -0
- package/build/quaternions/asserts.js.map +1 -0
- package/build/quaternions/asserts.spec.d.ts +2 -0
- package/build/quaternions/asserts.spec.d.ts.map +1 -0
- package/build/quaternions/asserts.spec.js +320 -0
- package/build/quaternions/asserts.spec.js.map +1 -0
- package/build/quaternions/conversions.d.ts +73 -0
- package/build/quaternions/conversions.d.ts.map +1 -0
- package/build/quaternions/conversions.js +179 -0
- package/build/quaternions/conversions.js.map +1 -0
- package/build/quaternions/conversions.spec.d.ts +2 -0
- package/build/quaternions/conversions.spec.d.ts.map +1 -0
- package/build/quaternions/conversions.spec.js +344 -0
- package/build/quaternions/conversions.spec.js.map +1 -0
- package/build/quaternions/core.d.ts +203 -0
- package/build/quaternions/core.d.ts.map +1 -0
- package/build/quaternions/core.js +374 -0
- package/build/quaternions/core.js.map +1 -0
- package/build/quaternions/core.spec.d.ts +2 -0
- package/build/quaternions/core.spec.d.ts.map +1 -0
- package/build/quaternions/core.spec.js +294 -0
- package/build/quaternions/core.spec.js.map +1 -0
- package/build/quaternions/index.d.ts +7 -0
- package/build/quaternions/index.d.ts.map +1 -0
- package/build/quaternions/index.js +7 -0
- package/build/quaternions/index.js.map +1 -0
- package/build/quaternions/interpolation.d.ts +54 -0
- package/build/quaternions/interpolation.d.ts.map +1 -0
- package/build/quaternions/interpolation.js +201 -0
- package/build/quaternions/interpolation.js.map +1 -0
- package/build/quaternions/interpolation.spec.d.ts +2 -0
- package/build/quaternions/interpolation.spec.d.ts.map +1 -0
- package/build/quaternions/interpolation.spec.js +64 -0
- package/build/quaternions/interpolation.spec.js.map +1 -0
- package/build/quaternions/predefined.d.ts +36 -0
- package/build/quaternions/predefined.d.ts.map +1 -0
- package/build/quaternions/predefined.js +42 -0
- package/build/quaternions/predefined.js.map +1 -0
- package/build/quaternions/predefined.spec.d.ts +2 -0
- package/build/quaternions/predefined.spec.d.ts.map +1 -0
- package/build/quaternions/predefined.spec.js +35 -0
- package/build/quaternions/predefined.spec.js.map +1 -0
- package/build/quaternions/types.d.ts +55 -0
- package/build/quaternions/types.d.ts.map +1 -0
- package/build/quaternions/types.js +7 -0
- package/build/quaternions/types.js.map +1 -0
- package/build/random.d.ts +66 -0
- package/build/random.d.ts.map +1 -0
- package/build/random.js +115 -0
- package/build/random.js.map +1 -0
- package/build/random.spec.d.ts +2 -0
- package/build/random.spec.d.ts.map +1 -0
- package/build/random.spec.js +267 -0
- package/build/random.spec.js.map +1 -0
- package/build/vectors/asserts.d.ts +182 -0
- package/build/vectors/asserts.d.ts.map +1 -0
- package/build/vectors/asserts.js +285 -0
- package/build/vectors/asserts.js.map +1 -0
- package/build/vectors/asserts.spec.d.ts +2 -0
- package/build/vectors/asserts.spec.d.ts.map +1 -0
- package/build/vectors/asserts.spec.js +260 -0
- package/build/vectors/asserts.spec.js.map +1 -0
- package/build/vectors/core.d.ts +507 -0
- package/build/vectors/core.d.ts.map +1 -0
- package/build/vectors/core.js +825 -0
- package/build/vectors/core.js.map +1 -0
- package/build/vectors/core.spec.d.ts +2 -0
- package/build/vectors/core.spec.d.ts.map +1 -0
- package/build/vectors/core.spec.js +343 -0
- package/build/vectors/core.spec.js.map +1 -0
- package/build/vectors/index.d.ts +6 -0
- package/build/vectors/index.d.ts.map +1 -0
- package/build/vectors/index.js +6 -0
- package/build/vectors/index.js.map +1 -0
- package/build/vectors/interpolation.d.ts +404 -0
- package/build/vectors/interpolation.d.ts.map +1 -0
- package/build/vectors/interpolation.js +585 -0
- package/build/vectors/interpolation.js.map +1 -0
- package/build/vectors/interpolation.spec.d.ts +2 -0
- package/build/vectors/interpolation.spec.d.ts.map +1 -0
- package/build/vectors/interpolation.spec.js +378 -0
- package/build/vectors/interpolation.spec.js.map +1 -0
- package/build/vectors/predefined.d.ts +191 -0
- package/build/vectors/predefined.d.ts.map +1 -0
- package/build/vectors/predefined.js +191 -0
- package/build/vectors/predefined.js.map +1 -0
- package/build/vectors/predefined.spec.d.ts +2 -0
- package/build/vectors/predefined.spec.d.ts.map +1 -0
- package/build/vectors/predefined.spec.js +333 -0
- package/build/vectors/predefined.spec.js.map +1 -0
- package/build/vectors/types.d.ts +62 -0
- package/build/vectors/types.d.ts.map +1 -0
- package/build/vectors/types.js +6 -0
- package/build/vectors/types.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector interpolation functions for smooth animation and transitions.
|
|
3
|
+
* Provides component-wise interpolation using various easing and interpolation algorithms.
|
|
4
|
+
*/
|
|
5
|
+
import { TVector, TVectorResult } from './types.js';
|
|
6
|
+
/**
|
|
7
|
+
* Performs linear interpolation (LERP) between two vectors.
|
|
8
|
+
* The most basic and commonly used interpolation method, providing
|
|
9
|
+
* constant velocity transition between vectors.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The vector type extending TVector
|
|
12
|
+
* @param a - Start vector (when t = 0)
|
|
13
|
+
* @param b - End vector (when t = 1)
|
|
14
|
+
* @param t - Interpolation parameter (0 = a, 1 = b, values outside [0,1] extrapolate)
|
|
15
|
+
* @returns Linearly interpolated vector
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const start = [0, 0, 0];
|
|
19
|
+
* const end = [10, 20, 30];
|
|
20
|
+
* const halfway = VectorLERP(start, end, 0.5); // [5, 10, 15]
|
|
21
|
+
* const quarter = VectorLERP(start, end, 0.25); // [2.5, 5, 7.5]
|
|
22
|
+
*/
|
|
23
|
+
export declare function VectorLERP<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
24
|
+
/**
|
|
25
|
+
* Performs smooth step interpolation between two vectors.
|
|
26
|
+
* Uses Hermite interpolation (3t² - 2t³) for smooth acceleration and deceleration.
|
|
27
|
+
*
|
|
28
|
+
* @template T - The vector type extending TVector
|
|
29
|
+
* @param a - Start vector
|
|
30
|
+
* @param b - End vector
|
|
31
|
+
* @param t - Interpolation parameter (clamped to [0,1])
|
|
32
|
+
* @returns Smoothly interpolated vector with smooth start and end
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* const start = [0, 0];
|
|
36
|
+
* const end = [100, 200];
|
|
37
|
+
* const smooth = VectorSmoothStep(start, end, 0.5); // Smooth transition
|
|
38
|
+
*/
|
|
39
|
+
export declare function VectorSmoothStep<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Performs smoother step interpolation between two vectors.
|
|
42
|
+
* Uses Ken Perlin's improved smoothstep (6t⁵ - 15t⁴ + 10t³) for even smoother transitions.
|
|
43
|
+
*
|
|
44
|
+
* @template T - The vector type extending TVector
|
|
45
|
+
* @param a - Start vector
|
|
46
|
+
* @param b - End vector
|
|
47
|
+
* @param t - Interpolation parameter (clamped to [0,1])
|
|
48
|
+
* @returns Very smoothly interpolated vector with smooth acceleration/deceleration
|
|
49
|
+
*/
|
|
50
|
+
export declare function VectorSmootherStep<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
51
|
+
/**
|
|
52
|
+
* Performs quadratic ease-in interpolation between two vectors.
|
|
53
|
+
* Starts slowly and accelerates toward the end (t²).
|
|
54
|
+
*
|
|
55
|
+
* @template T - The vector type extending TVector
|
|
56
|
+
* @param a - Start vector
|
|
57
|
+
* @param b - End vector
|
|
58
|
+
* @param t - Interpolation parameter [0,1]
|
|
59
|
+
* @returns Vector with quadratic acceleration from start
|
|
60
|
+
*/
|
|
61
|
+
export declare function VectorQuadraticEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
62
|
+
/**
|
|
63
|
+
* Performs quadratic ease-out interpolation between two vectors.
|
|
64
|
+
* Starts quickly and decelerates toward the end (1 - (1-t)²).
|
|
65
|
+
*
|
|
66
|
+
* @template T - The vector type extending TVector
|
|
67
|
+
* @param a - Start vector
|
|
68
|
+
* @param b - End vector
|
|
69
|
+
* @param t - Interpolation parameter [0,1]
|
|
70
|
+
* @returns Vector with quadratic deceleration toward end
|
|
71
|
+
*/
|
|
72
|
+
export declare function VectorQuadraticEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
73
|
+
/**
|
|
74
|
+
* Performs cubic ease-in interpolation between two vectors.
|
|
75
|
+
* Starts very slowly and accelerates toward the end (t³).
|
|
76
|
+
*
|
|
77
|
+
* @template T - The vector type extending TVector
|
|
78
|
+
* @param a - Start vector
|
|
79
|
+
* @param b - End vector
|
|
80
|
+
* @param t - Interpolation parameter [0,1]
|
|
81
|
+
* @returns Vector with cubic acceleration from start
|
|
82
|
+
*/
|
|
83
|
+
export declare function VectorCubicEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
84
|
+
/**
|
|
85
|
+
* Performs cubic ease-out interpolation between two vectors.
|
|
86
|
+
* Starts quickly and decelerates toward the end (1 - (1-t)³).
|
|
87
|
+
*
|
|
88
|
+
* @template T - The vector type extending TVector
|
|
89
|
+
* @param a - Start vector
|
|
90
|
+
* @param b - End vector
|
|
91
|
+
* @param t - Interpolation parameter [0,1]
|
|
92
|
+
* @returns Vector with cubic deceleration toward end
|
|
93
|
+
*/
|
|
94
|
+
export declare function VectorCubicEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
95
|
+
/**
|
|
96
|
+
* Performs cosine-based interpolation between two vectors.
|
|
97
|
+
* Uses cosine function for smooth, natural-feeling transitions.
|
|
98
|
+
*
|
|
99
|
+
* @template T - The vector type extending TVector
|
|
100
|
+
* @param a - Start vector
|
|
101
|
+
* @param b - End vector
|
|
102
|
+
* @param t - Interpolation parameter [0,1]
|
|
103
|
+
* @returns Vector interpolated using cosine curve
|
|
104
|
+
*/
|
|
105
|
+
export declare function VectorCosineInterpolation<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
106
|
+
/**
|
|
107
|
+
* Performs sine ease-in interpolation between two vectors.
|
|
108
|
+
* Starts slowly and accelerates using sine curve.
|
|
109
|
+
*
|
|
110
|
+
* @template T - The vector type extending TVector
|
|
111
|
+
* @param a - Start vector
|
|
112
|
+
* @param b - End vector
|
|
113
|
+
* @param t - Interpolation parameter [0,1]
|
|
114
|
+
* @returns Vector with sine-based acceleration from start
|
|
115
|
+
*/
|
|
116
|
+
export declare function VectorSineEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
117
|
+
/**
|
|
118
|
+
* Performs sine ease-out interpolation between two vectors.
|
|
119
|
+
* Starts quickly and decelerates using sine curve.
|
|
120
|
+
*
|
|
121
|
+
* @template T - The vector type extending TVector
|
|
122
|
+
* @param a - Start vector
|
|
123
|
+
* @param b - End vector
|
|
124
|
+
* @param t - Interpolation parameter [0,1]
|
|
125
|
+
* @returns Vector with sine-based deceleration toward end
|
|
126
|
+
*/
|
|
127
|
+
export declare function VectorSineEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
128
|
+
/**
|
|
129
|
+
* Performs exponential ease-in interpolation between two vectors.
|
|
130
|
+
* Starts very slowly and accelerates exponentially.
|
|
131
|
+
*
|
|
132
|
+
* @template T - The vector type extending TVector
|
|
133
|
+
* @param a - Start vector
|
|
134
|
+
* @param b - End vector
|
|
135
|
+
* @param t - Interpolation parameter [0,1]
|
|
136
|
+
* @returns Vector with exponential acceleration from start
|
|
137
|
+
*/
|
|
138
|
+
export declare function VectorExponentialEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
139
|
+
/**
|
|
140
|
+
* Performs exponential ease-out interpolation between two vectors.
|
|
141
|
+
* Starts quickly and decelerates exponentially.
|
|
142
|
+
*
|
|
143
|
+
* @template T - The vector type extending TVector
|
|
144
|
+
* @param a - Start vector
|
|
145
|
+
* @param b - End vector
|
|
146
|
+
* @param t - Interpolation parameter [0,1]
|
|
147
|
+
* @returns Vector with exponential deceleration toward end
|
|
148
|
+
*/
|
|
149
|
+
export declare function VectorExponentialEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
150
|
+
/**
|
|
151
|
+
* Performs elastic ease-out interpolation between two vectors.
|
|
152
|
+
* Creates a springy, elastic effect that overshoots and bounces back.
|
|
153
|
+
*
|
|
154
|
+
* @template T - The vector type extending TVector
|
|
155
|
+
* @param a - Start vector
|
|
156
|
+
* @param b - End vector
|
|
157
|
+
* @param t - Interpolation parameter [0,1]
|
|
158
|
+
* @returns Vector with elastic bounce effect toward end
|
|
159
|
+
*/
|
|
160
|
+
export declare function VectorElasticEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
161
|
+
/**
|
|
162
|
+
* Performs back ease-out interpolation between two vectors.
|
|
163
|
+
* Overshoots the target and then backs into place, like a spring.
|
|
164
|
+
*
|
|
165
|
+
* @template T - The vector type extending TVector
|
|
166
|
+
* @param a - Start vector
|
|
167
|
+
* @param b - End vector
|
|
168
|
+
* @param t - Interpolation parameter [0,1]
|
|
169
|
+
* @returns Vector with back overshoot effect toward end
|
|
170
|
+
*/
|
|
171
|
+
export declare function VectorBackEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
172
|
+
/**
|
|
173
|
+
* Performs bounce ease-out interpolation between two vectors.
|
|
174
|
+
* Creates a bouncing ball effect with decreasing amplitude.
|
|
175
|
+
*
|
|
176
|
+
* @template T - The vector type extending TVector
|
|
177
|
+
* @param a - Start vector
|
|
178
|
+
* @param b - End vector
|
|
179
|
+
* @param t - Interpolation parameter [0,1]
|
|
180
|
+
* @returns Vector with bouncing effect toward end
|
|
181
|
+
*/
|
|
182
|
+
export declare function VectorBounceEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
183
|
+
/**
|
|
184
|
+
* Performs Catmull-Rom spline interpolation between vectors for smooth curves.
|
|
185
|
+
* Uses four control points to create smooth curves through p1 and p2.
|
|
186
|
+
*
|
|
187
|
+
* @template T - The vector type extending TVector
|
|
188
|
+
* @param p0 - Previous control point
|
|
189
|
+
* @param p1 - Start point (returned when t = 0)
|
|
190
|
+
* @param p2 - End point (returned when t = 1)
|
|
191
|
+
* @param p3 - Next control point
|
|
192
|
+
* @param t - Interpolation parameter [0,1]
|
|
193
|
+
* @returns Smoothly interpolated vector using Catmull-Rom spline
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* const path = [
|
|
197
|
+
* [0, 0], // p0 - previous point
|
|
198
|
+
* [10, 0], // p1 - start
|
|
199
|
+
* [20, 10], // p2 - end
|
|
200
|
+
* [30, 10] // p3 - next point
|
|
201
|
+
* ];
|
|
202
|
+
* const smooth = VectorCatmullRomInterpolation(...path, 0.5);
|
|
203
|
+
*/
|
|
204
|
+
export declare function VectorCatmullRomInterpolation<T extends TVector>(p0: T, p1: T, p2: T, p3: T, t: number): TVectorResult<T>;
|
|
205
|
+
/**
|
|
206
|
+
* Performs Hermite interpolation between vectors with tangent control.
|
|
207
|
+
* Provides precise control over the curve's tangent vectors at start and end points.
|
|
208
|
+
*
|
|
209
|
+
* @template T - The vector type extending TVector
|
|
210
|
+
* @param p0 - Start point (returned when t = 0)
|
|
211
|
+
* @param p1 - End point (returned when t = 1)
|
|
212
|
+
* @param t0 - Tangent vector at start point
|
|
213
|
+
* @param t1 - Tangent vector at end point
|
|
214
|
+
* @param t - Interpolation parameter [0,1]
|
|
215
|
+
* @returns Vector interpolated using Hermite spline with tangent control
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* const start = [0, 0];
|
|
219
|
+
* const end = [10, 10];
|
|
220
|
+
* const startTangent = [5, 0]; // Horizontal tangent at start
|
|
221
|
+
* const endTangent = [0, 5]; // Vertical tangent at end
|
|
222
|
+
* const curved = VectorHermiteInterpolation(start, end, startTangent, endTangent, 0.5);
|
|
223
|
+
*/
|
|
224
|
+
export declare function VectorHermiteInterpolation<T extends TVector>(p0: T, p1: T, t0: T, t1: T, t: number): TVectorResult<T>;
|
|
225
|
+
/**
|
|
226
|
+
* Performs circular ease-in interpolation between two vectors.
|
|
227
|
+
* Starts very slowly and accelerates using a circular arc.
|
|
228
|
+
*
|
|
229
|
+
* @template T - The vector type extending TVector
|
|
230
|
+
* @param a - Start vector
|
|
231
|
+
* @param b - End vector
|
|
232
|
+
* @param t - Interpolation parameter [0,1]
|
|
233
|
+
* @returns Vector with circular acceleration from start
|
|
234
|
+
*/
|
|
235
|
+
export declare function VectorCircularEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
236
|
+
/**
|
|
237
|
+
* Performs circular ease-out interpolation between two vectors.
|
|
238
|
+
* Starts quickly and decelerates using a circular arc.
|
|
239
|
+
*
|
|
240
|
+
* @template T - The vector type extending TVector
|
|
241
|
+
* @param a - Start vector
|
|
242
|
+
* @param b - End vector
|
|
243
|
+
* @param t - Interpolation parameter [0,1]
|
|
244
|
+
* @returns Vector with circular deceleration toward end
|
|
245
|
+
*/
|
|
246
|
+
export declare function VectorCircularEaseOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
247
|
+
/**
|
|
248
|
+
* Performs step interpolation between two vectors.
|
|
249
|
+
* Abruptly switches from start to end vector at the specified threshold.
|
|
250
|
+
*
|
|
251
|
+
* @template T - The vector type extending TVector
|
|
252
|
+
* @param a - Start vector (returned when t < threshold)
|
|
253
|
+
* @param b - End vector (returned when t >= threshold)
|
|
254
|
+
* @param t - Interpolation parameter [0,1]
|
|
255
|
+
* @param threshold - Threshold value for the step (default: 0.5)
|
|
256
|
+
* @returns Either the start or end vector based on threshold comparison
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* const off = [0, 0];
|
|
260
|
+
* const on = [1, 1];
|
|
261
|
+
* const result1 = VectorStepInterpolation(off, on, 0.3); // [0, 0] (< 0.5)
|
|
262
|
+
* const result2 = VectorStepInterpolation(off, on, 0.7); // [1, 1] (>= 0.5)
|
|
263
|
+
*/
|
|
264
|
+
export declare function VectorStepInterpolation<T extends TVector>(a: T, b: T, t: number, threshold?: number): TVectorResult<T>;
|
|
265
|
+
/**
|
|
266
|
+
* Performs quadratic ease-in-out interpolation between two vectors.
|
|
267
|
+
* Symmetrically accelerates at the start and decelerates at the end (2t² / 1−(−2t+2)²/2).
|
|
268
|
+
*
|
|
269
|
+
* @template T - The vector type extending TVector
|
|
270
|
+
* @param a - Start vector
|
|
271
|
+
* @param b - End vector
|
|
272
|
+
* @param t - Interpolation parameter [0,1]
|
|
273
|
+
* @returns Component-wise interpolated vector with quadratic symmetric easing
|
|
274
|
+
*/
|
|
275
|
+
export declare function VectorQuadraticEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
276
|
+
/**
|
|
277
|
+
* Performs cubic ease-in-out interpolation between two vectors.
|
|
278
|
+
* More pronounced symmetrical acceleration/deceleration than quadratic (4t³ / 1−(−2t+2)³/2).
|
|
279
|
+
*
|
|
280
|
+
* @template T - The vector type extending TVector
|
|
281
|
+
* @param a - Start vector
|
|
282
|
+
* @param b - End vector
|
|
283
|
+
* @param t - Interpolation parameter [0,1]
|
|
284
|
+
* @returns Component-wise interpolated vector with cubic symmetric easing
|
|
285
|
+
*/
|
|
286
|
+
export declare function VectorCubicEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
287
|
+
/**
|
|
288
|
+
* Performs sine ease-in-out interpolation between two vectors.
|
|
289
|
+
* Smooth symmetric easing based on a cosine curve — gentle and natural feeling.
|
|
290
|
+
*
|
|
291
|
+
* @template T - The vector type extending TVector
|
|
292
|
+
* @param a - Start vector
|
|
293
|
+
* @param b - End vector
|
|
294
|
+
* @param t - Interpolation parameter [0,1]
|
|
295
|
+
* @returns Component-wise interpolated vector with sine symmetric easing
|
|
296
|
+
*/
|
|
297
|
+
export declare function VectorSineEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
298
|
+
/**
|
|
299
|
+
* Performs exponential ease-in-out interpolation between two vectors.
|
|
300
|
+
* Very slow at both ends with an extremely rapid transition in the middle.
|
|
301
|
+
*
|
|
302
|
+
* @template T - The vector type extending TVector
|
|
303
|
+
* @param a - Start vector
|
|
304
|
+
* @param b - End vector
|
|
305
|
+
* @param t - Interpolation parameter [0,1]
|
|
306
|
+
* @returns Component-wise interpolated vector with exponential symmetric easing
|
|
307
|
+
*/
|
|
308
|
+
export declare function VectorExponentialEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
309
|
+
/**
|
|
310
|
+
* Performs circular ease-in-out interpolation between two vectors.
|
|
311
|
+
* Smooth symmetric arc-based easing using a circular curve.
|
|
312
|
+
*
|
|
313
|
+
* @template T - The vector type extending TVector
|
|
314
|
+
* @param a - Start vector
|
|
315
|
+
* @param b - End vector
|
|
316
|
+
* @param t - Interpolation parameter [0,1]
|
|
317
|
+
* @returns Component-wise interpolated vector with circular symmetric easing
|
|
318
|
+
*/
|
|
319
|
+
export declare function VectorCircularEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
320
|
+
/**
|
|
321
|
+
* Performs elastic ease-in interpolation between two vectors.
|
|
322
|
+
* Spring-like acceleration from rest — starts with a backward bounce then launches forward.
|
|
323
|
+
*
|
|
324
|
+
* @template T - The vector type extending TVector
|
|
325
|
+
* @param a - Start vector
|
|
326
|
+
* @param b - End vector
|
|
327
|
+
* @param t - Interpolation parameter [0,1]
|
|
328
|
+
* @returns Component-wise interpolated vector with elastic acceleration from start
|
|
329
|
+
*/
|
|
330
|
+
export declare function VectorElasticEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
331
|
+
/**
|
|
332
|
+
* Performs elastic ease-in-out interpolation between two vectors.
|
|
333
|
+
* Spring-like oscillation at both the start and end of the motion.
|
|
334
|
+
*
|
|
335
|
+
* @template T - The vector type extending TVector
|
|
336
|
+
* @param a - Start vector
|
|
337
|
+
* @param b - End vector
|
|
338
|
+
* @param t - Interpolation parameter [0,1]
|
|
339
|
+
* @returns Component-wise interpolated vector with elastic oscillation at both ends
|
|
340
|
+
*/
|
|
341
|
+
export declare function VectorElasticEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
342
|
+
/**
|
|
343
|
+
* Performs back ease-in interpolation between two vectors.
|
|
344
|
+
* Applies a slight backward pull before launching forward from the start.
|
|
345
|
+
*
|
|
346
|
+
* @template T - The vector type extending TVector
|
|
347
|
+
* @param a - Start vector
|
|
348
|
+
* @param b - End vector
|
|
349
|
+
* @param t - Interpolation parameter [0,1]
|
|
350
|
+
* @returns Component-wise interpolated vector with back overshoot at start
|
|
351
|
+
*/
|
|
352
|
+
export declare function VectorBackEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
353
|
+
/**
|
|
354
|
+
* Performs back ease-in-out interpolation between two vectors.
|
|
355
|
+
* Slight backward pull at both ends before and after the main forward motion.
|
|
356
|
+
*
|
|
357
|
+
* @template T - The vector type extending TVector
|
|
358
|
+
* @param a - Start vector
|
|
359
|
+
* @param b - End vector
|
|
360
|
+
* @param t - Interpolation parameter [0,1]
|
|
361
|
+
* @returns Component-wise interpolated vector with back overshoot at both ends
|
|
362
|
+
*/
|
|
363
|
+
export declare function VectorBackEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
364
|
+
/**
|
|
365
|
+
* Performs bounce ease-in interpolation between two vectors.
|
|
366
|
+
* Bouncing ball effect at the start — multiple bounces before settling at the target.
|
|
367
|
+
*
|
|
368
|
+
* @template T - The vector type extending TVector
|
|
369
|
+
* @param a - Start vector
|
|
370
|
+
* @param b - End vector
|
|
371
|
+
* @param t - Interpolation parameter [0,1]
|
|
372
|
+
* @returns Component-wise interpolated vector with bounce effect at start
|
|
373
|
+
*/
|
|
374
|
+
export declare function VectorBounceEaseIn<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
375
|
+
/**
|
|
376
|
+
* Performs bounce ease-in-out interpolation between two vectors.
|
|
377
|
+
* Bouncing ball effect at both the start and end of the motion.
|
|
378
|
+
*
|
|
379
|
+
* @template T - The vector type extending TVector
|
|
380
|
+
* @param a - Start vector
|
|
381
|
+
* @param b - End vector
|
|
382
|
+
* @param t - Interpolation parameter [0,1]
|
|
383
|
+
* @returns Component-wise interpolated vector with bounce effect at both ends
|
|
384
|
+
*/
|
|
385
|
+
export declare function VectorBounceEaseInOut<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
386
|
+
/**
|
|
387
|
+
* Performs spherical linear interpolation (SLERP) between two vectors.
|
|
388
|
+
* Interpolates along the shortest path on the unit sphere, maintaining constant angular velocity.
|
|
389
|
+
* Particularly useful for smooth rotation interpolation and direction vectors.
|
|
390
|
+
*
|
|
391
|
+
* @template T - The vector type extending TVector
|
|
392
|
+
* @param a - Start vector (will be normalized internally)
|
|
393
|
+
* @param b - End vector (will be normalized internally)
|
|
394
|
+
* @param t - Interpolation parameter (0 = a, 1 = b, allows extrapolation)
|
|
395
|
+
* @returns Spherically interpolated vector maintaining unit length
|
|
396
|
+
*
|
|
397
|
+
* @example
|
|
398
|
+
* const dir1 = [1, 0, 0];
|
|
399
|
+
* const dir2 = [0, 1, 0];
|
|
400
|
+
* const slerp = VectorSphericalLinearInterpolation(dir1, dir2, 0.5);
|
|
401
|
+
* // Result maintains unit length and follows shortest spherical path
|
|
402
|
+
*/
|
|
403
|
+
export declare function VectorSphericalLinearInterpolation<T extends TVector>(a: T, b: T, t: number): TVectorResult<T>;
|
|
404
|
+
//# sourceMappingURL=interpolation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interpolation.d.ts","sourceRoot":"","sources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