@math.gl/core 4.0.1 → 4.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/classes/base/math-array.js +3 -0
- package/dist/classes/base/matrix.js +4 -0
- package/dist/classes/base/vector.js +4 -0
- package/dist/classes/euler.js +3 -1
- package/dist/classes/matrix3.d.ts +7 -1
- package/dist/classes/matrix3.js +7 -1
- package/dist/classes/matrix4.d.ts +7 -2
- package/dist/classes/matrix4.js +7 -2
- package/dist/classes/pose.js +3 -1
- package/dist/classes/quaternion.js +4 -0
- package/dist/classes/spherical-coordinates.js +4 -0
- package/dist/classes/vector2.d.ts +5 -3
- package/dist/classes/vector2.js +5 -3
- package/dist/classes/vector3.d.ts +5 -3
- package/dist/classes/vector3.js +6 -2
- package/dist/classes/vector4.d.ts +5 -3
- package/dist/classes/vector4.js +5 -3
- package/dist/gl-matrix/wip/index.js +3 -0
- package/dist/gl-matrix/wip/mat2.d.ts +1 -1
- package/dist/gl-matrix/wip/mat2.js +3 -0
- package/dist/gl-matrix/wip/mat2d.js +3 -0
- package/dist/gl-matrix/wip/quat2.js +3 -0
- package/dist/index.cjs.map +2 -2
- package/dist/index.d.ts +6 -1
- package/dist/index.js +3 -1
- package/dist/lib/assert.js +3 -0
- package/dist/lib/common.js +3 -1
- package/dist/lib/gl-matrix-extras.js +3 -0
- package/dist/lib/math-utils.js +3 -0
- package/dist/lib/validators.js +3 -0
- package/package.json +3 -3
- package/src/classes/base/math-array.ts +4 -1
- package/src/classes/base/matrix.ts +4 -1
- package/src/classes/base/vector.ts +4 -1
- package/src/classes/euler.ts +4 -1
- package/src/classes/matrix3.ts +11 -2
- package/src/classes/matrix4.ts +11 -3
- package/src/classes/pose.ts +4 -1
- package/src/classes/quaternion.ts +4 -1
- package/src/classes/spherical-coordinates.ts +4 -1
- package/src/classes/vector2.ts +11 -4
- package/src/classes/vector3.ts +10 -4
- package/src/classes/vector4.ts +9 -4
- package/src/gl-matrix/wip/index.js +4 -0
- package/src/gl-matrix/wip/mat2.js +4 -0
- package/src/gl-matrix/wip/mat2d.js +4 -0
- package/src/gl-matrix/wip/quat2.ts +4 -0
- package/src/index.ts +10 -2
- package/src/lib/assert.ts +4 -0
- package/src/lib/common.ts +3 -1
- package/src/lib/gl-matrix-extras.ts +4 -0
- package/src/lib/gl-matrix.d.ts +4 -0
- package/src/lib/math-utils.ts +4 -0
- package/src/lib/validators.ts +4 -19
- package/src/gl-matrix/wip/types.d.ts +0 -93
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
1
5
|
import { MathArray } from "./math-array.js";
|
|
2
6
|
import { checkNumber } from "../../lib/validators.js";
|
|
3
7
|
import { config } from "../../lib/common.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
1
5
|
import { MathArray } from "./math-array.js";
|
|
2
6
|
import { checkNumber } from "../../lib/validators.js";
|
|
3
7
|
import { assert } from "../../lib/assert.js";
|
package/dist/classes/euler.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
import { MathArray } from "./base/math-array.js";
|
|
4
6
|
import { Quaternion } from "./quaternion.js";
|
|
5
7
|
import { clamp } from "../lib/common.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumericArray } from '@math.gl/types';
|
|
1
|
+
import { NumericArray, NumberArray9 } from '@math.gl/types';
|
|
2
2
|
import { Matrix } from "./base/matrix.js";
|
|
3
3
|
declare enum INDICES {
|
|
4
4
|
COL0ROW0 = 0,
|
|
@@ -11,6 +11,12 @@ declare enum INDICES {
|
|
|
11
11
|
COL2ROW1 = 7,
|
|
12
12
|
COL2ROW2 = 8
|
|
13
13
|
}
|
|
14
|
+
/** Helper type that captures array length for a 3x3 matrix */
|
|
15
|
+
export type Matrix3Like = Matrix3 | NumberArray9;
|
|
16
|
+
/**
|
|
17
|
+
* A 3x3 matrix with common linear algebra operations
|
|
18
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
19
|
+
*/
|
|
14
20
|
export declare class Matrix3 extends Matrix {
|
|
15
21
|
static get IDENTITY(): Readonly<Matrix3>;
|
|
16
22
|
static get ZERO(): Readonly<Matrix3>;
|
package/dist/classes/matrix3.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
import { Matrix } from "./base/matrix.js";
|
|
4
6
|
import { checkVector } from "../lib/validators.js";
|
|
5
7
|
import { vec4_transformMat3 } from "../lib/gl-matrix-extras.js";
|
|
@@ -19,6 +21,10 @@ var INDICES;
|
|
|
19
21
|
INDICES[INDICES["COL2ROW2"] = 8] = "COL2ROW2";
|
|
20
22
|
})(INDICES || (INDICES = {}));
|
|
21
23
|
const IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 1, 0, 0, 0, 1]);
|
|
24
|
+
/**
|
|
25
|
+
* A 3x3 matrix with common linear algebra operations
|
|
26
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
27
|
+
*/
|
|
22
28
|
export class Matrix3 extends Matrix {
|
|
23
29
|
static get IDENTITY() {
|
|
24
30
|
return getIdentityMatrix();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { NumericArray } from '@math.gl/types';
|
|
1
|
+
import { NumericArray, NumberArray16 } from '@math.gl/types';
|
|
2
2
|
import { Matrix } from "./base/matrix.js";
|
|
3
3
|
declare enum INDICES {
|
|
4
4
|
COL0ROW0 = 0,
|
|
@@ -18,7 +18,12 @@ declare enum INDICES {
|
|
|
18
18
|
COL3ROW2 = 14,
|
|
19
19
|
COL3ROW3 = 15
|
|
20
20
|
}
|
|
21
|
-
/** 4x4 matrix */
|
|
21
|
+
/** Helper type that captures array length for a 4x4 matrix */
|
|
22
|
+
export type Matrix4Like = Matrix4 | NumberArray16;
|
|
23
|
+
/**
|
|
24
|
+
* A 4x4 matrix with common linear algebra operations
|
|
25
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
26
|
+
*/
|
|
22
27
|
export declare class Matrix4 extends Matrix {
|
|
23
28
|
static get IDENTITY(): Readonly<Matrix4>;
|
|
24
29
|
static get ZERO(): Readonly<Matrix4>;
|
package/dist/classes/matrix4.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
import { Matrix } from "./base/matrix.js";
|
|
4
6
|
import { checkVector } from "../lib/validators.js";
|
|
5
7
|
/* eslint-disable camelcase */
|
|
@@ -33,7 +35,10 @@ const DEFAULT_ASPECT = 1;
|
|
|
33
35
|
const DEFAULT_NEAR = 0.1;
|
|
34
36
|
const DEFAULT_FAR = 500;
|
|
35
37
|
const IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
|
|
36
|
-
/**
|
|
38
|
+
/**
|
|
39
|
+
* A 4x4 matrix with common linear algebra operations
|
|
40
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
41
|
+
*/
|
|
37
42
|
export class Matrix4 extends Matrix {
|
|
38
43
|
static get IDENTITY() {
|
|
39
44
|
return getIdentityMatrix();
|
package/dist/classes/pose.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
import { Matrix4 } from "./matrix4.js";
|
|
4
6
|
import { Vector3 } from "./vector3.js";
|
|
5
7
|
import { Euler } from "./euler.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
1
5
|
import { MathArray } from "./base/math-array.js";
|
|
2
6
|
import { checkNumber, checkVector } from "../lib/validators.js";
|
|
3
7
|
import { Vector4 } from "./vector4.js";
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
1
5
|
import { Vector3 } from "./vector3.js";
|
|
2
6
|
import { formatValue, equals, config } from "../lib/common.js";
|
|
3
7
|
import { degrees, radians, clamp } from "../lib/common.js";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { NumericArray, NumberArray2 } from '@math.gl/types';
|
|
1
2
|
import { Vector } from "./base/vector.js";
|
|
2
|
-
|
|
3
|
+
/** Helper type that captures array length for a 2 element vector */
|
|
4
|
+
export type Vector2Like = Vector2 | NumberArray2;
|
|
3
5
|
/**
|
|
4
|
-
* Two-element vector class.
|
|
5
|
-
* Subclass of Array<number>
|
|
6
|
+
* Two-element vector class with common linear algebra operations.
|
|
7
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
6
8
|
*/
|
|
7
9
|
export declare class Vector2 extends Vector {
|
|
8
10
|
constructor(x?: number | Readonly<NumericArray>, y?: number);
|
package/dist/classes/vector2.js
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
import { Vector } from "./base/vector.js";
|
|
4
6
|
import { config, isArray } from "../lib/common.js";
|
|
5
7
|
import { checkNumber } from "../lib/validators.js";
|
|
6
8
|
import { transformMat4 as vec2_transformMat4, transformMat3 as vec2_transformMat3, transformMat2d as vec2_transformMat2d, transformMat2 as vec2_transformMat2 } from "../gl-matrix/vec2.js";
|
|
7
9
|
import { vec2_transformMat4AsVector } from "../lib/gl-matrix-extras.js";
|
|
8
10
|
/**
|
|
9
|
-
* Two-element vector class.
|
|
10
|
-
* Subclass of Array<number>
|
|
11
|
+
* Two-element vector class with common linear algebra operations.
|
|
12
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
11
13
|
*/
|
|
12
14
|
export class Vector2 extends Vector {
|
|
13
15
|
// Creates a new, empty vec2
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { NumericArray } from '@math.gl/types';
|
|
1
|
+
import { NumericArray, NumberArray3 } from '@math.gl/types';
|
|
2
2
|
import { Vector } from "./base/vector.js";
|
|
3
|
+
/** Helper type that captures array length for a 3 element vector */
|
|
4
|
+
export type Vector3Like = Vector3 | NumberArray3;
|
|
3
5
|
/**
|
|
4
|
-
* Three-element vector class.
|
|
5
|
-
* Subclass of Array<number>
|
|
6
|
+
* Three-element vector class with common linear algebra operations.
|
|
7
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
6
8
|
*/
|
|
7
9
|
export declare class Vector3 extends Vector {
|
|
8
10
|
static get ZERO(): Vector3;
|
package/dist/classes/vector3.js
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
1
5
|
import { Vector } from "./base/vector.js";
|
|
2
6
|
import { config, isArray } from "../lib/common.js";
|
|
3
7
|
import { checkNumber } from "../lib/validators.js";
|
|
@@ -8,8 +12,8 @@ import { vec3_transformMat2, vec3_transformMat4AsVector } from "../lib/gl-matrix
|
|
|
8
12
|
const ORIGIN = [0, 0, 0];
|
|
9
13
|
let ZERO;
|
|
10
14
|
/**
|
|
11
|
-
* Three-element vector class.
|
|
12
|
-
* Subclass of Array<number>
|
|
15
|
+
* Three-element vector class with common linear algebra operations.
|
|
16
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
13
17
|
*/
|
|
14
18
|
export class Vector3 extends Vector {
|
|
15
19
|
static get ZERO() {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { NumericArray } from '@math.gl/types';
|
|
1
|
+
import { NumericArray, NumberArray4 } from '@math.gl/types';
|
|
2
2
|
import { Vector } from "./base/vector.js";
|
|
3
3
|
import type { Matrix4 } from "./matrix4.js";
|
|
4
|
+
/** Helper type that captures array length for a 4 element vector */
|
|
5
|
+
export type Vector4Like = Vector4 | NumberArray4;
|
|
4
6
|
/**
|
|
5
|
-
* Four-element vector class.
|
|
6
|
-
* Subclass of Array<number>
|
|
7
|
+
* Four-element vector class with common linear algebra operations.
|
|
8
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
7
9
|
*/
|
|
8
10
|
export declare class Vector4 extends Vector {
|
|
9
11
|
static get ZERO(): Vector4;
|
package/dist/classes/vector4.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
|
-
// MIT License
|
|
3
5
|
/* eslint-disable camelcase */
|
|
4
6
|
import { transformMat4 as vec4_transformMat4, transformQuat as vec4_transformQuat } from "../gl-matrix/vec3.js";
|
|
5
7
|
import { vec4_transformMat2, vec4_transformMat3 } from "../lib/gl-matrix-extras.js";
|
|
@@ -8,8 +10,8 @@ import { config, isArray } from "../lib/common.js";
|
|
|
8
10
|
import { checkNumber } from "../lib/validators.js";
|
|
9
11
|
let ZERO;
|
|
10
12
|
/**
|
|
11
|
-
* Four-element vector class.
|
|
12
|
-
* Subclass of Array<number>
|
|
13
|
+
* Four-element vector class with common linear algebra operations.
|
|
14
|
+
* Subclass of Array<number> meaning that it is highly compatible with other libraries
|
|
13
15
|
*/
|
|
14
16
|
export class Vector4 extends Vector {
|
|
15
17
|
static get ZERO() {
|
|
@@ -154,7 +154,7 @@ export function frob(a: ReadonlyMat2): number;
|
|
|
154
154
|
* @param {ReadonlyMat2} U the upper triangular matrix
|
|
155
155
|
* @param {ReadonlyMat2} a the input matrix to factorize
|
|
156
156
|
*/
|
|
157
|
-
export function LDU(L: ReadonlyMat2, D: ReadonlyMat2, U: ReadonlyMat2, a: ReadonlyMat2):
|
|
157
|
+
export function LDU(L: ReadonlyMat2, D: ReadonlyMat2, U: ReadonlyMat2, a: ReadonlyMat2): any[];
|
|
158
158
|
/**
|
|
159
159
|
* Adds two mat2's
|
|
160
160
|
*
|