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,41 @@
1
+ import { Dayjs } from 'dayjs';
2
+ import { default as Entity } from './entity';
3
+ import { default as Frame } from './frame';
4
+ import { default as GlobalProperties } from './globalProperties';
5
+ import { default as Header } from './header';
6
+ import { default as TimeSpan } from './timeSpan';
7
+ import { TrajectoryOptions, Trajectories } from '../trajectory/trajectory';
8
+ /** Parsed ACMI recording, including metadata, entities, and scene snapshots. */
9
+ export default class AcmiData {
10
+ /** Whether basic header, property, and timeline validation succeeded. */
11
+ isValid: boolean;
12
+ /** File type and ACMI version read from the header. */
13
+ header: Header;
14
+ /** Recording-level metadata and reference coordinates. */
15
+ globalProperties: GlobalProperties;
16
+ /** Absolute time range covered by the parsed frames. */
17
+ timeSpan: TimeSpan;
18
+ /** Entity metadata keyed by numeric ACMI entity ID. */
19
+ entities: Map<number, Entity>;
20
+ /** Chronologically ordered scene snapshots. */
21
+ frames: Array<Frame>;
22
+ private _searchFrameIndex;
23
+ /**
24
+ * Finds the latest frame at or before an absolute time.
25
+ *
26
+ * @param time - Absolute Day.js time to query.
27
+ * @returns The active frame, or `undefined` outside the recording time span.
28
+ */
29
+ getFrame(time: Dayjs): Frame | undefined;
30
+ private _addFrame;
31
+ /**
32
+ * Converts frame snapshots into trajectories sampled at a regular interval.
33
+ *
34
+ * @param options - Sampling interval and orientation-emulation settings.
35
+ * @returns Trajectories keyed by numeric ACMI entity ID.
36
+ * @throws `RangeError` if `sampleRate` is not finite and greater than zero.
37
+ * @remarks Unchanged intermediate states are omitted and the final state is
38
+ * always retained.
39
+ */
40
+ createSampledTrajectories(options?: TrajectoryOptions): Trajectories;
41
+ }
@@ -0,0 +1,26 @@
1
+ import { default as TimeSpan } from './timeSpan';
2
+ /** Metadata and active time range for one ACMI entity. */
3
+ export default class Entity {
4
+ /** Numeric value of the entity's hexadecimal ACMI ID. */
5
+ id: number;
6
+ /** Absolute interval during which the entity exists. */
7
+ timeSpan: TimeSpan;
8
+ /** Human-readable entity name. */
9
+ name?: string;
10
+ /** Components of the ACMI `Type` property, split on `+`. */
11
+ types?: string[];
12
+ /** Radio call sign. */
13
+ callsign?: string;
14
+ /** Pilot name. */
15
+ pilot?: string;
16
+ /** Group or formation name. */
17
+ group?: string;
18
+ /** Country associated with the entity. */
19
+ country?: string;
20
+ /** Coalition associated with the entity. */
21
+ coalition?: string;
22
+ /** Source-provided display color. */
23
+ color?: string;
24
+ /** @param id - Numeric ACMI entity ID. */
25
+ constructor(id: number);
26
+ }
@@ -0,0 +1,17 @@
1
+ import { default as ITransform } from './transform';
2
+ /** Entity transforms keyed by numeric ACMI entity ID. */
3
+ export type Scene = Map<number, ITransform>;
4
+ /** Timestamped snapshot of all active, retained entities. */
5
+ export default class Frame {
6
+ /** Seconds relative to the recording's reference time. */
7
+ timeStamp: number;
8
+ /** Entity transforms present at this timestamp. */
9
+ scene: Scene;
10
+ /**
11
+ * Creates a frame and shallow-copies an optional scene.
12
+ *
13
+ * @param timeStamp - Seconds relative to the recording's reference time.
14
+ * @param scene - Scene state to copy into the frame.
15
+ */
16
+ constructor(timeStamp: number, scene?: Scene);
17
+ }
@@ -0,0 +1,30 @@
1
+ import { default as dayjs, Dayjs } from 'dayjs';
2
+ /** Recording-level properties declared on ACMI object `0`. */
3
+ export default class GlobalProperties {
4
+ /** Absolute origin used to resolve frame and entity timestamps. */
5
+ referenceTime: dayjs.Dayjs;
6
+ /** Source application or system. */
7
+ dataSource?: string;
8
+ /** Name of the recording system. */
9
+ dataRecorder?: string;
10
+ /** Time at which the recording was created. */
11
+ recordingTime?: Dayjs;
12
+ /** Recording author. */
13
+ author?: string;
14
+ /** Recording title. */
15
+ title?: string;
16
+ /** Recording category. */
17
+ category?: string;
18
+ /** Briefing text. */
19
+ briefing?: string;
20
+ /** Debriefing text. */
21
+ debriefing?: string;
22
+ /** Free-form comments. */
23
+ comments?: string;
24
+ /** Longitude offset added to relative entity positions, in degrees. */
25
+ referenceLongitude?: number;
26
+ /** Latitude offset added to relative entity positions, in degrees. */
27
+ referenceLatitude?: number;
28
+ /** Unrecognized global properties preserved by name. */
29
+ additionalProps?: Map<string, string>;
30
+ }
@@ -0,0 +1,7 @@
1
+ /** ACMI file identification values read from the first two lines. */
2
+ export default class Header {
3
+ /** MIME-like ACMI file type, normally `text/acmi/tacview`. */
4
+ fileType: string;
5
+ /** ACMI format version, such as `2.1` or `2.2`. */
6
+ fileVersion: string;
7
+ }
@@ -0,0 +1,12 @@
1
+ import { default as dayjs } from 'dayjs';
2
+ /** Absolute start and end times for a recording or entity. */
3
+ export default class TimeSpan {
4
+ /** Inclusive start time, or an invalid Day.js value when unknown. */
5
+ start: dayjs.Dayjs;
6
+ /** Inclusive end time, or an invalid Day.js value when unknown. */
7
+ end: dayjs.Dayjs;
8
+ /** @returns Whether both endpoints contain valid Day.js values. */
9
+ isValid(): boolean;
10
+ /** @returns Duration in seconds, or `-1` when the span is invalid. */
11
+ duration(): number;
12
+ }
@@ -0,0 +1,22 @@
1
+ import { Vector3, Euler, Geoid } from '../math3d/index.ts';
2
+ /** Geodetic position and optional orientation for an entity in one frame. */
3
+ export default class Transform {
4
+ /** Longitude (degrees), latitude (degrees), and altitude (metres). */
5
+ position: Vector3;
6
+ /** Roll, pitch, and yaw in radians, when supplied by the recording. */
7
+ orientation?: Euler;
8
+ /** Global longitude offset in degrees used while decoding transforms. */
9
+ static refLong: number;
10
+ /** Global latitude offset in degrees used while decoding transforms. */
11
+ static refLat: number;
12
+ /** Optional geoid used to convert source altitudes. */
13
+ static geoid: Geoid | undefined;
14
+ /**
15
+ * Decodes ACMI transform components, inheriting omitted values.
16
+ *
17
+ * @param components - Longitude, latitude, altitude, roll, pitch, and yaw.
18
+ * Empty components are represented by `undefined`.
19
+ * @param previousTransform - Previous entity state used for omitted values.
20
+ */
21
+ constructor(components: (number | undefined)[], previousTransform: Transform | undefined);
22
+ }
@@ -0,0 +1,14 @@
1
+ import { default as AcmiData } from './acmi/acmiData';
2
+ import { default as Entity } from './acmi/entity';
3
+ import { default as Frame, Scene } from './acmi/frame';
4
+ import { default as GlobalProperties } from './acmi/globalProperties';
5
+ import { default as Header } from './acmi/header';
6
+ import { default as TimeSpan } from './acmi/timeSpan';
7
+ import { default as Transform } from './acmi/transform';
8
+ import { default as StateVector } from './trajectory/stateVector';
9
+ import { default as Trajectory, ITrajectoryOptions, TrajectoryOptions, Trajectories } from './trajectory/trajectory';
10
+ import { default as TrajectorySample, ITrajectorySample } from './trajectory/trajectorySample';
11
+ import { default as AcmiParser, AcmiBinaryInput, AcmiInput, AcmiParseError, AcmiParseErrorCode, AcmiParserOptions, parseAcmi } from './parser';
12
+ export type { Scene, ITrajectoryOptions, TrajectoryOptions, Trajectories, ITrajectorySample, TrajectorySample, AcmiBinaryInput, AcmiInput, AcmiParseErrorCode, AcmiParserOptions, };
13
+ export { AcmiData, AcmiParseError, AcmiParser, Entity, Frame, GlobalProperties, Header, StateVector, TimeSpan, Trajectory, Transform, parseAcmi, };
14
+ export default AcmiParser;
@@ -0,0 +1,66 @@
1
+ import { NumericArray } from '../../../types';
2
+ import { ConfigurationOptions } from '../../lib/common';
3
+ /** Base class for vectors and matrices */
4
+ export declare abstract class MathArray extends Array<number> {
5
+ /** Number of elements (values) in this array */
6
+ abstract get ELEMENTS(): number;
7
+ abstract copy(vector: Readonly<NumericArray>): this;
8
+ abstract fromObject(object: Record<string, unknown>): this;
9
+ /**
10
+ * Clone the current object
11
+ * @returns a new copy of this object
12
+ */
13
+ clone(): this;
14
+ fromArray(array: Readonly<NumericArray>, offset?: number): this;
15
+ toArray<TypedArray>(targetArray: TypedArray, offset?: number): TypedArray;
16
+ toArray(targetArray?: number[], offset?: number): NumericArray;
17
+ toObject(targetObject: Record<string, unknown>): Record<string, unknown>;
18
+ from(arrayOrObject: Readonly<NumericArray> | Record<string, unknown>): this;
19
+ to<T extends NumericArray | Record<string, unknown>>(arrayOrObject: T): T;
20
+ toTarget(target: this): this;
21
+ /** @deprecated */
22
+ toFloat32Array(): Float32Array;
23
+ toString(): string;
24
+ /** Formats string according to options */
25
+ formatString(opts: ConfigurationOptions): string;
26
+ equals(array: Readonly<NumericArray>): boolean;
27
+ exactEquals(array: Readonly<NumericArray>): boolean;
28
+ /** Negates all values in this object */
29
+ negate(): this;
30
+ /** Linearly interpolates between two values */
31
+ lerp(a: Readonly<NumericArray>, t: number): this;
32
+ lerp(a: Readonly<NumericArray>, b: Readonly<NumericArray>, t: number): this;
33
+ /** Minimal */
34
+ min(vector: Readonly<NumericArray>): this;
35
+ /** Maximal */
36
+ max(vector: Readonly<NumericArray>): this;
37
+ clamp(minVector: Readonly<NumericArray>, maxVector: Readonly<NumericArray>): this;
38
+ add(...vectors: Readonly<NumericArray>[]): this;
39
+ subtract(...vectors: Readonly<NumericArray>[]): this;
40
+ scale(scale: number | Readonly<NumericArray>): this;
41
+ /**
42
+ * Multiplies all elements by `scale`
43
+ * Note: `Matrix4.multiplyByScalar` only scales its 3x3 "minor"
44
+ */
45
+ multiplyByScalar(scalar: number): this;
46
+ /** Throws an error if array length is incorrect or contains illegal values */
47
+ check(): this;
48
+ /** Returns false if the array length is incorrect or contains illegal values */
49
+ validate(): boolean;
50
+ /** @deprecated */
51
+ sub(a: Readonly<NumericArray>): this;
52
+ /** @deprecated */
53
+ setScalar(a: number): this;
54
+ /** @deprecated */
55
+ addScalar(a: number): this;
56
+ /** @deprecated */
57
+ subScalar(a: number): this;
58
+ /** @deprecated */
59
+ multiplyScalar(scalar: number): this;
60
+ /** @deprecated */
61
+ divideScalar(a: number): this;
62
+ /** @deprecated */
63
+ clampScalar(min: number, max: number): this;
64
+ /** @deprecated */
65
+ get elements(): NumericArray;
66
+ }
@@ -0,0 +1,13 @@
1
+ import { NumericArray } from '../../../types';
2
+ import { MathArray } from './math-array';
3
+ /** Base class for matrices */
4
+ export declare abstract class Matrix extends MathArray {
5
+ abstract get RANK(): number;
6
+ toString(): string;
7
+ getElementIndex(row: number, col: number): number;
8
+ getElement(row: number, col: number): number;
9
+ setElement(row: number, col: number, value: number): this;
10
+ getColumn<NumArrayT>(columnIndex: number, result: NumArrayT): NumArrayT;
11
+ getColumn(columnIndex: number): number[];
12
+ setColumn(columnIndex: number, columnVector: Readonly<NumericArray>): this;
13
+ }
@@ -0,0 +1,43 @@
1
+ import { NumericArray } from '../../../types';
2
+ import { MathArray } from './math-array';
3
+ /** Base class for vectors with at least 2 elements */
4
+ export declare abstract class Vector extends MathArray {
5
+ get x(): number;
6
+ set x(value: number);
7
+ get y(): number;
8
+ set y(value: number);
9
+ /**
10
+ * Returns the length of the vector from the origin to the point described by this vector
11
+ *
12
+ * @note `length` is a reserved word for Arrays, so `v.length()` will return number of elements
13
+ * Instead we provide `len` and `magnitude`
14
+ */
15
+ len(): number;
16
+ /**
17
+ * Returns the length of the vector from the origin to the point described by this vector
18
+ */
19
+ magnitude(): number;
20
+ /**
21
+ * Returns the squared length of the vector from the origin to the point described by this vector
22
+ */
23
+ lengthSquared(): number;
24
+ /**
25
+ * Returns the squared length of the vector from the origin to the point described by this vector
26
+ */
27
+ magnitudeSquared(): number;
28
+ distance(mathArray: Readonly<NumericArray>): number;
29
+ distanceSquared(mathArray: Readonly<NumericArray>): number;
30
+ dot(mathArray: Readonly<NumericArray>): number;
31
+ normalize(): this;
32
+ multiply(...vectors: Readonly<NumericArray>[]): this;
33
+ divide(...vectors: Readonly<NumericArray>[]): this;
34
+ lengthSq(): number;
35
+ distanceTo(vector: Readonly<NumericArray>): number;
36
+ distanceToSquared(vector: Readonly<NumericArray>): number;
37
+ getComponent(i: number): number;
38
+ setComponent(i: number, value: number): this;
39
+ addVectors(a: Readonly<NumericArray>, b: Readonly<NumericArray>): this;
40
+ subVectors(a: Readonly<NumericArray>, b: Readonly<NumericArray>): this;
41
+ multiplyVectors(a: Readonly<NumericArray>, b: Readonly<NumericArray>): this;
42
+ addScaledVector(a: Readonly<NumericArray>, b: number): this;
43
+ }
@@ -0,0 +1,78 @@
1
+ import { MathArray } from './base/math-array';
2
+ import { Quaternion } from './quaternion';
3
+ import { NumericArray } from '../../types';
4
+ declare enum RotationOrder {
5
+ ZYX = 0,
6
+ YXZ = 1,
7
+ XZY = 2,
8
+ ZXY = 3,
9
+ YZX = 4,
10
+ XYZ = 5
11
+ }
12
+ export declare class Euler extends MathArray {
13
+ static get ZYX(): RotationOrder;
14
+ static get YXZ(): RotationOrder;
15
+ static get XZY(): RotationOrder;
16
+ static get ZXY(): RotationOrder;
17
+ static get YZX(): RotationOrder;
18
+ static get XYZ(): RotationOrder;
19
+ static get RollPitchYaw(): RotationOrder;
20
+ static get DefaultOrder(): RotationOrder;
21
+ static get RotationOrders(): typeof RotationOrder;
22
+ static rotationOrder(order: RotationOrder): string;
23
+ get ELEMENTS(): number;
24
+ /**
25
+ * @class
26
+ * @param {Number | Number[]} x
27
+ * @param {Number=} [y]
28
+ * @param {Number=} [z]
29
+ * @param {Number=} [order]
30
+ */
31
+ constructor(x?: number, y?: number, z?: number, order?: RotationOrder);
32
+ fromQuaternion(quaternion: Readonly<NumericArray>): this;
33
+ fromObject(_object: Record<string, unknown>): this;
34
+ copy(array: Readonly<NumericArray>): this;
35
+ set(x: number | undefined, y: number | undefined, z: number | undefined, order: RotationOrder): this;
36
+ validate(): boolean;
37
+ toArray(array?: NumericArray, offset?: number): NumericArray;
38
+ toArray4(array?: NumericArray, offset?: number): NumericArray;
39
+ toVector3(result?: NumericArray): NumericArray;
40
+ toHeadingPitchRoll(): NumericArray;
41
+ toHeadingPitchRoll<T extends NumericArray>(result: T): T;
42
+ get x(): number;
43
+ set x(value: number);
44
+ get y(): number;
45
+ set y(value: number);
46
+ get z(): number;
47
+ set z(value: number);
48
+ get alpha(): number;
49
+ set alpha(value: number);
50
+ get beta(): number;
51
+ set beta(value: number);
52
+ get gamma(): number;
53
+ set gamma(value: number);
54
+ get phi(): number;
55
+ set phi(value: number);
56
+ get theta(): number;
57
+ set theta(value: number);
58
+ get psi(): number;
59
+ set psi(value: number);
60
+ get roll(): number;
61
+ set roll(value: number);
62
+ get pitch(): number;
63
+ set pitch(value: number);
64
+ get yaw(): number;
65
+ set yaw(value: number);
66
+ get order(): RotationOrder;
67
+ set order(value: RotationOrder);
68
+ fromVector3(v: Readonly<NumericArray>, order: RotationOrder): this;
69
+ fromArray(array: Readonly<NumericArray>, offset?: number): this;
70
+ fromRollPitchYaw(roll: number, pitch: number, yaw: number): this;
71
+ fromRotationMatrix(m: Readonly<NumericArray>, order?: RotationOrder): this;
72
+ getRotationMatrix(m: NumericArray): NumericArray;
73
+ getQuaternion(): Quaternion;
74
+ _fromRotationMatrix(m: Readonly<NumericArray>, order?: RotationOrder): this;
75
+ _getRotationMatrix(result: NumericArray): NumericArray;
76
+ toQuaternion(): Quaternion;
77
+ }
78
+ export {};
@@ -0,0 +1,62 @@
1
+ import { NumericArray } from '../../types';
2
+ import { Matrix } from './base/matrix';
3
+ declare enum INDICES {
4
+ COL0ROW0 = 0,
5
+ COL0ROW1 = 1,
6
+ COL0ROW2 = 2,
7
+ COL1ROW0 = 3,
8
+ COL1ROW1 = 4,
9
+ COL1ROW2 = 5,
10
+ COL2ROW0 = 6,
11
+ COL2ROW1 = 7,
12
+ COL2ROW2 = 8
13
+ }
14
+ export declare class Matrix3 extends Matrix {
15
+ static get IDENTITY(): Readonly<Matrix3>;
16
+ static get ZERO(): Readonly<Matrix3>;
17
+ get ELEMENTS(): number;
18
+ get RANK(): number;
19
+ get INDICES(): typeof INDICES;
20
+ constructor(array?: Readonly<NumericArray>);
21
+ /** @deprecated */
22
+ constructor(...args: number[]);
23
+ copy(array: Readonly<NumericArray>): this;
24
+ identity(): this;
25
+ /**
26
+ *
27
+ * @param object
28
+ * @returns self
29
+ */
30
+ fromObject(_object: {
31
+ [key: string]: any;
32
+ }): this;
33
+ /** Calculates a 3x3 matrix from the given quaternion
34
+ * q quat Quaternion to create matrix from
35
+ */
36
+ fromQuaternion(q: Readonly<NumericArray>): this;
37
+ /**
38
+ * accepts column major order, stores in column major order
39
+ */
40
+ set(m00: number, m10: number, m20: number, m01: number, m11: number, m21: number, m02: number, m12: number, m22: number): this;
41
+ /**
42
+ * accepts row major order, stores as column major
43
+ */
44
+ setRowMajor(m00: number, m01: number, m02: number, m10: number, m11: number, m12: number, m20: number, m21: number, m22: number): this;
45
+ determinant(): number;
46
+ transpose(): this;
47
+ /** Invert a matrix. Note that this can fail if the matrix is not invertible */
48
+ invert(): this;
49
+ multiplyLeft(a: NumericArray): this;
50
+ multiplyRight(a: NumericArray): this;
51
+ rotate(radians: number): NumericArray;
52
+ scale(factor: NumericArray | number): this;
53
+ translate(vec: NumericArray): this;
54
+ transform(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
55
+ /** @deprecated */
56
+ transformVector(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
57
+ /** @deprecated */
58
+ transformVector2(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
59
+ /** @deprecated */
60
+ transformVector3(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
61
+ }
62
+ export {};
@@ -0,0 +1,232 @@
1
+ import { NumericArray } from '../../types';
2
+ import { Matrix } from './base/matrix';
3
+ declare enum INDICES {
4
+ COL0ROW0 = 0,
5
+ COL0ROW1 = 1,
6
+ COL0ROW2 = 2,
7
+ COL0ROW3 = 3,
8
+ COL1ROW0 = 4,
9
+ COL1ROW1 = 5,
10
+ COL1ROW2 = 6,
11
+ COL1ROW3 = 7,
12
+ COL2ROW0 = 8,
13
+ COL2ROW1 = 9,
14
+ COL2ROW2 = 10,
15
+ COL2ROW3 = 11,
16
+ COL3ROW0 = 12,
17
+ COL3ROW1 = 13,
18
+ COL3ROW2 = 14,
19
+ COL3ROW3 = 15
20
+ }
21
+ /** 4x4 matrix */
22
+ export declare class Matrix4 extends Matrix {
23
+ static get IDENTITY(): Readonly<Matrix4>;
24
+ static get ZERO(): Readonly<Matrix4>;
25
+ get ELEMENTS(): number;
26
+ get RANK(): number;
27
+ get INDICES(): typeof INDICES;
28
+ constructor(array?: Readonly<NumericArray>);
29
+ copy(array: Readonly<NumericArray>): this;
30
+ set(m00: number, m10: number, m20: number, m30: number, m01: number, m11: number, m21: number, m31: number, m02: number, m12: number, m22: number, m32: number, m03: number, m13: number, m23: number, m33: number): this;
31
+ setRowMajor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): this;
32
+ toRowMajor(result: NumericArray): NumericArray;
33
+ /** Set to identity matrix */
34
+ identity(): this;
35
+ /**
36
+ *
37
+ * @param object
38
+ * @returns self
39
+ */
40
+ fromObject(_object: {
41
+ [key: string]: any;
42
+ }): this;
43
+ /**
44
+ * Calculates a 4x4 matrix from the given quaternion
45
+ * @param quaternion Quaternion to create matrix from
46
+ * @returns self
47
+ */
48
+ fromQuaternion(quaternion: Readonly<NumericArray>): this;
49
+ /**
50
+ * Calculates a 4x4 matrix from the given translation and quaternion
51
+ * @param translation Vector3 to create matrix from
52
+ * @param quaternion Quaternion to create matrix from
53
+ * @returns self
54
+ */
55
+ fromTranslationQuaternion(translation: Readonly<NumericArray>, quaternion: Readonly<NumericArray>): this;
56
+ /**
57
+ * Generates a frustum matrix with the given bounds
58
+ * @param view.left - Left bound of the frustum
59
+ * @param view.right - Right bound of the frustum
60
+ * @param view.bottom - Bottom bound of the frustum
61
+ * @param view.top - Top bound of the frustum
62
+ * @param view.near - Near bound of the frustum
63
+ * @param view.far - Far bound of the frustum. Can be set to Infinity.
64
+ * @returns self
65
+ */
66
+ frustum(view: {
67
+ left: number;
68
+ right: number;
69
+ bottom: number;
70
+ top: number;
71
+ near: number;
72
+ far?: number;
73
+ }): this;
74
+ /**
75
+ * Generates a look-at matrix with the given eye position, focal point,
76
+ * and up axis
77
+ * @param view.eye - (vector) Position of the viewer
78
+ * @param view.center - (vector) Point the viewer is looking at
79
+ * @param view.up - (vector) Up axis
80
+ * @returns self
81
+ */
82
+ lookAt(view: {
83
+ eye: Readonly<NumericArray>;
84
+ center?: Readonly<NumericArray>;
85
+ up?: Readonly<NumericArray>;
86
+ }): this;
87
+ /**
88
+ * Generates a orthogonal projection matrix with the given bounds
89
+ * from "traditional" view space parameters
90
+ * @param view.left - Left bound of the frustum
91
+ * @param view.right number Right bound of the frustum
92
+ * @param view.bottom - Bottom bound of the frustum
93
+ * @param view.top number Top bound of the frustum
94
+ * @param view.near - Near bound of the frustum
95
+ * @param view.far number Far bound of the frustum
96
+ * @returns self
97
+ */
98
+ ortho(view: {
99
+ left: number;
100
+ right: number;
101
+ bottom: number;
102
+ top: number;
103
+ near?: number;
104
+ far?: number;
105
+ }): this;
106
+ /**
107
+ * Generates an orthogonal projection matrix with the same parameters
108
+ * as a perspective matrix (plus focalDistance)
109
+ * @param view.fovy Vertical field of view in radians
110
+ * @param view.aspect Aspect ratio. Typically viewport width / viewport height
111
+ * @param view.focalDistance Distance in the view frustum used for extent calculations
112
+ * @param view.near Near bound of the frustum
113
+ * @param view.far Far bound of the frustum
114
+ * @returns self
115
+ */
116
+ orthographic(view: {
117
+ fovy?: number;
118
+ aspect?: number;
119
+ focalDistance?: number;
120
+ near?: number;
121
+ far?: number;
122
+ }): this;
123
+ /**
124
+ * Generates a perspective projection matrix with the given bounds
125
+ * @param view.fovy Vertical field of view in radians
126
+ * @param view.aspect Aspect ratio. typically viewport width/height
127
+ * @param view.near Near bound of the frustum
128
+ * @param view.far Far bound of the frustum
129
+ * @returns self
130
+ */
131
+ perspective(view: {
132
+ fovy: number;
133
+ aspect?: number;
134
+ near?: number;
135
+ far?: number;
136
+ }): this;
137
+ determinant(): number;
138
+ /**
139
+ * Extracts the non-uniform scale assuming the matrix is an affine transformation.
140
+ * The scales are the "lengths" of the column vectors in the upper-left 3x3 matrix.
141
+ * @param result
142
+ * @returns self
143
+ */
144
+ getScale<T extends NumericArray>(result: T): T;
145
+ /**
146
+ * Gets the translation portion, assuming the matrix is a affine transformation matrix.
147
+ * @param result
148
+ * @returns self
149
+ */
150
+ getTranslation<T extends NumericArray>(result: T): T;
151
+ /**
152
+ * Gets upper left 3x3 pure rotation matrix (non-scaling), assume affine transformation matrix
153
+ * @param result
154
+ * @param scaleResult
155
+ * @returns self
156
+ */
157
+ getRotation<T extends NumericArray>(result: T, scaleResult?: NumericArray): T;
158
+ /**
159
+ *
160
+ * @param result
161
+ * @param scaleResult
162
+ * @returns self
163
+ */
164
+ getRotationMatrix3<T extends NumericArray>(result: T, scaleResult?: NumericArray): T;
165
+ transpose(): this;
166
+ invert(): this;
167
+ multiplyLeft(a: Readonly<NumericArray>): this;
168
+ multiplyRight(a: Readonly<NumericArray>): this;
169
+ rotateX(radians: number): this;
170
+ rotateY(radians: number): this;
171
+ /**
172
+ * Rotates a matrix by the given angle around the Z axis.
173
+ * @param radians
174
+ * @returns self
175
+ */
176
+ rotateZ(radians: number): this;
177
+ /**
178
+ *
179
+ * @param param0
180
+ * @returns self
181
+ */
182
+ rotateXYZ(angleXYZ: Readonly<NumericArray>): this;
183
+ /**
184
+ *
185
+ * @param radians
186
+ * @param axis
187
+ * @returns self
188
+ */
189
+ rotateAxis(radians: number, axis: Readonly<NumericArray>): this;
190
+ /**
191
+ *
192
+ * @param factor
193
+ * @returns self
194
+ */
195
+ scale(factor: number | Readonly<NumericArray>): this;
196
+ /**
197
+ *
198
+ * @param vec
199
+ * @returns self
200
+ */
201
+ translate(vector: Readonly<NumericArray>): this;
202
+ /**
203
+ * Transforms any 2, 3 or 4 element vector. 2 and 3 elements are treated as points
204
+ * @param vector
205
+ * @param result
206
+ * @returns self
207
+ */
208
+ transform(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
209
+ /**
210
+ * Transforms any 2 or 3 element array as point (w implicitly 1)
211
+ * @param vector
212
+ * @param result
213
+ * @returns self
214
+ */
215
+ transformAsPoint(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
216
+ /**
217
+ * Transforms any 2 or 3 element array as vector (w implicitly 0)
218
+ * @param vector
219
+ * @param result
220
+ * @returns self
221
+ */
222
+ transformAsVector(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
223
+ /** @deprecated */
224
+ transformPoint(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
225
+ /** @deprecated */
226
+ transformVector(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
227
+ /** @deprecated */
228
+ transformDirection(vector: Readonly<NumericArray>, result?: NumericArray): NumericArray;
229
+ makeRotationX(radians: number): this;
230
+ makeTranslation(x: number, y: number, z: number): this;
231
+ }
232
+ export {};