@math.gl/core 4.0.0 → 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.d.ts +1 -2
- package/dist/classes/base/math-array.js +223 -266
- package/dist/classes/base/matrix.d.ts +1 -2
- package/dist/classes/base/matrix.js +56 -53
- package/dist/classes/base/vector.d.ts +1 -2
- package/dist/classes/base/vector.js +125 -135
- package/dist/classes/euler.d.ts +2 -3
- package/dist/classes/euler.js +464 -533
- package/dist/classes/matrix3.d.ts +9 -4
- package/dist/classes/matrix3.js +191 -190
- package/dist/classes/matrix4.d.ts +8 -4
- package/dist/classes/matrix4.js +521 -452
- package/dist/classes/pose.d.ts +4 -5
- package/dist/classes/pose.js +106 -119
- package/dist/classes/quaternion.d.ts +1 -2
- package/dist/classes/quaternion.js +261 -233
- package/dist/classes/spherical-coordinates.d.ts +3 -4
- package/dist/classes/spherical-coordinates.js +142 -147
- package/dist/classes/vector2.d.ts +6 -5
- package/dist/classes/vector2.js +103 -85
- package/dist/classes/vector3.d.ts +6 -5
- package/dist/classes/vector3.js +129 -136
- package/dist/classes/vector4.d.ts +7 -6
- package/dist/classes/vector4.js +108 -114
- package/dist/gl-matrix/common.d.ts +0 -1
- package/dist/gl-matrix/common.js +38 -6
- package/dist/gl-matrix/mat3.d.ts +0 -1
- package/dist/gl-matrix/mat3.js +699 -425
- package/dist/gl-matrix/mat4.d.ts +0 -1
- package/dist/gl-matrix/mat4.js +1879 -1339
- package/dist/gl-matrix/quat.d.ts +0 -1
- package/dist/gl-matrix/quat.js +655 -257
- package/dist/gl-matrix/vec2.d.ts +0 -1
- package/dist/gl-matrix/vec2.js +529 -212
- package/dist/gl-matrix/vec3.d.ts +0 -1
- package/dist/gl-matrix/vec3.js +703 -335
- package/dist/gl-matrix/vec4.d.ts +0 -1
- package/dist/gl-matrix/vec4.js +579 -293
- package/dist/gl-matrix/wip/index.d.ts +3 -4
- package/dist/gl-matrix/wip/index.js +5 -1
- package/dist/gl-matrix/wip/mat2.d.ts +1 -2
- package/dist/gl-matrix/wip/mat2.js +336 -157
- package/dist/gl-matrix/wip/mat2d.d.ts +0 -1
- package/dist/gl-matrix/wip/mat2d.js +380 -202
- package/dist/gl-matrix/wip/quat2.d.ts +0 -1
- package/dist/gl-matrix/wip/quat2.js +650 -409
- package/dist/index.cjs +60 -100
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +27 -23
- package/dist/index.js +25 -16
- package/dist/lib/assert.d.ts +0 -1
- package/dist/lib/assert.js +6 -4
- package/dist/lib/common.d.ts +2 -3
- package/dist/lib/common.js +165 -134
- package/dist/lib/gl-matrix-extras.d.ts +0 -1
- package/dist/lib/gl-matrix-extras.js +42 -36
- package/dist/lib/math-utils.d.ts +0 -1
- package/dist/lib/math-utils.js +5 -1
- package/dist/lib/validators.d.ts +0 -1
- package/dist/lib/validators.js +25 -25
- package/package.json +5 -6
- 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 +12 -3
- 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/dist/classes/base/math-array.d.ts.map +0 -1
- package/dist/classes/base/math-array.js.map +0 -1
- package/dist/classes/base/matrix.d.ts.map +0 -1
- package/dist/classes/base/matrix.js.map +0 -1
- package/dist/classes/base/vector.d.ts.map +0 -1
- package/dist/classes/base/vector.js.map +0 -1
- package/dist/classes/euler.d.ts.map +0 -1
- package/dist/classes/euler.js.map +0 -1
- package/dist/classes/matrix3.d.ts.map +0 -1
- package/dist/classes/matrix3.js.map +0 -1
- package/dist/classes/matrix4.d.ts.map +0 -1
- package/dist/classes/matrix4.js.map +0 -1
- package/dist/classes/pose.d.ts.map +0 -1
- package/dist/classes/pose.js.map +0 -1
- package/dist/classes/quaternion.d.ts.map +0 -1
- package/dist/classes/quaternion.js.map +0 -1
- package/dist/classes/spherical-coordinates.d.ts.map +0 -1
- package/dist/classes/spherical-coordinates.js.map +0 -1
- package/dist/classes/vector2.d.ts.map +0 -1
- package/dist/classes/vector2.js.map +0 -1
- package/dist/classes/vector3.d.ts.map +0 -1
- package/dist/classes/vector3.js.map +0 -1
- package/dist/classes/vector4.d.ts.map +0 -1
- package/dist/classes/vector4.js.map +0 -1
- package/dist/gl-matrix/common.d.ts.map +0 -1
- package/dist/gl-matrix/common.js.map +0 -1
- package/dist/gl-matrix/mat3.d.ts.map +0 -1
- package/dist/gl-matrix/mat3.js.map +0 -1
- package/dist/gl-matrix/mat4.d.ts.map +0 -1
- package/dist/gl-matrix/mat4.js.map +0 -1
- package/dist/gl-matrix/quat.d.ts.map +0 -1
- package/dist/gl-matrix/quat.js.map +0 -1
- package/dist/gl-matrix/vec2.d.ts.map +0 -1
- package/dist/gl-matrix/vec2.js.map +0 -1
- package/dist/gl-matrix/vec3.d.ts.map +0 -1
- package/dist/gl-matrix/vec3.js.map +0 -1
- package/dist/gl-matrix/vec4.d.ts.map +0 -1
- package/dist/gl-matrix/vec4.js.map +0 -1
- package/dist/gl-matrix/wip/index.d.ts.map +0 -1
- package/dist/gl-matrix/wip/index.js.map +0 -1
- package/dist/gl-matrix/wip/mat2.d.ts.map +0 -1
- package/dist/gl-matrix/wip/mat2.js.map +0 -1
- package/dist/gl-matrix/wip/mat2d.d.ts.map +0 -1
- package/dist/gl-matrix/wip/mat2d.js.map +0 -1
- package/dist/gl-matrix/wip/quat2.d.ts.map +0 -1
- package/dist/gl-matrix/wip/quat2.js.map +0 -1
- package/dist/gl-matrix/wip/types.d.js +0 -2
- package/dist/gl-matrix/wip/types.d.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/assert.d.ts.map +0 -1
- package/dist/lib/assert.js.map +0 -1
- package/dist/lib/common.d.ts.map +0 -1
- package/dist/lib/common.js.map +0 -1
- package/dist/lib/gl-matrix-extras.d.ts.map +0 -1
- package/dist/lib/gl-matrix-extras.js.map +0 -1
- package/dist/lib/gl-matrix.d.js +0 -2
- package/dist/lib/gl-matrix.d.js.map +0 -1
- package/dist/lib/math-utils.d.ts.map +0 -1
- package/dist/lib/math-utils.js.map +0 -1
- package/dist/lib/validators.d.ts.map +0 -1
- package/dist/lib/validators.js.map +0 -1
- package/src/gl-matrix/wip/types.d.ts +0 -93
package/dist/classes/pose.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Matrix4 } from
|
|
2
|
-
import { Vector3 } from
|
|
3
|
-
import { Euler } from
|
|
1
|
+
import { Matrix4 } from "./matrix4.js";
|
|
2
|
+
import { Vector3 } from "./vector3.js";
|
|
3
|
+
import { Euler } from "./euler.js";
|
|
4
4
|
import { NumericArray } from '@math.gl/types';
|
|
5
|
-
|
|
5
|
+
type PoseOptions = {
|
|
6
6
|
position?: Readonly<NumericArray>;
|
|
7
7
|
orientation?: Readonly<NumericArray>;
|
|
8
8
|
x?: number;
|
|
@@ -37,4 +37,3 @@ export declare class Pose {
|
|
|
37
37
|
getTransformationMatrixToPose(pose: Pose): Matrix4;
|
|
38
38
|
}
|
|
39
39
|
export {};
|
|
40
|
-
//# sourceMappingURL=pose.d.ts.map
|
package/dist/classes/pose.js
CHANGED
|
@@ -1,124 +1,111 @@
|
|
|
1
|
-
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
4
|
+
// Copyright (c) 2017 Uber Technologies, Inc.
|
|
2
5
|
import { Matrix4 } from "./matrix4.js";
|
|
3
6
|
import { Vector3 } from "./vector3.js";
|
|
4
7
|
import { Euler } from "./euler.js";
|
|
5
8
|
export class Pose {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
const sw = Math.sin(this.yaw);
|
|
109
|
-
const cr = Math.cos(this.roll);
|
|
110
|
-
const cp = Math.cos(this.pitch);
|
|
111
|
-
const cw = Math.cos(this.yaw);
|
|
112
|
-
return new Matrix4().setRowMajor(cw * cp, -sw * cr + cw * sp * sr, sw * sr + cw * sp * cr, this.x, sw * cp, cw * cr + sw * sp * sr, -cw * sr + sw * sp * cr, this.y, -sp, cp * sr, cp * cr, this.z, 0, 0, 0, 1);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
getTransformationMatrixFromPose(pose) {
|
|
116
|
-
return new Matrix4().multiplyRight(this.getTransformationMatrix()).multiplyRight(pose.getTransformationMatrix().invert());
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
getTransformationMatrixToPose(pose) {
|
|
120
|
-
return new Matrix4().multiplyRight(pose.getTransformationMatrix()).multiplyRight(this.getTransformationMatrix().invert());
|
|
121
|
-
}
|
|
122
|
-
|
|
9
|
+
constructor({ x = 0, y = 0, z = 0, roll = 0, pitch = 0, yaw = 0, position, orientation } = {}) {
|
|
10
|
+
if (Array.isArray(position) && position.length === 3) {
|
|
11
|
+
this.position = new Vector3(position);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
this.position = new Vector3(x, y, z);
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(orientation) && orientation.length === 4) {
|
|
17
|
+
// @ts-expect-error
|
|
18
|
+
this.orientation = new Euler(orientation, orientation[3]);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
this.orientation = new Euler(roll, pitch, yaw, Euler.RollPitchYaw);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
get x() {
|
|
25
|
+
return this.position.x;
|
|
26
|
+
}
|
|
27
|
+
set x(value) {
|
|
28
|
+
this.position.x = value;
|
|
29
|
+
}
|
|
30
|
+
get y() {
|
|
31
|
+
return this.position.y;
|
|
32
|
+
}
|
|
33
|
+
set y(value) {
|
|
34
|
+
this.position.y = value;
|
|
35
|
+
}
|
|
36
|
+
get z() {
|
|
37
|
+
return this.position.z;
|
|
38
|
+
}
|
|
39
|
+
set z(value) {
|
|
40
|
+
this.position.z = value;
|
|
41
|
+
}
|
|
42
|
+
get roll() {
|
|
43
|
+
return this.orientation.roll;
|
|
44
|
+
}
|
|
45
|
+
set roll(value) {
|
|
46
|
+
this.orientation.roll = value;
|
|
47
|
+
}
|
|
48
|
+
get pitch() {
|
|
49
|
+
return this.orientation.pitch;
|
|
50
|
+
}
|
|
51
|
+
set pitch(value) {
|
|
52
|
+
this.orientation.pitch = value;
|
|
53
|
+
}
|
|
54
|
+
get yaw() {
|
|
55
|
+
return this.orientation.yaw;
|
|
56
|
+
}
|
|
57
|
+
set yaw(value) {
|
|
58
|
+
this.orientation.yaw = value;
|
|
59
|
+
}
|
|
60
|
+
getPosition() {
|
|
61
|
+
return this.position;
|
|
62
|
+
}
|
|
63
|
+
getOrientation() {
|
|
64
|
+
return this.orientation;
|
|
65
|
+
}
|
|
66
|
+
equals(pose) {
|
|
67
|
+
if (!pose) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
return this.position.equals(pose.position) && this.orientation.equals(pose.orientation);
|
|
71
|
+
}
|
|
72
|
+
exactEquals(pose) {
|
|
73
|
+
if (!pose) {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
return (this.position.exactEquals(pose.position) && this.orientation.exactEquals(pose.orientation));
|
|
77
|
+
}
|
|
78
|
+
getTransformationMatrix() {
|
|
79
|
+
// setup pre computations for the sin/cos of the angles
|
|
80
|
+
const sr = Math.sin(this.roll);
|
|
81
|
+
const sp = Math.sin(this.pitch);
|
|
82
|
+
const sw = Math.sin(this.yaw);
|
|
83
|
+
const cr = Math.cos(this.roll);
|
|
84
|
+
const cp = Math.cos(this.pitch);
|
|
85
|
+
const cw = Math.cos(this.yaw);
|
|
86
|
+
// Create matrix
|
|
87
|
+
return new Matrix4().setRowMajor(cw * cp, // 0,0
|
|
88
|
+
-sw * cr + cw * sp * sr, // 0,1
|
|
89
|
+
sw * sr + cw * sp * cr, // 0,2
|
|
90
|
+
this.x, // 0,3
|
|
91
|
+
sw * cp, // 1,0
|
|
92
|
+
cw * cr + sw * sp * sr, // 1,1
|
|
93
|
+
-cw * sr + sw * sp * cr, // 1,2
|
|
94
|
+
this.y, // 1,3
|
|
95
|
+
-sp, // 2,0
|
|
96
|
+
cp * sr, // 2,1
|
|
97
|
+
cp * cr, // 2,2
|
|
98
|
+
this.z, // 2,3
|
|
99
|
+
0, 0, 0, 1);
|
|
100
|
+
}
|
|
101
|
+
getTransformationMatrixFromPose(pose) {
|
|
102
|
+
return new Matrix4()
|
|
103
|
+
.multiplyRight(this.getTransformationMatrix())
|
|
104
|
+
.multiplyRight(pose.getTransformationMatrix().invert());
|
|
105
|
+
}
|
|
106
|
+
getTransformationMatrixToPose(pose) {
|
|
107
|
+
return new Matrix4()
|
|
108
|
+
.multiplyRight(pose.getTransformationMatrix())
|
|
109
|
+
.multiplyRight(this.getTransformationMatrix().invert());
|
|
110
|
+
}
|
|
123
111
|
}
|
|
124
|
-
//# sourceMappingURL=pose.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NumericArray } from '@math.gl/types';
|
|
2
|
-
import { MathArray } from
|
|
2
|
+
import { MathArray } from "./base/math-array.js";
|
|
3
3
|
export declare class Quaternion extends MathArray {
|
|
4
4
|
constructor(x?: number | Readonly<NumericArray>, y?: number, z?: number, w?: number);
|
|
5
5
|
copy(array: Readonly<NumericArray>): this;
|
|
@@ -60,4 +60,3 @@ export declare class Quaternion extends MathArray {
|
|
|
60
60
|
premultiply(a: Readonly<NumericArray>): this;
|
|
61
61
|
multiply(a: Readonly<NumericArray>): this;
|
|
62
62
|
}
|
|
63
|
-
//# sourceMappingURL=quaternion.d.ts.map
|