acmi-parser 1.0.0 → 1.2.0

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.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/dist/acmi-parser.cjs +3 -45
  3. package/dist/acmi-parser.js +6118 -9090
  4. package/dist/types/acmi/acmiData.d.ts +41 -0
  5. package/dist/types/acmi/entity.d.ts +26 -0
  6. package/dist/types/acmi/frame.d.ts +17 -0
  7. package/dist/types/acmi/globalProperties.d.ts +30 -0
  8. package/dist/types/acmi/header.d.ts +7 -0
  9. package/dist/types/acmi/timeSpan.d.ts +12 -0
  10. package/dist/types/acmi/transform.d.ts +22 -0
  11. package/dist/types/index.d.ts +14 -0
  12. package/dist/types/math3d/core/classes/base/math-array.d.ts +66 -0
  13. package/dist/types/math3d/core/classes/base/matrix.d.ts +13 -0
  14. package/dist/types/math3d/core/classes/base/vector.d.ts +43 -0
  15. package/dist/types/math3d/core/classes/euler.d.ts +78 -0
  16. package/dist/types/math3d/core/classes/matrix3.d.ts +62 -0
  17. package/dist/types/math3d/core/classes/matrix4.d.ts +232 -0
  18. package/dist/types/math3d/core/classes/pose.d.ts +39 -0
  19. package/dist/types/math3d/core/classes/quaternion.d.ts +64 -0
  20. package/dist/types/math3d/core/classes/spherical-coordinates.d.ts +59 -0
  21. package/dist/types/math3d/core/classes/vector2.d.ts +54 -0
  22. package/dist/types/math3d/core/classes/vector3.d.ts +59 -0
  23. package/dist/types/math3d/core/classes/vector4.d.ts +40 -0
  24. package/dist/types/math3d/core/gl-matrix/common.d.ts +37 -0
  25. package/dist/types/math3d/core/gl-matrix/mat3.d.ts +286 -0
  26. package/dist/types/math3d/core/gl-matrix/mat4.d.ts +549 -0
  27. package/dist/types/math3d/core/gl-matrix/quat.d.ts +358 -0
  28. package/dist/types/math3d/core/gl-matrix/vec2.d.ts +362 -0
  29. package/dist/types/math3d/core/gl-matrix/vec3.d.ts +405 -0
  30. package/dist/types/math3d/core/gl-matrix/vec4.d.ts +329 -0
  31. package/dist/types/math3d/core/index.d.ts +29 -0
  32. package/dist/types/math3d/core/lib/assert.d.ts +1 -0
  33. package/dist/types/math3d/core/lib/common.d.ts +99 -0
  34. package/dist/types/math3d/core/lib/gl-matrix-extras.d.ts +6 -0
  35. package/dist/types/math3d/core/lib/math-utils.d.ts +24 -0
  36. package/dist/types/math3d/core/lib/validators.d.ts +5 -0
  37. package/dist/types/math3d/geoid/geoid.d.ts +73 -0
  38. package/dist/types/math3d/geoid/index.d.ts +2 -0
  39. package/dist/types/math3d/geoid/parse-pgm.d.ts +11 -0
  40. package/dist/types/math3d/geospatial/constants.d.ts +11 -0
  41. package/dist/types/math3d/geospatial/ellipsoid/ellipsoid.d.ts +69 -0
  42. package/dist/types/math3d/geospatial/ellipsoid/helpers/ellipsoid-transform.d.ts +4 -0
  43. package/dist/types/math3d/geospatial/ellipsoid/helpers/scale-to-geodetic-surface.d.ts +2 -0
  44. package/dist/types/math3d/geospatial/index.d.ts +2 -0
  45. package/dist/types/math3d/geospatial/type-utils.d.ts +23 -0
  46. package/dist/types/math3d/index.d.ts +4 -0
  47. package/dist/types/math3d/types/array-types.d.ts +14 -0
  48. package/dist/types/math3d/types/bigint.d.ts +20 -0
  49. package/dist/types/math3d/types/index.d.ts +2 -0
  50. package/dist/types/math3d/types/is-array.d.ts +13 -0
  51. package/dist/types/parser.d.ts +90 -0
  52. package/dist/types/trajectory/stateVector.d.ts +30 -0
  53. package/dist/types/trajectory/trajectory.d.ts +40 -0
  54. package/dist/types/trajectory/trajectorySample.d.ts +11 -0
  55. package/package.json +20 -18
  56. package/dist/types/acmi-parser.d.ts +0 -179
