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