@lakuna/umath 1.3.5 → 1.3.6
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 +1 -1
- package/dist/algorithms/combinations.d.ts +7 -0
- package/dist/algorithms/combinations.d.ts.map +1 -1
- package/dist/algorithms/combinations.js +7 -0
- package/dist/algorithms/combinations.js.map +1 -1
- package/dist/algorithms/degreesToRadians.d.ts +7 -0
- package/dist/algorithms/degreesToRadians.d.ts.map +1 -1
- package/dist/algorithms/degreesToRadians.js +7 -0
- package/dist/algorithms/degreesToRadians.js.map +1 -1
- package/dist/algorithms/factorial.d.ts +6 -0
- package/dist/algorithms/factorial.d.ts.map +1 -1
- package/dist/algorithms/factorial.js +8 -1
- package/dist/algorithms/factorial.js.map +1 -1
- package/dist/algorithms/fibonacci.d.ts +6 -1
- package/dist/algorithms/fibonacci.d.ts.map +1 -1
- package/dist/algorithms/fibonacci.js +5 -0
- package/dist/algorithms/fibonacci.js.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.d.ts +14 -0
- package/dist/algorithms/greatestCommonDivisor.d.ts.map +1 -1
- package/dist/algorithms/greatestCommonDivisor.js +2 -0
- package/dist/algorithms/greatestCommonDivisor.js.map +1 -1
- package/dist/algorithms/hypergeometricPmf.d.ts +9 -0
- package/dist/algorithms/hypergeometricPmf.d.ts.map +1 -1
- package/dist/algorithms/hypergeometricPmf.js +9 -0
- package/dist/algorithms/hypergeometricPmf.js.map +1 -1
- package/dist/algorithms/isPrime.d.ts +6 -0
- package/dist/algorithms/isPrime.d.ts.map +1 -1
- package/dist/algorithms/isPrime.js +7 -0
- package/dist/algorithms/isPrime.js.map +1 -1
- package/dist/algorithms/permutations.d.ts +7 -0
- package/dist/algorithms/permutations.d.ts.map +1 -1
- package/dist/algorithms/permutations.js +7 -0
- package/dist/algorithms/permutations.js.map +1 -1
- package/dist/algorithms/primeFactorization.d.ts +6 -0
- package/dist/algorithms/primeFactorization.d.ts.map +1 -1
- package/dist/algorithms/primeFactorization.js +6 -0
- package/dist/algorithms/primeFactorization.js.map +1 -1
- package/dist/algorithms/radiansToDegrees.d.ts +7 -0
- package/dist/algorithms/radiansToDegrees.d.ts.map +1 -1
- package/dist/algorithms/radiansToDegrees.js +7 -0
- package/dist/algorithms/radiansToDegrees.js.map +1 -1
- package/dist/algorithms/summation.d.ts +8 -0
- package/dist/algorithms/summation.d.ts.map +1 -1
- package/dist/algorithms/summation.js +9 -0
- package/dist/algorithms/summation.js.map +1 -1
- package/dist/linalg/DualQuaternion.d.ts +410 -27
- package/dist/linalg/DualQuaternion.d.ts.map +1 -1
- package/dist/linalg/DualQuaternion.js +429 -54
- package/dist/linalg/DualQuaternion.js.map +1 -1
- package/dist/linalg/Matrix.d.ts +67 -0
- package/dist/linalg/Matrix.d.ts.map +1 -1
- package/dist/linalg/Matrix2.d.ts +309 -20
- package/dist/linalg/Matrix2.d.ts.map +1 -1
- package/dist/linalg/Matrix2.js +321 -40
- package/dist/linalg/Matrix2.js.map +1 -1
- package/dist/linalg/Matrix3.d.ts +424 -26
- package/dist/linalg/Matrix3.d.ts.map +1 -1
- package/dist/linalg/Matrix3.js +437 -52
- package/dist/linalg/Matrix3.js.map +1 -1
- package/dist/linalg/Matrix4.d.ts +766 -42
- package/dist/linalg/Matrix4.d.ts.map +1 -1
- package/dist/linalg/Matrix4.js +789 -84
- package/dist/linalg/Matrix4.js.map +1 -1
- package/dist/linalg/Quaternion.d.ts +359 -21
- package/dist/linalg/Quaternion.d.ts.map +1 -1
- package/dist/linalg/Quaternion.js +380 -42
- package/dist/linalg/Quaternion.js.map +1 -1
- package/dist/linalg/SlowMatrix.d.ts +70 -0
- package/dist/linalg/SlowMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowMatrix.js +71 -0
- package/dist/linalg/SlowMatrix.js.map +1 -1
- package/dist/linalg/SlowSquareMatrix.d.ts +55 -0
- package/dist/linalg/SlowSquareMatrix.d.ts.map +1 -1
- package/dist/linalg/SlowSquareMatrix.js +58 -0
- package/dist/linalg/SlowSquareMatrix.js.map +1 -1
- package/dist/linalg/SquareMatrix.d.ts +23 -0
- package/dist/linalg/SquareMatrix.d.ts.map +1 -1
- package/dist/linalg/Vector.d.ts +123 -0
- package/dist/linalg/Vector.d.ts.map +1 -1
- package/dist/linalg/Vector2.d.ts +450 -33
- package/dist/linalg/Vector2.d.ts.map +1 -1
- package/dist/linalg/Vector2.js +480 -66
- package/dist/linalg/Vector2.js.map +1 -1
- package/dist/linalg/Vector3.d.ts +542 -38
- package/dist/linalg/Vector3.d.ts.map +1 -1
- package/dist/linalg/Vector3.js +579 -76
- package/dist/linalg/Vector3.js.map +1 -1
- package/dist/linalg/Vector4.d.ts +416 -30
- package/dist/linalg/Vector4.d.ts.map +1 -1
- package/dist/linalg/Vector4.js +441 -60
- package/dist/linalg/Vector4.js.map +1 -1
- package/dist/types/AxisAngle.d.ts +3 -0
- package/dist/types/AxisAngle.d.ts.map +1 -1
- package/dist/types/FieldOfView.d.ts +5 -0
- package/dist/types/FieldOfView.d.ts.map +1 -1
- package/dist/utility/BigNumber.d.ts +36 -0
- package/dist/utility/BigNumber.d.ts.map +1 -1
- package/dist/utility/BigNumber.js +42 -0
- package/dist/utility/BigNumber.js.map +1 -1
- package/dist/utility/MagnitudeError.d.ts +5 -0
- package/dist/utility/MagnitudeError.d.ts.map +1 -1
- package/dist/utility/MagnitudeError.js +5 -0
- package/dist/utility/MagnitudeError.js.map +1 -1
- package/dist/utility/MatrixSizeError.d.ts +5 -0
- package/dist/utility/MatrixSizeError.d.ts.map +1 -1
- package/dist/utility/MatrixSizeError.js +5 -0
- package/dist/utility/MatrixSizeError.js.map +1 -1
- package/dist/utility/PartialMatrixError.d.ts +5 -0
- package/dist/utility/PartialMatrixError.d.ts.map +1 -1
- package/dist/utility/PartialMatrixError.js +5 -0
- package/dist/utility/PartialMatrixError.js.map +1 -1
- package/dist/utility/SingularMatrixError.d.ts +8 -0
- package/dist/utility/SingularMatrixError.d.ts.map +1 -1
- package/dist/utility/SingularMatrixError.js +8 -0
- package/dist/utility/SingularMatrixError.js.map +1 -1
- package/dist/utility/epsilon.d.ts +1 -0
- package/dist/utility/epsilon.d.ts.map +1 -1
- package/dist/utility/epsilon.js +1 -0
- package/dist/utility/epsilon.js.map +1 -1
- package/package.json +1 -1
- package/src/algorithms/combinations.ts +1 -1
- package/src/algorithms/degreesToRadians.ts +1 -1
- package/src/algorithms/factorial.ts +1 -1
- package/src/algorithms/fibonacci.ts +1 -1
- package/src/algorithms/hypergeometricPmf.ts +1 -1
- package/src/algorithms/isPrime.ts +1 -1
- package/src/algorithms/permutations.ts +1 -1
- package/src/algorithms/primeFactorization.ts +1 -1
- package/src/algorithms/radiansToDegrees.ts +1 -1
- package/src/algorithms/summation.ts +1 -1
- package/src/linalg/DualQuaternion.ts +114 -108
- package/src/linalg/Matrix2.ts +82 -69
- package/src/linalg/Matrix3.ts +106 -93
- package/src/linalg/Matrix4.ts +170 -154
- package/src/linalg/Quaternion.ts +95 -91
- package/src/linalg/SlowMatrix.ts +13 -13
- package/src/linalg/SlowSquareMatrix.ts +11 -11
- package/src/linalg/Vector2.ts +129 -115
- package/src/linalg/Vector3.ts +151 -134
- package/src/linalg/Vector4.ts +120 -103
- package/src/utility/BigNumber.ts +7 -7
|
@@ -1,70 +1,408 @@
|
|
|
1
1
|
import { type Matrix3Like } from "./Matrix3.js";
|
|
2
2
|
import type AxisAngle from "../types/AxisAngle.js";
|
|
3
3
|
import type { Vector3Like } from "./Vector3.js";
|
|
4
|
+
/** A complex number that is commonly used to describe rotations. */
|
|
4
5
|
export interface QuaternionLike extends Record<number, number> {
|
|
6
|
+
/** The first component of this quaternion. */
|
|
5
7
|
0: number;
|
|
8
|
+
/** The second component of this quaternion. */
|
|
6
9
|
1: number;
|
|
10
|
+
/** The third component of this quaternion. */
|
|
7
11
|
2: number;
|
|
12
|
+
/** The fourth component of this quaternion. */
|
|
8
13
|
3: number;
|
|
9
14
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export declare
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
15
|
+
/**
|
|
16
|
+
* Create a quaternion-like object.
|
|
17
|
+
* @returns A quaternion-like object.
|
|
18
|
+
*/
|
|
19
|
+
export declare const createQuaternionLike: () => QuaternionLike;
|
|
20
|
+
/**
|
|
21
|
+
* Create a quaternion from a three-by-three rotation matrix.
|
|
22
|
+
* @param matrix - The matrix.
|
|
23
|
+
* @param out - The quaternion to store the result in.
|
|
24
|
+
* @returns The quaternion.
|
|
25
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
26
|
+
*/
|
|
27
|
+
export declare const fromMatrix3: <T extends QuaternionLike>(matrix: Matrix3Like, out: T) => T;
|
|
28
|
+
/**
|
|
29
|
+
* Create a quaternion from equivalent X-Y-Z Tait-Bryan angles
|
|
30
|
+
* @param x - The X angle.
|
|
31
|
+
* @param y - The Y angle.
|
|
32
|
+
* @param z - The Z angle.
|
|
33
|
+
* @param out - The quaternion to store the result in.
|
|
34
|
+
* @returns The quaternion.
|
|
35
|
+
* @see [Euler angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
36
|
+
*/
|
|
37
|
+
export declare const fromEuler: <T extends QuaternionLike>(x: number, y: number, z: number, out: T) => T;
|
|
38
|
+
/**
|
|
39
|
+
* Create a quaternion with values corresponding to the given orthonormal set of vectors.
|
|
40
|
+
* @param view - The vector representing the viewing direction.
|
|
41
|
+
* @param right - The vector representing the local "right" direction.
|
|
42
|
+
* @param up - The vector representing the local "up" direction.
|
|
43
|
+
* @param out - The quaternion to store the result in.
|
|
44
|
+
* @returns The quaternion.
|
|
45
|
+
*/
|
|
46
|
+
export declare const fromAxes: <T extends QuaternionLike>(view: Vector3Like, right: Vector3Like, up: Vector3Like, out: T) => T;
|
|
47
|
+
/**
|
|
48
|
+
* Set a quaternion to the identity.
|
|
49
|
+
* @param out - The quaternion to store the result in.
|
|
50
|
+
* @returns This quaternion.
|
|
51
|
+
*/
|
|
52
|
+
export declare const identity: <T extends QuaternionLike>(out: T) => T;
|
|
53
|
+
/**
|
|
54
|
+
* Calculate the axis and angle that represent a quaternion.
|
|
55
|
+
* @param quaternion - The quaternion.
|
|
56
|
+
* @param out - The axis and angle to store the result in.
|
|
57
|
+
* @returns The axis and angle.
|
|
58
|
+
*/
|
|
59
|
+
export declare const getAxisAngle: <T extends AxisAngle>(quaternion: QuaternionLike, out: T) => T;
|
|
60
|
+
/**
|
|
61
|
+
* Set the axis and angle that represent a quaternion.
|
|
62
|
+
* @param axisAngle - The axis and angle.
|
|
63
|
+
* @param out - The quaternion to store the result in.
|
|
64
|
+
* @returns The quaternion.
|
|
65
|
+
*/
|
|
66
|
+
export declare const setAxisAngle: <T extends QuaternionLike>(axisAngle: AxisAngle, out: T) => T;
|
|
67
|
+
/**
|
|
68
|
+
* Get the angular distance between two unit quaternions.
|
|
69
|
+
* @param a - The first unit quaternion.
|
|
70
|
+
* @param b - The second unit quaternion.
|
|
71
|
+
* @returns The angular distance in radians.
|
|
72
|
+
*/
|
|
73
|
+
export declare const getAngle: (a: QuaternionLike, b: QuaternionLike) => number;
|
|
74
|
+
/**
|
|
75
|
+
* Multiply two quaternions.
|
|
76
|
+
* @param a - The multiplier.
|
|
77
|
+
* @param b - The multiplicand.
|
|
78
|
+
* @param out - The quaternion to store the result in.
|
|
79
|
+
* @returns The product.
|
|
80
|
+
*/
|
|
81
|
+
export declare const multiply: <T extends QuaternionLike>(a: QuaternionLike, b: QuaternionLike, out: T) => T;
|
|
82
|
+
/**
|
|
83
|
+
* Rotate a quaternion by the given angle around the X-axis.
|
|
84
|
+
* @param quaternion - The quaternion.
|
|
85
|
+
* @param radians - The angle in radians.
|
|
86
|
+
* @param out - The quaternion to store the result in.
|
|
87
|
+
* @returns The rotated quaternion.
|
|
88
|
+
*/
|
|
89
|
+
export declare const rotateX: <T extends QuaternionLike>(quaternion: QuaternionLike, radians: number, out: T) => T;
|
|
90
|
+
/**
|
|
91
|
+
* Rotate a quaternion by the given angle around the Y-axis.
|
|
92
|
+
* @param quaternion - The quaternion.
|
|
93
|
+
* @param radians - The angle in radians.
|
|
94
|
+
* @param out - The quaternion to store the result in.
|
|
95
|
+
* @returns The rotated quaternion.
|
|
96
|
+
*/
|
|
97
|
+
export declare const rotateY: <T extends QuaternionLike>(quaternion: QuaternionLike, radians: number, out: T) => T;
|
|
98
|
+
/**
|
|
99
|
+
* Rotate a quaternion by the given angle around the Z-axis.
|
|
100
|
+
* @param quaternion - The quaternion.
|
|
101
|
+
* @param radians - The angle in radians.
|
|
102
|
+
* @param out - The quaternion to store the result in.
|
|
103
|
+
* @returns The rotated quaternion.
|
|
104
|
+
*/
|
|
105
|
+
export declare const rotateZ: <T extends QuaternionLike>(quaternion: QuaternionLike, radians: number, out: T) => T;
|
|
106
|
+
/**
|
|
107
|
+
* Calculate the fourth component of a unit quaternion from the first three, ignoring the existing fourth component.
|
|
108
|
+
* @param quaternion - The quaternion.
|
|
109
|
+
* @param out - The quaternion to store the result in.
|
|
110
|
+
* @returns The quaternion.
|
|
111
|
+
*/
|
|
112
|
+
export declare const calculateW: <T extends QuaternionLike>(quaternion: QuaternionLike, out: T) => T;
|
|
113
|
+
/**
|
|
114
|
+
* Calculate the exponential of a unit quaternion.
|
|
115
|
+
* @param quaternion - The quaternion.
|
|
116
|
+
* @param out - The quaternion to store the result in.
|
|
117
|
+
* @returns The exponential.
|
|
118
|
+
*/
|
|
119
|
+
export declare const exp: <T extends QuaternionLike>(quaternion: QuaternionLike, out: T) => T;
|
|
120
|
+
/**
|
|
121
|
+
* Calculate the natural logarithm of a unit quaternion.
|
|
122
|
+
* @param quaternion - The quaternion.
|
|
123
|
+
* @param out - The quaternion to store the result in.
|
|
124
|
+
* @returns The natural logarithm.
|
|
125
|
+
*/
|
|
126
|
+
export declare const ln: <T extends QuaternionLike>(quaternion: QuaternionLike, out: T) => T;
|
|
127
|
+
/**
|
|
128
|
+
* Calculate a power of a unit quaternion.
|
|
129
|
+
* @param quaternion - The quaternion.
|
|
130
|
+
* @param scalar - The amount to scale the quaternion by.
|
|
131
|
+
* @param out - The quaternion to store the result in.
|
|
132
|
+
* @returns The power.
|
|
133
|
+
*/
|
|
134
|
+
export declare const pow: <T extends QuaternionLike>(quaternion: QuaternionLike, scalar: number, out: T) => T;
|
|
135
|
+
/**
|
|
136
|
+
* Perform a spherical linear interpolation between two quaternions.
|
|
137
|
+
* @param a - The first quaternion.
|
|
138
|
+
* @param b - The second quaternion.
|
|
139
|
+
* @param t - The interpolation amount in `[0,1]`.
|
|
140
|
+
* @param out - The quaternion to store the result in.
|
|
141
|
+
* @returns The interpolated quaternion.
|
|
142
|
+
* @see [Slerp](https://en.wikipedia.org/wiki/Slerp)
|
|
143
|
+
*/
|
|
144
|
+
export declare const slerp: <T extends QuaternionLike>(a: QuaternionLike, b: QuaternionLike, t: number, out: T) => T;
|
|
145
|
+
/**
|
|
146
|
+
* Set a quaternion to a random unit quaternion.
|
|
147
|
+
* @param out - The quaternion to store the result in.
|
|
148
|
+
* @returns The quaternion.
|
|
149
|
+
*/
|
|
150
|
+
export declare const random: <T extends QuaternionLike>(out: T) => T;
|
|
151
|
+
/**
|
|
152
|
+
* Calculate the inverse of a quaternion. If the quaternion is normalized, the conjugate is the same but faster to calculate.
|
|
153
|
+
* @param quaternion - The quaternion.
|
|
154
|
+
* @param out - The quaternion to store the result in.
|
|
155
|
+
* @returns The inverse.
|
|
156
|
+
*/
|
|
157
|
+
export declare const invert: <T extends QuaternionLike>(quaternion: QuaternionLike, out: T) => T;
|
|
158
|
+
/**
|
|
159
|
+
* Calculate the conjugate of a quaternion. If the quaternion is normalized, this is the same as the inverse but faster to calculate.
|
|
160
|
+
* @param quaternion - The quaternion.
|
|
161
|
+
* @param out - The quaternion to store the result in.
|
|
162
|
+
* @returns The conjugate.
|
|
163
|
+
*/
|
|
164
|
+
export declare const conjugate: <T extends QuaternionLike>(quaternion: QuaternionLike, out: T) => T;
|
|
165
|
+
/**
|
|
166
|
+
* Perform a spherical linear interpolation with two control points between two quaternions.
|
|
167
|
+
* @param a - The first quaternion.
|
|
168
|
+
* @param b - The first control point.
|
|
169
|
+
* @param c - The second control point.
|
|
170
|
+
* @param d - The second quaternion.
|
|
171
|
+
* @param t - The interpolation amount in `[0,1]`.
|
|
172
|
+
* @param out - The quaternion to store the result in.
|
|
173
|
+
* @returns The interpolated value.
|
|
174
|
+
* @see [Slerp](https://en.wikipedia.org/wiki/Slerp)
|
|
175
|
+
*/
|
|
176
|
+
export declare const sqlerp: <T extends QuaternionLike>(a: QuaternionLike, b: QuaternionLike, c: QuaternionLike, d: QuaternionLike, t: number, out: T) => T;
|
|
177
|
+
/**
|
|
178
|
+
* A complex number that is commonly used to describe rotations.
|
|
179
|
+
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
180
|
+
*/
|
|
31
181
|
export default class Quaternion extends Float32Array implements QuaternionLike {
|
|
182
|
+
/**
|
|
183
|
+
* Create a quaternion from a three-by-three rotation matrix.
|
|
184
|
+
* @param matrix - The matrix.
|
|
185
|
+
* @param out - The quaternion to store the result in.
|
|
186
|
+
* @returns The quaternion.
|
|
187
|
+
* @see [Rotation matrix](https://en.wikipedia.org/wiki/Rotation_matrix)
|
|
188
|
+
*/
|
|
32
189
|
static fromMatrix3<T extends QuaternionLike>(matrix: Matrix3Like, out?: T): T;
|
|
190
|
+
/**
|
|
191
|
+
* Create a quaternion from equivalent x-y-z Tait-Bryan angles
|
|
192
|
+
* @param x - The x angle.
|
|
193
|
+
* @param y - The y angle.
|
|
194
|
+
* @param z - The z angle.
|
|
195
|
+
* @param out - The quaternion to store the result in.
|
|
196
|
+
* @returns The quaternion.
|
|
197
|
+
* @see [Euler angles](https://en.wikipedia.org/wiki/Euler_angles)
|
|
198
|
+
*/
|
|
33
199
|
static fromEuler<T extends QuaternionLike>(x: number, y: number, z: number, out?: T): T;
|
|
200
|
+
/**
|
|
201
|
+
* Create a quaternion with the given values.
|
|
202
|
+
* @param x - The first component.
|
|
203
|
+
* @param y - The second component.
|
|
204
|
+
* @param z - The third component.
|
|
205
|
+
* @param w - The fourth component.
|
|
206
|
+
* @param out - The quaternion to store the result in.
|
|
207
|
+
* @returns A new quaternion.
|
|
208
|
+
*/
|
|
34
209
|
static fromValues<T extends QuaternionLike>(x: number, y: number, z: number, w: number, out?: T): T;
|
|
210
|
+
/**
|
|
211
|
+
* Create a quaternion with values corresponding to the given orthonormal set of vectors.
|
|
212
|
+
* @param view - The vector representing the viewing direction.
|
|
213
|
+
* @param right - The vector representing the local "right" direction.
|
|
214
|
+
* @param up - The vector representing the local "up" direction.
|
|
215
|
+
* @param out - The quaternion to store the result in.
|
|
216
|
+
* @returns The quaternion.
|
|
217
|
+
*/
|
|
35
218
|
static fromAxes<T extends QuaternionLike>(view: Vector3Like, right: Vector3Like, up: Vector3Like, out?: T): T;
|
|
219
|
+
/**
|
|
220
|
+
* Create an identity quaternion.
|
|
221
|
+
* @see [Quaternion](https://en.wikipedia.org/wiki/Quaternion)
|
|
222
|
+
*/
|
|
36
223
|
constructor();
|
|
224
|
+
/** The first component of this quaternion. */
|
|
37
225
|
0: number;
|
|
226
|
+
/** The second component of this quaternion. */
|
|
38
227
|
1: number;
|
|
228
|
+
/** The third component of this quaternion. */
|
|
39
229
|
2: number;
|
|
230
|
+
/** The fourth component of this quaternion. */
|
|
40
231
|
3: number;
|
|
232
|
+
/**
|
|
233
|
+
* Set this quaternion to the identity.
|
|
234
|
+
* @returns This quaternion.
|
|
235
|
+
*/
|
|
41
236
|
identity(): this;
|
|
237
|
+
/**
|
|
238
|
+
* Get the axis and angle that represent this quaternion.
|
|
239
|
+
* @param out - The axis and angle to store the result in.
|
|
240
|
+
* @returns The axis and angle.
|
|
241
|
+
*/
|
|
42
242
|
getAxisAngle<T extends AxisAngle>(out?: T): T;
|
|
243
|
+
/**
|
|
244
|
+
* Set the axis and angle that represent this quaternion.
|
|
245
|
+
* @param axisAngle - The axis and angle.
|
|
246
|
+
* @returns This quaternion.
|
|
247
|
+
*/
|
|
43
248
|
setAxisAngle(axisAngle: AxisAngle): this;
|
|
249
|
+
/**
|
|
250
|
+
* Get the angular distance between this unit quaternion and another.
|
|
251
|
+
* @param quaternion - The other unit quaternion.
|
|
252
|
+
* @returns The angular distance in radians.
|
|
253
|
+
*/
|
|
44
254
|
getAngle(quaternion: QuaternionLike): number;
|
|
255
|
+
/**
|
|
256
|
+
* Multiply this and another quaternion.
|
|
257
|
+
* @param quaternion - The other quaternion.
|
|
258
|
+
* @param out - The quaternion to store the result in.
|
|
259
|
+
* @returns The product.
|
|
260
|
+
*/
|
|
45
261
|
multiply<T extends QuaternionLike>(quaternion: QuaternionLike, out?: T): T;
|
|
262
|
+
/**
|
|
263
|
+
* Rotate this quaternion by the given angle around the X-axis.
|
|
264
|
+
* @param r - The angle in radians.
|
|
265
|
+
* @param out - The quaternion to store the result in.
|
|
266
|
+
* @returns The rotated quaternion.
|
|
267
|
+
*/
|
|
46
268
|
rotateX<T extends QuaternionLike>(r: number, out?: T): T;
|
|
269
|
+
/**
|
|
270
|
+
* Rotate this quaternion by the given angle around the Y-axis.
|
|
271
|
+
* @param r - The angle in radians.
|
|
272
|
+
* @param out - The quaternion to store the result in.
|
|
273
|
+
* @returns The rotated quaternion.
|
|
274
|
+
*/
|
|
47
275
|
rotateY<T extends QuaternionLike>(r: number, out?: T): T;
|
|
276
|
+
/**
|
|
277
|
+
* Rotate this quaternion by the given angle around the Z-axis.
|
|
278
|
+
* @param r - The angle in radians.
|
|
279
|
+
* @param out - The quaternion to store the result in.
|
|
280
|
+
* @returns The rotated quaternion.
|
|
281
|
+
*/
|
|
48
282
|
rotateZ<T extends QuaternionLike>(r: number, out?: T): T;
|
|
283
|
+
/**
|
|
284
|
+
* Calculate the fourth component of this unit quaternion from the first three, ignoring the existing fourth component.
|
|
285
|
+
* @param out - The quaternion to store the result in.
|
|
286
|
+
* @returns The quaternion.
|
|
287
|
+
*/
|
|
49
288
|
calculateW<T extends QuaternionLike>(out?: T): T;
|
|
289
|
+
/**
|
|
290
|
+
* Calculate the exponential of this unit quaternion.
|
|
291
|
+
* @param out - The quaternion to store the result in.
|
|
292
|
+
* @returns The exponential.
|
|
293
|
+
*/
|
|
50
294
|
exp<T extends QuaternionLike>(out?: T): T;
|
|
295
|
+
/**
|
|
296
|
+
* Calculate the natural logarithm of this unit quaternion.
|
|
297
|
+
* @param out - The quaternion to store the result in.
|
|
298
|
+
* @returns The natural logarithm.
|
|
299
|
+
*/
|
|
51
300
|
ln<T extends QuaternionLike>(out?: T): T;
|
|
301
|
+
/**
|
|
302
|
+
* Calculate a power of this unit quaternion.
|
|
303
|
+
* @param scalar - The amount to scale the quaternion by.
|
|
304
|
+
* @param out - The quaternion to store the result in.
|
|
305
|
+
* @returns The power.
|
|
306
|
+
*/
|
|
52
307
|
pow<T extends QuaternionLike>(scalar: number, out?: T): T;
|
|
308
|
+
/**
|
|
309
|
+
* Perform a spherical linear interpolation between this and another quaternion.
|
|
310
|
+
* @param quaternion - The other quaternion.
|
|
311
|
+
* @param t - The interpolation amount in `[0,1]`.
|
|
312
|
+
* @param out - The quaternion to store the result in.
|
|
313
|
+
* @returns The interpolated quaternion.
|
|
314
|
+
* @see [Slerp](https://en.wikipedia.org/wiki/Slerp)
|
|
315
|
+
*/
|
|
53
316
|
slerp<T extends QuaternionLike>(quaternion: QuaternionLike, t: number, out?: T): T;
|
|
317
|
+
/**
|
|
318
|
+
* Set this to a random unit quaternion.
|
|
319
|
+
* @returns A random unit quaternion.
|
|
320
|
+
*/
|
|
54
321
|
random(): this;
|
|
322
|
+
/**
|
|
323
|
+
* Calculate the inverse of this quaternion. If the quaternion is normalized, the conjugate is the same but faster to calculate.
|
|
324
|
+
* @param out - The quaternion to store the result in.
|
|
325
|
+
* @returns The inverse.
|
|
326
|
+
*/
|
|
55
327
|
invert<T extends QuaternionLike>(out?: T): T;
|
|
328
|
+
/**
|
|
329
|
+
* Calculate the conjugate of this quaternion. If the quaternion is normalized, this is the same as the inverse but faster to calculate.
|
|
330
|
+
* @param out - The quaternion to store the result in.
|
|
331
|
+
* @returns The conjugate.
|
|
332
|
+
*/
|
|
56
333
|
conjugate<T extends QuaternionLike>(out?: T): T;
|
|
334
|
+
/**
|
|
335
|
+
* Copy the values from this quaternion to another one.
|
|
336
|
+
* @param out - The quaternion to store the result in.
|
|
337
|
+
* @returns The copy.
|
|
338
|
+
*/
|
|
57
339
|
clone<T extends QuaternionLike>(out?: T): T;
|
|
340
|
+
/**
|
|
341
|
+
* Copy the values of another quaternion into this one.
|
|
342
|
+
* @param quaternion - The quaternion to copy.
|
|
343
|
+
* @returns This quaternion.
|
|
344
|
+
*/
|
|
58
345
|
copy(quaternion: QuaternionLike): this;
|
|
346
|
+
/**
|
|
347
|
+
* Add two quaternions of the same size.
|
|
348
|
+
* @param quaternion - The other quaternion.
|
|
349
|
+
* @param out - The quaternion to store the result in.
|
|
350
|
+
* @returns The sum of the quaternions.
|
|
351
|
+
*/
|
|
59
352
|
add<T extends QuaternionLike>(quaternion: QuaternionLike, out?: T): T;
|
|
353
|
+
/**
|
|
354
|
+
* Scale this quaternion by a scalar.
|
|
355
|
+
* @param scalar - The scalar.
|
|
356
|
+
* @param out - The quaternion to store the result in.
|
|
357
|
+
* @returns The scaled quaternion.
|
|
358
|
+
*/
|
|
60
359
|
scale<T extends QuaternionLike>(scalar: number, out?: T): T;
|
|
360
|
+
/**
|
|
361
|
+
* Calculate the dot product of this and another quaternion.
|
|
362
|
+
* @param quaternion - The other quaternion.
|
|
363
|
+
* @returns The dot product.
|
|
364
|
+
*/
|
|
61
365
|
dot(quaternion: QuaternionLike): number;
|
|
366
|
+
/**
|
|
367
|
+
* Perform a linear interpolation between this and another quaternion.
|
|
368
|
+
* @param quaternion - The other quaternion.
|
|
369
|
+
* @param t - The interpolation amount (in `[0,1]`).
|
|
370
|
+
* @param out - The quaternion to store the result in.
|
|
371
|
+
* @returns The interpolated quaternion.
|
|
372
|
+
*/
|
|
62
373
|
lerp<T extends QuaternionLike>(quaternion: QuaternionLike, t: number, out?: T): T;
|
|
374
|
+
/** Get the magnitude (length) of this quaternion. */
|
|
63
375
|
get magnitude(): number;
|
|
376
|
+
/** Get the squared magnitude (length) of this quaternion. */
|
|
64
377
|
get squaredMagnitude(): number;
|
|
378
|
+
/**
|
|
379
|
+
* Normalize this quaternion.
|
|
380
|
+
* @param out - The quaternion to store the result in.
|
|
381
|
+
* @returns The normalized quaternion.
|
|
382
|
+
*/
|
|
65
383
|
normalize<T extends QuaternionLike>(out?: T): T;
|
|
384
|
+
/**
|
|
385
|
+
* Determine whether or not this quaternion is roughly equivalent to another.
|
|
386
|
+
* @param quaternion - The other quaternion.
|
|
387
|
+
* @returns Whether or not the quaternions are equivalent.
|
|
388
|
+
*/
|
|
66
389
|
equals(quaternion: QuaternionLike): boolean;
|
|
390
|
+
/**
|
|
391
|
+
* Determine whether or not this quaternion is exactly equivalent to another.
|
|
392
|
+
* @param quaternion - The other quaternion.
|
|
393
|
+
* @returns Whether or not the quaternions are equivalent.
|
|
394
|
+
*/
|
|
67
395
|
exactEquals(quaternion: QuaternionLike): boolean;
|
|
396
|
+
/**
|
|
397
|
+
* Perform a spherical linear interpolation with two control points between this and another quaternion.
|
|
398
|
+
* @param a - The first control point.
|
|
399
|
+
* @param b - The second control point.
|
|
400
|
+
* @param quaternion - The other quaternion.
|
|
401
|
+
* @param t - The interpolation amount in `[0,1]`.
|
|
402
|
+
* @param out - The quaternion to store the result in.
|
|
403
|
+
* @returns The interpolated value.
|
|
404
|
+
* @see [Slerp](https://en.wikipedia.org/wiki/Slerp)
|
|
405
|
+
*/
|
|
68
406
|
sqlerp<T extends QuaternionLike>(a: QuaternionLike, b: QuaternionLike, quaternion: QuaternionLike, t: number, out?: T): T;
|
|
69
407
|
}
|
|
70
408
|
//# sourceMappingURL=Quaternion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../src/linalg/Quaternion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,cAAc,CAAC;AAcnE,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Quaternion.d.ts","sourceRoot":"","sources":["../../src/linalg/Quaternion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAqB,MAAM,cAAc,CAAC;AAcnE,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,oEAAoE;AACpE,MAAM,WAAW,cAAe,SAAQ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAC7D,8CAA8C;IAC9C,CAAC,EAAE,MAAM,CAAC;IAEV,+CAA+C;IAC/C,CAAC,EAAE,MAAM,CAAC;IAEV,8CAA8C;IAC9C,CAAC,EAAE,MAAM,CAAC;IAEV,+CAA+C;IAC/C,CAAC,EAAE,MAAM,CAAC;CACV;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QACS,cACzC,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,CAAC,SAAS,cAAc,UAC3C,WAAW,OACd,CAAC,KACJ,CAwCF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,cAAc,KAC9C,MAAM,KACN,MAAM,KACN,MAAM,OACJ,CAAC,KACJ,CAmBF,CAAC;AAKF;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,GAAI,CAAC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