@@ -0,0 +1,329 @@
1
+ /**
2
+ * 4 Dimensional Vector
3
+ * @module vec4
4
+ */
5
+ /**
6
+ * Creates a new, empty vec4
7
+ *
8
+ * @returns {vec4} a new 4D vector
9
+ */
10
+ export declare function create(): any[] | Float32Array<ArrayBuffer>;
11
+ /**
12
+ * Creates a new vec4 initialized with values from an existing vector
13
+ *
14
+ * @param {ReadonlyVec4} a vector to clone
15
+ * @returns {vec4} a new 4D vector
16
+ */
17
+ export declare function clone(a: any): any[] | Float32Array<ArrayBuffer>;
18
+ /**
19
+ * Creates a new vec4 initialized with the given values
20
+ *
21
+ * @param {Number} x X component
22
+ * @param {Number} y Y component
23
+ * @param {Number} z Z component
24
+ * @param {Number} w W component
25
+ * @returns {vec4} a new 4D vector
26
+ */
27
+ export declare function fromValues(x: any, y: any, z: any, w: any): any[] | Float32Array<ArrayBuffer>;
28
+ /**
29
+ * Copy the values from one vec4 to another
30
+ *
31
+ * @param {vec4} out the receiving vector
32
+ * @param {ReadonlyVec4} a the source vector
33
+ * @returns {vec4} out
34
+ */
35
+ export declare function copy(out: any, a: any): any;
36
+ /**
37
+ * Set the components of a vec4 to the given values
38
+ *
39
+ * @param {vec4} out the receiving vector
40
+ * @param {Number} x X component
41
+ * @param {Number} y Y component
42
+ * @param {Number} z Z component
43
+ * @param {Number} w W component
44
+ * @returns {vec4} out
45
+ */
46
+ export declare function set(out: any, x: any, y: any, z: any, w: any): any;
47
+ /**
48
+ * Adds two vec4's
49
+ *
50
+ * @param {vec4} out the receiving vector
51
+ * @param {ReadonlyVec4} a the first operand
52
+ * @param {ReadonlyVec4} b the second operand
53
+ * @returns {vec4} out
54
+ */
55
+ export declare function add(out: any, a: any, b: any): any;
56
+ /**
57
+ * Subtracts vector b from vector a
58
+ *
59
+ * @param {vec4} out the receiving vector
60
+ * @param {ReadonlyVec4} a the first operand
61
+ * @param {ReadonlyVec4} b the second operand
62
+ * @returns {vec4} out
63
+ */
64
+ export declare function subtract(out: any, a: any, b: any): any;
65
+ /**
66
+ * Multiplies two vec4's
67
+ *
68
+ * @param {vec4} out the receiving vector
69
+ * @param {ReadonlyVec4} a the first operand
70
+ * @param {ReadonlyVec4} b the second operand
71
+ * @returns {vec4} out
72
+ */
73
+ export declare function multiply(out: any, a: any, b: any): any;
74
+ /**
75
+ * Divides two vec4's
76
+ *
77
+ * @param {vec4} out the receiving vector
78
+ * @param {ReadonlyVec4} a the first operand
79
+ * @param {ReadonlyVec4} b the second operand
80
+ * @returns {vec4} out
81
+ */
82
+ export declare function divide(out: any, a: any, b: any): any;
83
+ /**
84
+ * Math.ceil the components of a vec4
85
+ *
86
+ * @param {vec4} out the receiving vector
87
+ * @param {ReadonlyVec4} a vector to ceil
88
+ * @returns {vec4} out
89
+ */
90
+ export declare function ceil(out: any, a: any): any;
91
+ /**
92
+ * Math.floor the components of a vec4
93
+ *
94
+ * @param {vec4} out the receiving vector
95
+ * @param {ReadonlyVec4} a vector to floor
96
+ * @returns {vec4} out
97
+ */
98
+ export declare function floor(out: any, a: any): any;
99
+ /**
100
+ * Returns the minimum of two vec4's
101
+ *
102
+ * @param {vec4} out the receiving vector
103
+ * @param {ReadonlyVec4} a the first operand
104
+ * @param {ReadonlyVec4} b the second operand
105
+ * @returns {vec4} out
106
+ */
107
+ export declare function min(out: any, a: any, b: any): any;
108
+ /**
109
+ * Returns the maximum of two vec4's
110
+ *
111
+ * @param {vec4} out the receiving vector
112
+ * @param {ReadonlyVec4} a the first operand
113
+ * @param {ReadonlyVec4} b the second operand
114
+ * @returns {vec4} out
115
+ */
116
+ export declare function max(out: any, a: any, b: any): any;
117
+ /**
118
+ * symmetric round the components of a vec4
119
+ *
120
+ * @param {vec4} out the receiving vector
121
+ * @param {ReadonlyVec4} a vector to round
122
+ * @returns {vec4} out
123
+ */
124
+ export declare function round(out: any, a: any): any;
125
+ /**
126
+ * Scales a vec4 by a scalar number
127
+ *
128
+ * @param {vec4} out the receiving vector
129
+ * @param {ReadonlyVec4} a the vector to scale
130
+ * @param {Number} b amount to scale the vector by
131
+ * @returns {vec4} out
132
+ */
133
+ export declare function scale(out: any, a: any, b: any): any;
134
+ /**
135
+ * Adds two vec4's after scaling the second operand by a scalar value
136
+ *
137
+ * @param {vec4} out the receiving vector
138
+ * @param {ReadonlyVec4} a the first operand
139
+ * @param {ReadonlyVec4} b the second operand
140
+ * @param {Number} scale the amount to scale b by before adding
141
+ * @returns {vec4} out
142
+ */
143
+ export declare function scaleAndAdd(out: any, a: any, b: any, scale: any): any;
144
+ /**
145
+ * Calculates the euclidian distance between two vec4's
146
+ *
147
+ * @param {ReadonlyVec4} a the first operand
148
+ * @param {ReadonlyVec4} b the second operand
149
+ * @returns {Number} distance between a and b
150
+ */
151
+ export declare function distance(a: any, b: any): number;
152
+ /**
153
+ * Calculates the squared euclidian distance between two vec4's
154
+ *
155
+ * @param {ReadonlyVec4} a the first operand
156
+ * @param {ReadonlyVec4} b the second operand
157
+ * @returns {Number} squared distance between a and b
158
+ */
159
+ export declare function squaredDistance(a: any, b: any): number;
160
+ /**
161
+ * Calculates the length of a vec4
162
+ *
163
+ * @param {ReadonlyVec4} a vector to calculate length of
164
+ * @returns {Number} length of a
165
+ */
166
+ export declare function length(a: any): number;
167
+ /**
168
+ * Calculates the squared length of a vec4
169
+ *
170
+ * @param {ReadonlyVec4} a vector to calculate squared length of
171
+ * @returns {Number} squared length of a
172
+ */
173
+ export declare function squaredLength(a: any): number;
174
+ /**
175
+ * Negates the components of a vec4
176
+ *
177
+ * @param {vec4} out the receiving vector
178
+ * @param {ReadonlyVec4} a vector to negate
179
+ * @returns {vec4} out
180
+ */
181
+ export declare function negate(out: any, a: any): any;
182
+ /**
183
+ * Returns the inverse of the components of a vec4
184
+ *
185
+ * @param {vec4} out the receiving vector
186
+ * @param {ReadonlyVec4} a vector to invert
187
+ * @returns {vec4} out
188
+ */
189
+ export declare function inverse(out: any, a: any): any;
190
+ /**
191
+ * Normalize a vec4
192
+ *
193
+ * @param {vec4} out the receiving vector
194
+ * @param {ReadonlyVec4} a vector to normalize
195
+ * @returns {vec4} out
196
+ */
197
+ export declare function normalize(out: any, a: any): any;
198
+ /**
199
+ * Calculates the dot product of two vec4's
200
+ *
201
+ * @param {ReadonlyVec4} a the first operand
202
+ * @param {ReadonlyVec4} b the second operand
203
+ * @returns {Number} dot product of a and b
204
+ */
205
+ export declare function dot(a: any, b: any): number;
206
+ /**
207
+ * Returns the cross-product of three vectors in a 4-dimensional space
208
+ *
209
+ * @param {ReadonlyVec4} result the receiving vector
210
+ * @param {ReadonlyVec4} U the first vector
211
+ * @param {ReadonlyVec4} V the second vector
212
+ * @param {ReadonlyVec4} W the third vector
213
+ * @returns {vec4} result
214
+ */
215
+ export declare function cross(out: any, u: any, v: any, w: any): any;
216
+ /**
217
+ * Performs a linear interpolation between two vec4's
218
+ *
219
+ * @param {vec4} out the receiving vector
220
+ * @param {ReadonlyVec4} a the first operand
221
+ * @param {ReadonlyVec4} b the second operand
222
+ * @param {Number} t interpolation amount, in the range [0-1], between the two inputs
223
+ * @returns {vec4} out
224
+ */
225
+ export declare function lerp(out: any, a: any, b: any, t: any): any;
226
+ /**
227
+ * Generates a random vector with the given scale
228
+ *
229
+ * @param {vec4} out the receiving vector
230
+ * @param {Number} [scale] Length of the resulting vector. If omitted, a unit vector will be returned
231
+ * @returns {vec4} out
232
+ */
233
+ export declare function random(out: any, scale: any): any;
234
+ /**
235
+ * Transforms the vec4 with a mat4.
236
+ *
237
+ * @param {vec4} out the receiving vector
238
+ * @param {ReadonlyVec4} a the vector to transform
239
+ * @param {ReadonlyMat4} m matrix to transform with
240
+ * @returns {vec4} out
241
+ */
242
+ export declare function transformMat4(out: any, a: any, m: any): any;
243
+ /**
244
+ * Transforms the vec4 with a quat
245
+ *
246
+ * @param {vec4} out the receiving vector
247
+ * @param {ReadonlyVec4} a the vector to transform
248
+ * @param {ReadonlyQuat} q quaternion to transform with
249
+ * @returns {vec4} out
250
+ */
251
+ export declare function transformQuat(out: any, a: any, q: any): any;
252
+ /**
253
+ * Set the components of a vec4 to zero
254
+ *
255
+ * @param {vec4} out the receiving vector
256
+ * @returns {vec4} out
257
+ */
258
+ export declare function zero(out: any): any;
259
+ /**
260
+ * Returns a string representation of a vector
261
+ *
262
+ * @param {ReadonlyVec4} a vector to represent as a string
263
+ * @returns {String} string representation of the vector
264
+ */
265
+ export declare function str(a: any): string;
266
+ /**
267
+ * Returns whether or not the vectors have exactly the same elements in the same position (when compared with ===)
268
+ *
269
+ * @param {ReadonlyVec4} a The first vector.
270
+ * @param {ReadonlyVec4} b The second vector.
271
+ * @returns {Boolean} True if the vectors are equal, false otherwise.
272
+ */
273
+ export declare function exactEquals(a: any, b: any): boolean;
274
+ /**
275
+ * Returns whether or not the vectors have approximately the same elements in the same position.
276
+ *
277
+ * @param {ReadonlyVec4} a The first vector.
278
+ * @param {ReadonlyVec4} b The second vector.
279
+ * @returns {Boolean} True if the vectors are equal, false otherwise.
280
+ */
281
+ export declare function equals(a: any, b: any): boolean;
282
+ /**
283
+ * Alias for {@link vec4.subtract}
284
+ * @function
285
+ */
286
+ export declare const sub: typeof subtract;
287
+ /**
288
+ * Alias for {@link vec4.multiply}
289
+ * @function
290
+ */
291
+ export declare const mul: typeof multiply;
292
+ /**
293
+ * Alias for {@link vec4.divide}
294
+ * @function
295
+ */
296
+ export declare const div: typeof divide;
297
+ /**
298
+ * Alias for {@link vec4.distance}
299
+ * @function
300
+ */
301
+ export declare const dist: typeof distance;
302
+ /**
303
+ * Alias for {@link vec4.squaredDistance}
304
+ * @function
305
+ */
306
+ export declare const sqrDist: typeof squaredDistance;
307
+ /**
308
+ * Alias for {@link vec4.length}
309
+ * @function
310
+ */
311
+ export declare const len: typeof length;
312
+ /**
313
+ * Alias for {@link vec4.squaredLength}
314
+ * @function
315
+ */
316
+ export declare const sqrLen: typeof squaredLength;
317
+ /**
318
+ * Perform some operation over an array of vec4s.
319
+ *
320
+ * @param {Array} a the array of vectors to iterate over
321
+ * @param {Number} stride Number of elements between the start of each vec4. If 0 assumes tightly packed
322
+ * @param {Number} offset Number of elements to skip at the beginning of the array
323
+ * @param {Number} count Number of vec4s to iterate over. If 0 iterates over entire array
324
+ * @param {Function} fn Function to call for each vector in the array
325
+ * @param {Object} [arg] additional argument to pass to fn
326
+ * @returns {Array} a
327
+ * @function
328
+ */
329
+ export declare const forEach: (a: any, stride: any, offset: any, count: any, fn: any, arg: any) => any;
@@ -0,0 +1,29 @@
1
+ export type { TypedArray, NumericArray } from '../types';
2
+ export type { isTypedArray, isNumericArray } from '../types';
3
+ export { Vector2 } from './classes/vector2';
4
+ export { Vector3 } from './classes/vector3';
5
+ export { Vector4 } from './classes/vector4';
6
+ export { Matrix3 } from './classes/matrix3';
7
+ export { Matrix4 } from './classes/matrix4';
8
+ export { Quaternion } from './classes/quaternion';
9
+ export { SphericalCoordinates } from './classes/spherical-coordinates';
10
+ export { Pose } from './classes/pose';
11
+ export { Euler } from './classes/euler';
12
+ export * as _MathUtils from './lib/math-utils';
13
+ export { assert } from './lib/assert';
14
+ export { config, configure, formatValue, isArray, clone, equals, exactEquals, toRadians, toDegrees, radians, degrees, sin, cos, tan, asin, acos, atan, clamp, lerp, withEpsilon, } from './lib/common';
15
+ export { SphericalCoordinates as _SphericalCoordinates } from './classes/spherical-coordinates';
16
+ export { Pose as _Pose } from './classes/pose';
17
+ export { Euler as _Euler } from './classes/euler';
18
+ /** @deprecated Use Matrix3 */
19
+ export * as mat3 from './gl-matrix/mat3';
20
+ /** @deprecated Use Matrix4 */
21
+ export * as mat4 from './gl-matrix/mat4';
22
+ /** @deprecated Use Quaterinion */
23
+ export * as quat from './gl-matrix/quat';
24
+ /** @deprecated UseVector */
25
+ export * as vec2 from './gl-matrix/vec2';
26
+ /** @deprecated Use Vector3 */
27
+ export * as vec3 from './gl-matrix/vec3';
28
+ /** @deprecated Use Vector4 */
29
+ export * as vec4 from './gl-matrix/vec4';
@@ -0,0 +1 @@
1
+ export declare function assert(condition: unknown, message?: string): void;
@@ -0,0 +1,99 @@
1
+ import { NumericArray } from '../../types';
2
+ import { MathArray } from '../classes/base/math-array';
3
+ export type ConfigurationOptions = {
4
+ EPSILON: number;
5
+ debug?: boolean;
6
+ precision: number;
7
+ printTypes?: boolean;
8
+ printDegrees?: boolean;
9
+ printRowMajor?: boolean;
10
+ _cartographicRadians?: boolean;
11
+ };
12
+ declare global {
13
+ var mathgl: {
14
+ config: Required<ConfigurationOptions>;
15
+ };
16
+ }
17
+ export declare const config: Required<ConfigurationOptions>;
18
+ export declare function configure(options: Partial<ConfigurationOptions>): ConfigurationOptions;
19
+ /**
20
+ * Formats a value into a string
21
+ * @param value
22
+ * @param param1
23
+ * @returns
24
+ */
25
+ export declare function formatValue(value: number, { precision }?: {
26
+ precision?: number;
27
+ }): string;
28
+ /**
29
+ * Check if value is an "array"
30
+ * Returns `true` if value is either an array or a typed array
31
+ * Note: returns `false` for `ArrayBuffer` and `DataView` instances
32
+ * @note isTypedArray and isNumericArray are often more useful in TypeScript
33
+ */
34
+ export declare function isArray(value: unknown): boolean;
35
+ export declare function clone(array: NumericArray | MathArray): NumericArray;
36
+ export declare function toRadians(degrees: number): number;
37
+ export declare function toRadians(degrees: NumericArray): NumericArray;
38
+ export declare function toDegrees(degrees: number): number;
39
+ export declare function toDegrees(degrees: NumericArray): NumericArray;
40
+ /**
41
+ * "GLSL equivalent" radians: Works on single values and vectors
42
+ */
43
+ export declare function radians(degrees: number): number;
44
+ export declare function radians(degrees: NumericArray, result?: NumericArray): NumericArray;
45
+ /**
46
+ * "GLSL equivalent" degrees: Works on single values and vectors
47
+ */
48
+ export declare function degrees(radians: number): number;
49
+ export declare function degrees(radians: NumericArray, result?: NumericArray): NumericArray;
50
+ /**
51
+ * "GLSL equivalent" of `Math.sin`: Works on single values and vectors
52
+ * @deprecated
53
+ */
54
+ export declare function sin(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
55
+ /**
56
+ * "GLSL equivalent" of `Math.cos`: Works on single values and vectors
57
+ * @deprecated
58
+ */
59
+ export declare function cos(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
60
+ /**
61
+ * "GLSL equivalent" of `Math.tan`: Works on single values and vectors
62
+ * @deprecated
63
+ */
64
+ export declare function tan(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
65
+ /**
66
+ * "GLSL equivalent" of `Math.asin`: Works on single values and vectors
67
+ * @deprecated
68
+ */
69
+ export declare function asin(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
70
+ /**
71
+ * "GLSL equivalent" of `Math.acos`: Works on single values and vectors
72
+ * @deprecated
73
+ */
74
+ export declare function acos(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
75
+ /**
76
+ * "GLSL equivalent" of `Math.atan`: Works on single values and vectors
77
+ * @deprecated
78
+ */
79
+ export declare function atan(radians: number | NumericArray, result?: NumericArray): number | NumericArray;
80
+ /**
81
+ * GLSL style value clamping: Works on single values and vectors
82
+ */
83
+ export declare function clamp(value: number, min: number, max: number): number;
84
+ export declare function clamp(value: NumericArray, min: number, max: number): NumericArray;
85
+ /**
86
+ * Interpolate between two numbers or two arrays
87
+ */
88
+ export declare function lerp(a: number, b: number, t: number): number;
89
+ export declare function lerp(a: NumericArray, b: NumericArray, t: number): NumericArray;
90
+ /**
91
+ * Compares any two math objects, using `equals` method if available.
92
+ * @param a
93
+ * @param b
94
+ * @param epsilon
95
+ * @returns
96
+ */
97
+ export declare function equals(a: any, b: any, epsilon?: number): boolean;
98
+ export declare function exactEquals(a: any, b: any): boolean;
99
+ export declare function withEpsilon<T>(epsilon: number, func: () => T): T;
@@ -0,0 +1,6 @@
1
+ import { NumericArray } from '../../types';
2
+ export declare function vec2_transformMat4AsVector<T extends NumericArray>(out: T, a: Readonly<NumericArray>, m: Readonly<NumericArray>): T;
3
+ export declare function vec3_transformMat4AsVector<T extends NumericArray>(out: T, a: Readonly<NumericArray>, m: Readonly<NumericArray>): T;
4
+ export declare function vec3_transformMat2<T extends NumericArray>(out: T, a: Readonly<NumericArray>, m: Readonly<NumericArray>): T;
5
+ export declare function vec4_transformMat2<T extends NumericArray>(out: T, a: Readonly<NumericArray>, m: Readonly<NumericArray>): T;
6
+ export declare function vec4_transformMat3<T extends NumericArray>(out: T, a: Readonly<NumericArray>, m: Readonly<NumericArray>): T;
@@ -0,0 +1,24 @@
1
+ export declare const EPSILON1 = 0.1;
2
+ export declare const EPSILON2 = 0.01;
3
+ export declare const EPSILON3 = 0.001;
4
+ export declare const EPSILON4 = 0.0001;
5
+ export declare const EPSILON5 = 0.00001;
6
+ export declare const EPSILON6 = 0.000001;
7
+ export declare const EPSILON7 = 1e-7;
8
+ export declare const EPSILON8 = 1e-8;
9
+ export declare const EPSILON9 = 1e-9;
10
+ export declare const EPSILON10 = 1e-10;
11
+ export declare const EPSILON11 = 1e-11;
12
+ export declare const EPSILON12 = 1e-12;
13
+ export declare const EPSILON13 = 1e-13;
14
+ export declare const EPSILON14 = 1e-14;
15
+ export declare const EPSILON15 = 1e-15;
16
+ export declare const EPSILON16 = 1e-16;
17
+ export declare const EPSILON17 = 1e-17;
18
+ export declare const EPSILON18 = 1e-18;
19
+ export declare const EPSILON19 = 1e-19;
20
+ export declare const EPSILON20 = 1e-20;
21
+ export declare const PI_OVER_TWO: number;
22
+ export declare const PI_OVER_FOUR: number;
23
+ export declare const PI_OVER_SIX: number;
24
+ export declare const TWO_PI: number;
@@ -0,0 +1,5 @@
1
+ import { NumberArray } from '../../types';
2
+ export declare function validateVector(v: NumberArray, length: number): boolean;
3
+ export declare function checkNumber(value: unknown): number;
4
+ export declare function checkVector<T extends NumberArray>(v: T, length: number, callerName?: string): T;
5
+ export declare function deprecated(method: string, version: string): void;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Code is ported from GeographicLib-1.50.1
3
+ * https://geographiclib.sourceforge.io/html/index.html
4
+ * Location: /GeographicLib-1.50.1/src/Geoid.cpp
5
+ * /GeographicLib-1.50.1/include/GeographicLib/Geoid.hpp
6
+ * /GeographicLib-1.50.1/src/Math.cpp
7
+ *
8
+ * File header:
9
+ * * \file Geoid.cpp (Geoid.hpp)
10
+ * * \brief Implementation for GeographicLib::Geoid class
11
+ * *
12
+ * * Copyright (c) Charles Karney (2009-2018) <charles@karney.com> and licensed
13
+ * * under the MIT/X11 License. For more information, see
14
+ * * https://geographiclib.sourceforge.io/
15
+ **********************************************************************/
16
+ export type GeoidProps = {
17
+ cubic: boolean | undefined;
18
+ _width: number;
19
+ _height: number;
20
+ _rlonres: number;
21
+ _rlatres: number;
22
+ _offset: number;
23
+ _scale: number;
24
+ _swidth: number;
25
+ _datastart: number;
26
+ _maxerror: number;
27
+ _rmserror: number;
28
+ _description: string;
29
+ _datetime: string;
30
+ data: Uint8Array;
31
+ };
32
+ /**
33
+ * class Geoid - "Gravity Height Model"
34
+ * Calculates difference between mean see level height and WGS84 ellipsoid height
35
+ * Input data have to be loaded from "Earth Gravity Model" *.pgm file with "PGMLoader"
36
+ * A particular model file can be loaded on https://geographiclib.sourceforge.io/html/geoid.html
37
+ *
38
+ * The implementation is ported from GeographicLib-1.50.1
39
+ */
40
+ export declare class Geoid {
41
+ private _v00;
42
+ private _v01;
43
+ private _v10;
44
+ private _v11;
45
+ private _t;
46
+ private _ix;
47
+ private _iy;
48
+ options: GeoidProps;
49
+ /**
50
+ * @constructs
51
+ * Create a Geoid instance.
52
+ * @param options - object which includes parameters parsed from *.pgm header
53
+ * @param options.data - binary buffer of *.pgm file
54
+ */
55
+ constructor(options: GeoidProps);
56
+ /**
57
+ * Calculates difference between mean see level height and WGS84 ellipsoid height
58
+ * Code is ported from /GeographicLib-1.50.1/src/Geoid.cpp
59
+ * @param lat - latitude
60
+ * @param lon - longitude
61
+ * @returns height in meters
62
+ */
63
+ getHeight(lat: number, lon: number): number;
64
+ /**
65
+ * Method seeks for particular data in th pgm buffer
66
+ * Code is ported from corresponding method
67
+ * in /GeographicLib-1.50.1/include/GeographicLib/Geoid.hpp
68
+ * @param {number} ix - longituge parameter
69
+ * @param {number} iy - latitude parameter
70
+ * @returns {number} data from pgm binary buffer
71
+ */
72
+ private _rawval;
73
+ }
@@ -0,0 +1,2 @@
1
+ export { parsePGM } from './parse-pgm';
2
+ export { Geoid } from './geoid';
@@ -0,0 +1,11 @@
1
+ import { Geoid } from './geoid';
2
+ /**
3
+ * Parse "Earth Gravity Model" loaded from a *.pgm file
4
+ * https://geographiclib.sourceforge.io/html/geoid.html
5
+ * @param {} data - binary buffer of pgm file
6
+ * @param {Object} options - loader options
7
+ * @returns {GeoidHeightModel} - instance of GeoidHeightModel class
8
+ */
9
+ export declare function parsePGM(data: Uint8Array, options: {
10
+ cubic?: boolean;
11
+ }): Geoid;
@@ -0,0 +1,11 @@
1
+ export declare const WGS84_RADIUS_X = 6378137;
2
+ export declare const WGS84_RADIUS_Y = 6378137;
3
+ export declare const WGS84_RADIUS_Z = 6356752.314245179;
4
+ export declare const WGS84_CONSTANTS: {
5
+ radii: number[];
6
+ radiiSquared: number[];
7
+ oneOverRadii: number[];
8
+ oneOverRadiiSquared: number[];
9
+ maximumRadius: number;
10
+ centerToleranceSquared: number;
11
+ };
@@ -0,0 +1,69 @@
1
+ import { Euler, Vector3, Matrix3, Quaternion, NumericArray } from '../../core';
2
+ import { AxisDirection } from './helpers/ellipsoid-transform';
3
+ /**
4
+ * A quadratic surface defined in Cartesian coordinates by the equation
5
+ * `(x / a)^2 + (y / b)^2 + (z / c)^2 = 1`. Primarily used
6
+ * to represent the shape of planetary bodies.
7
+ */
8
+ export declare class Ellipsoid {
9
+ /** An Ellipsoid instance initialized to the WGS84 standard. */
10
+ static readonly WGS84: Ellipsoid;
11
+ readonly radii: Vector3;
12
+ readonly radiiSquared: Vector3;
13
+ readonly radiiToTheFourth: Vector3;
14
+ readonly oneOverRadii: Vector3;
15
+ readonly oneOverRadiiSquared: Vector3;
16
+ readonly minimumRadius: number;
17
+ readonly maximumRadius: number;
18
+ readonly centerToleranceSquared: number;
19
+ readonly squaredXOverSquaredZ: number;
20
+ /** Creates an Ellipsoid from a Cartesian specifying the radii in x, y, and z directions. */
21
+ constructor(x: number, y: number, z: number);
22
+ constructor();
23
+ /** Compares this Ellipsoid against the provided Ellipsoid componentwise */
24
+ equals(right: Ellipsoid): boolean;
25
+ /** Creates a string representing this Ellipsoid in the format '(radii.x, radii.y, radii.z)'. */
26
+ toString(): string;
27
+ /** Converts the provided cartographic to Cartesian representation. */
28
+ cartographicToCartesian(cartographic: number[], result: Vector3): Vector3;
29
+ cartographicToCartesian(cartographic: number[], result?: number[]): number[];
30
+ /** Converts the provided cartesian to cartographic (lng/lat/z) representation.
31
+ * The cartesian is undefined at the center of the ellipsoid. */
32
+ cartesianToCartographic(cartesian: Readonly<NumericArray>, result: Vector3): Vector3;
33
+ cartesianToCartographic(cartesian: Readonly<NumericArray>, result?: number[]): number[];
34
+ /** Computes a 4x4 transformation matrix from a reference frame with an east-north-up axes
35
+ * centered at the provided origin to the provided ellipsoid's fixed reference frame. */
36
+ eastNorthUpToFixedFrame<T extends NumericArray>(origin: Readonly<NumericArray>, result?: T): T;
37
+ /** Computes a 4x4 transformation matrix from a reference frame centered at
38
+ * the provided origin to the ellipsoid's fixed reference frame.
39
+ */
40
+ localFrameToFixedFrame<T extends NumericArray>(firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, origin: Readonly<NumericArray>, result?: T): T;
41
+ /** Computes the unit vector directed from the center of this ellipsoid toward
42
+ * the provided Cartesian position. */
43
+ geocentricSurfaceNormal(cartesian: number[], result?: number[]): number[];
44
+ geocentricSurfaceNormal<NumArray>(cartesian: number[], result: NumArray): NumArray;
45
+ /** Computes the normal of the plane tangent to the surface of the ellipsoid at provided position. */
46
+ geodeticSurfaceNormalCartographic<NumArray>(cartographic: Readonly<NumericArray>, result: NumArray): NumArray;
47
+ geodeticSurfaceNormalCartographic(cartographic: number[]): number[];
48
+ /** Computes the normal of the plane tangent to the surface of the ellipsoid at the provided position. */
49
+ geodeticSurfaceNormal<NumArrayT>(cartesian: number[], result: NumArrayT): NumArrayT;
50
+ geodeticSurfaceNormal(cartesian: number[]): number[];
51
+ /** Scales the provided Cartesian position along the geodetic surface normal
52
+ * so that it is on the surface of this ellipsoid. If the position is
53
+ * at the center of the ellipsoid, this function returns undefined. */
54
+ scaleToGeodeticSurface(cartesian: number[], result?: number[]): number[] | undefined;
55
+ /** Scales the provided Cartesian position along the geocentric surface normal
56
+ * so that it is on the surface of this ellipsoid. */
57
+ scaleToGeocentricSurface(cartesian: number[], result?: number[]): number[];
58
+ /** Transforms a Cartesian X, Y, Z position to the ellipsoid-scaled space by multiplying
59
+ * its components by the result of `Ellipsoid#oneOverRadii` */
60
+ transformPositionToScaledSpace(position: number[], result?: number[]): number[];
61
+ /** Transforms a Cartesian X, Y, Z position from the ellipsoid-scaled space by multiplying
62
+ * its components by the result of `Ellipsoid#radii`. */
63
+ transformPositionFromScaledSpace(position: number[], result?: number[]): number[];
64
+ /** Computes a point which is the intersection of the surface normal with the z-axis. */
65
+ getSurfaceNormalIntersectionWithZAxis(position: number[], buffer?: number, result?: number[]): number[] | undefined;
66
+ getEulerFromPositionQuaternion(position: Readonly<NumericArray>, quaternion: Readonly<NumericArray>, result?: Euler): Euler;
67
+ getRotationMatrixFromPositionVelocity(position: Readonly<NumericArray>, velocity: Readonly<NumericArray>, result?: Matrix3): Matrix3;
68
+ getQuaternionFromEuler(position: Readonly<NumericArray>, e: Euler, result?: Quaternion): Quaternion;
69
+ }
@@ -0,0 +1,4 @@
1
+ import { NumericArray } from '../../../core';
2
+ import { Ellipsoid } from '../ellipsoid';
3
+ export type AxisDirection = "up" | "down" | "north" | "east" | "south" | "west";
4
+ export declare function localFrameToFixedFrame<T extends NumericArray>(ellipsoid: Ellipsoid, firstAxis: AxisDirection, secondAxis: AxisDirection, thirdAxis: AxisDirection, cartesianOrigin: Readonly<NumericArray>, result: T): T;
@@ -0,0 +1,2 @@
1
+ import { Ellipsoid } from '../ellipsoid';
2
+ export declare function scaleToGeodeticSurface(cartesian: number[], ellipsoid: Ellipsoid, result?: number[]): number[] | undefined;