@math.gl/core 3.5.6 → 3.6.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.
Files changed (189) hide show
  1. package/dist/classes/base/math-array.d.ts +36 -0
  2. package/dist/classes/base/math-array.d.ts.map +1 -0
  3. package/dist/classes/base/math-array.js +214 -0
  4. package/dist/classes/base/matrix.d.ts +12 -0
  5. package/dist/classes/base/matrix.d.ts.map +1 -0
  6. package/dist/classes/base/matrix.js +69 -0
  7. package/dist/classes/base/vector.d.ts +32 -0
  8. package/dist/classes/base/vector.d.ts.map +1 -0
  9. package/dist/classes/base/vector.js +133 -0
  10. package/dist/classes/euler.d.ts +73 -0
  11. package/dist/classes/euler.d.ts.map +1 -0
  12. package/dist/classes/euler.js +505 -0
  13. package/dist/classes/matrix3.d.ts +43 -0
  14. package/dist/classes/matrix3.d.ts.map +1 -0
  15. package/dist/classes/matrix3.js +192 -0
  16. package/dist/classes/matrix4.d.ts +102 -0
  17. package/dist/classes/matrix4.d.ts.map +1 -0
  18. package/dist/classes/matrix4.js +457 -0
  19. package/dist/classes/pose.d.ts +37 -0
  20. package/dist/classes/pose.d.ts.map +1 -0
  21. package/dist/classes/pose.js +126 -0
  22. package/dist/classes/quaternion.d.ts +42 -0
  23. package/dist/classes/quaternion.d.ts.map +1 -0
  24. package/dist/classes/quaternion.js +266 -0
  25. package/dist/classes/spherical-coordinates.d.ts +40 -0
  26. package/dist/classes/spherical-coordinates.d.ts.map +1 -0
  27. package/dist/classes/spherical-coordinates.js +142 -0
  28. package/dist/classes/vector2.d.ts +19 -0
  29. package/dist/classes/vector2.d.ts.map +1 -0
  30. package/dist/classes/vector2.js +105 -0
  31. package/dist/classes/vector3.d.ts +41 -0
  32. package/dist/classes/vector3.d.ts.map +1 -0
  33. package/dist/classes/vector3.js +147 -0
  34. package/dist/classes/vector4.d.ts +23 -0
  35. package/dist/classes/vector4.d.ts.map +1 -0
  36. package/dist/classes/vector4.js +126 -0
  37. package/dist/es5/classes/base/math-array.d.js +46 -0
  38. package/dist/es5/classes/base/math-array.d.js.map +1 -0
  39. package/dist/es5/classes/base/math-array.js +178 -251
  40. package/dist/es5/classes/base/math-array.js.map +1 -1
  41. package/dist/es5/classes/base/matrix.d.js +15 -0
  42. package/dist/es5/classes/base/matrix.d.js.map +1 -0
  43. package/dist/es5/classes/base/matrix.js +54 -88
  44. package/dist/es5/classes/base/matrix.js.map +1 -1
  45. package/dist/es5/classes/base/vector.d.js +24 -0
  46. package/dist/es5/classes/base/vector.d.js.map +1 -0
  47. package/dist/es5/classes/base/vector.js +121 -179
  48. package/dist/es5/classes/base/vector.js.map +1 -1
  49. package/dist/es5/classes/euler.d.js +45 -0
  50. package/dist/es5/classes/euler.d.js.map +1 -0
  51. package/dist/es5/classes/euler.js +468 -549
  52. package/dist/es5/classes/euler.js.map +1 -1
  53. package/dist/es5/classes/matrix3.d.js +25 -0
  54. package/dist/es5/classes/matrix3.d.js.map +1 -0
  55. package/dist/es5/classes/matrix3.js +157 -206
  56. package/dist/es5/classes/matrix3.js.map +1 -1
  57. package/dist/es5/classes/matrix4.d.js +25 -0
  58. package/dist/es5/classes/matrix4.d.js.map +1 -0
  59. package/dist/es5/classes/matrix4.js +410 -500
  60. package/dist/es5/classes/matrix4.js.map +1 -1
  61. package/dist/es5/classes/pose.d.js +25 -0
  62. package/dist/es5/classes/pose.d.js.map +1 -0
  63. package/dist/es5/classes/pose.js +101 -125
  64. package/dist/es5/classes/pose.js.map +1 -1
  65. package/dist/es5/classes/quaternion.d.js +27 -0
  66. package/dist/es5/classes/quaternion.d.js.map +1 -0
  67. package/dist/es5/classes/quaternion.js +213 -277
  68. package/dist/es5/classes/quaternion.js.map +1 -1
  69. package/dist/es5/classes/spherical-coordinates.d.js +27 -0
  70. package/dist/es5/classes/spherical-coordinates.d.js.map +1 -0
  71. package/dist/es5/classes/spherical-coordinates.js +125 -166
  72. package/dist/es5/classes/spherical-coordinates.js.map +1 -1
  73. package/dist/es5/classes/vector2.d.js +18 -0
  74. package/dist/es5/classes/vector2.d.js.map +1 -0
  75. package/dist/es5/classes/vector2.js +76 -118
  76. package/dist/es5/classes/vector2.js.map +1 -1
  77. package/dist/es5/classes/vector3.d.js +24 -0
  78. package/dist/es5/classes/vector3.d.js.map +1 -0
  79. package/dist/es5/classes/vector3.js +120 -167
  80. package/dist/es5/classes/vector3.js.map +1 -1
  81. package/dist/es5/classes/vector4.d.js +25 -0
  82. package/dist/es5/classes/vector4.d.js.map +1 -0
  83. package/dist/es5/classes/vector4.js +95 -137
  84. package/dist/es5/classes/vector4.js.map +1 -1
  85. package/dist/es5/docs/README.md +0 -0
  86. package/dist/es5/index.js +105 -123
  87. package/dist/es5/index.js.map +1 -1
  88. package/dist/es5/lib/assert.js.map +1 -1
  89. package/dist/es5/lib/common.js +55 -84
  90. package/dist/es5/lib/common.js.map +1 -1
  91. package/dist/es5/lib/gl-matrix-extras.js +14 -14
  92. package/dist/es5/lib/gl-matrix-extras.js.map +1 -1
  93. package/dist/es5/lib/math-utils.js.map +1 -1
  94. package/dist/es5/lib/validators.js +3 -5
  95. package/dist/es5/lib/validators.js.map +1 -1
  96. package/dist/esm/classes/base/math-array.d.js +36 -0
  97. package/dist/esm/classes/base/math-array.d.js.map +1 -0
  98. package/dist/esm/classes/base/matrix.d.js +3 -0
  99. package/dist/esm/classes/base/matrix.d.js.map +1 -0
  100. package/dist/esm/classes/base/vector.d.js +13 -0
  101. package/dist/esm/classes/base/vector.d.js.map +1 -0
  102. package/dist/esm/classes/euler.d.js +55 -0
  103. package/dist/esm/classes/euler.d.js.map +1 -0
  104. package/dist/esm/classes/matrix3.d.js +15 -0
  105. package/dist/esm/classes/matrix3.d.js.map +1 -0
  106. package/dist/esm/classes/matrix4.d.js +15 -0
  107. package/dist/esm/classes/matrix4.d.js.map +1 -0
  108. package/dist/esm/classes/pose.d.js +18 -0
  109. package/dist/esm/classes/pose.d.js.map +1 -0
  110. package/dist/esm/classes/quaternion.d.js +19 -0
  111. package/dist/esm/classes/quaternion.d.js.map +1 -0
  112. package/dist/esm/classes/spherical-coordinates.d.js +22 -0
  113. package/dist/esm/classes/spherical-coordinates.d.js.map +1 -0
  114. package/dist/esm/classes/vector2.d.js +6 -0
  115. package/dist/esm/classes/vector2.d.js.map +1 -0
  116. package/dist/esm/classes/vector3.d.js +13 -0
  117. package/dist/esm/classes/vector3.d.js.map +1 -0
  118. package/dist/esm/classes/vector4.d.js +15 -0
  119. package/dist/esm/classes/vector4.d.js.map +1 -0
  120. package/dist/esm/docs/README.md +0 -0
  121. package/dist/esm/index.js +2 -13
  122. package/dist/esm/index.js.map +1 -1
  123. package/dist/esm/lib/assert.js.map +1 -1
  124. package/dist/esm/lib/common.js +34 -37
  125. package/dist/esm/lib/common.js.map +1 -1
  126. package/dist/esm/lib/gl-matrix-extras.js.map +1 -1
  127. package/dist/esm/lib/math-utils.js.map +1 -1
  128. package/dist/esm/lib/validators.js.map +1 -1
  129. package/dist/index.d.ts +17 -0
  130. package/dist/index.d.ts.map +1 -0
  131. package/dist/index.js +24 -0
  132. package/dist/lib/assert.d.ts +2 -0
  133. package/dist/lib/assert.d.ts.map +1 -0
  134. package/dist/lib/assert.js +5 -0
  135. package/dist/lib/common.d.ts +90 -0
  136. package/dist/lib/common.d.ts.map +1 -0
  137. package/dist/lib/common.js +223 -0
  138. package/dist/lib/gl-matrix-extras.d.ts +6 -0
  139. package/dist/lib/gl-matrix-extras.d.ts.map +1 -0
  140. package/dist/lib/gl-matrix-extras.js +50 -0
  141. package/dist/lib/math-utils.d.ts +28 -0
  142. package/dist/lib/math-utils.d.ts.map +1 -0
  143. package/dist/lib/math-utils.js +28 -0
  144. package/dist/lib/validators.d.ts +5 -0
  145. package/dist/lib/validators.d.ts.map +1 -0
  146. package/dist/lib/validators.js +52 -0
  147. package/package.json +4 -3
  148. package/src/classes/base/math-array.d.ts +0 -1
  149. package/src/docs/README.md +0 -0
  150. package/{dist/esm/index.d.ts → src/index.ts} +32 -34
  151. package/src/lib/{assert.js → assert.ts} +1 -1
  152. package/src/lib/common.ts +283 -0
  153. package/src/lib/{gl-matrix-extras.js → gl-matrix-extras.ts} +0 -0
  154. package/src/lib/{math-utils.js → math-utils.ts} +0 -0
  155. package/src/lib/{validators.js → validators.ts} +0 -0
  156. package/dist/es5/addons/polygon.d.ts +0 -17
  157. package/dist/es5/classes/base/math-array.d.ts +0 -56
  158. package/dist/es5/classes/base/matrix.d.ts +0 -15
  159. package/dist/es5/classes/base/vector.d.ts +0 -45
  160. package/dist/es5/classes/euler.d.ts +0 -92
  161. package/dist/es5/classes/matrix3.d.ts +0 -91
  162. package/dist/es5/classes/matrix4.d.ts +0 -161
  163. package/dist/es5/classes/pose.d.ts +0 -92
  164. package/dist/es5/classes/quaternion.d.ts +0 -107
  165. package/dist/es5/classes/spherical-coordinates.d.ts +0 -87
  166. package/dist/es5/classes/vector2.d.ts +0 -65
  167. package/dist/es5/classes/vector3.d.ts +0 -65
  168. package/dist/es5/classes/vector4.d.ts +0 -34
  169. package/dist/es5/index.d.ts +0 -54
  170. package/dist/es5/lib/common.d.ts +0 -80
  171. package/dist/esm/addons/polygon.d.ts +0 -17
  172. package/dist/esm/classes/base/math-array.d.ts +0 -56
  173. package/dist/esm/classes/base/matrix.d.ts +0 -15
  174. package/dist/esm/classes/base/vector.d.ts +0 -45
  175. package/dist/esm/classes/euler.d.ts +0 -92
  176. package/dist/esm/classes/matrix3.d.ts +0 -91
  177. package/dist/esm/classes/matrix4.d.ts +0 -161
  178. package/dist/esm/classes/pose.d.ts +0 -92
  179. package/dist/esm/classes/quaternion.d.ts +0 -107
  180. package/dist/esm/classes/spherical-coordinates.d.ts +0 -87
  181. package/dist/esm/classes/vector2.d.ts +0 -65
  182. package/dist/esm/classes/vector3.d.ts +0 -65
  183. package/dist/esm/classes/vector4.d.ts +0 -34
  184. package/dist/esm/lib/common.d.ts +0 -80
  185. package/src/addons/polygon.d.ts +0 -17
  186. package/src/index.d.ts +0 -54
  187. package/src/index.js +0 -86
  188. package/src/lib/common.d.ts +0 -80
  189. package/src/lib/common.js +0 -222
@@ -1,107 +0,0 @@
1
- import MathArray from './base/math-array';
2
-
3
- export default class Quaternion extends MathArray<Quaternion> {
4
- // Getters/setters
5
- ELEMENTS: number;
6
-
7
- x: number;
8
- y: number;
9
- z: number;
10
- w: number;
11
-
12
- /** Creates a new identity quaternion: `w^2 + x^2 + y^2 + z^2 = 1` */
13
- constructor();
14
- constructor(q: Quaternion);
15
- constructor(q: readonly number[]);
16
- constructor(x: number, y: number, z: number, w: number);
17
-
18
- copy(array: readonly number[]): Quaternion;
19
-
20
- set(x: number, y: number, z: number, w: number): Quaternion;
21
-
22
- /**
23
- * Creates a quaternion from the given 3x3 rotation matrix.
24
- *
25
- * - The resultant quaternion is not normalized, so you should
26
- * be sure to renormalize the quaternion yourself where necessary.
27
- */
28
- fromMatrix3(m: readonly number[]): Quaternion;
29
-
30
- fromAxisRotation(axis, rad): Quaternion;
31
-
32
- /** Set a quat to the identity quaternion */
33
- identity(): Quaternion;
34
-
35
- // Set the components of a quaternion to the given values
36
- // set(i, j, k, l) {
37
- // quat.set(this, i, j, k, l);
38
- // return this.check();
39
- // }
40
-
41
- /** Sets a quaternion from the given angle and rotation axis, then returns it. */
42
- setAxisAngle(axis, rad): Quaternion;
43
-
44
- /** Calculates the length of a quaternion */
45
- len(): number;
46
-
47
- /** Calculates the squared length of a quaternion */
48
- lengthSquared(): number;
49
-
50
- /** Calculates the dot product of two quaternions */
51
- dot(a: readonly number[]): number;
52
-
53
- rotationTo(vectorA, vectorB): Quaternion;
54
-
55
- /** Adds two quaternions */
56
- add(a: readonly number[]): Quaternion;
57
-
58
- /**
59
- * Calculates the W component of a quat from the X, Y, and Z components.
60
- * Any existing W component will be ignored.
61
- */
62
- calculateW(): Quaternion;
63
-
64
- /**
65
- * Calculates the conjugate of a quat If the quaternion is normalized,
66
- * this function is faster than quat.inverse and produces the same result.
67
- */
68
- conjugate(): Quaternion;
69
-
70
- /** Calculates the inverse of this quaternion */
71
- invert(): Quaternion;
72
-
73
- /** Performs a linear interpolation between two quaternions */
74
- lerp(a, b, t): Quaternion;
75
-
76
- /** Multiplies two quaternions */
77
- multiplyRight(a, b): Quaternion;
78
- /** Multiplies two quaternions */
79
- multiplyLeft(a, b): Quaternion;
80
-
81
- /** Normalize a quaternion */
82
- normalize(): Quaternion;
83
-
84
- // MODIFIERS
85
-
86
- /** Rotates a quaternion by the given angle about the X axis */
87
- rotateX(radians: number): Quaternion;
88
- /** Rotates a quaternion by the given angle about the Y axis */
89
- rotateY(radians: number): Quaternion;
90
- /** Rotates a quaternion by the given angle about the Z axis */
91
- rotateZ(radians: number): Quaternion;
92
-
93
- /** Scales a quaternion by a scalar number */
94
- scale(b: number): Quaternion;
95
-
96
- /** Performs a spherical linear interpolation between two quaternions */
97
- slerp(start: readonly number[], target: readonly number[], ratio: number): Quaternion;
98
- slerp(args: {start: readonly number[]; target: readonly number[]; ratio: number}): Quaternion;
99
-
100
- transformVector4(vector, result?);
101
-
102
- // THREE.js Math API compatibility
103
- lengthSq(): Quaternion;
104
- setFromAxisAngle(axis, rad): Quaternion;
105
- premultiply(a, b): Quaternion;
106
- multiply(a, b): Quaternion;
107
- }
@@ -1,87 +0,0 @@
1
- // Copyright (c) 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
-
21
- // Adaptation of THREE.js Spherical class, under MIT license
22
- import Vector3 from './vector3';
23
-
24
- type SphericalCoordinatesOptions = {
25
- phi?: number;
26
- theta?: number;
27
- radius?: number;
28
- bearing?: number;
29
- pitch?: number;
30
- altitude?: number;
31
- radiusScale?: number;
32
- };
33
-
34
- type FormatOptions = {
35
- printTypes?: boolean;
36
- };
37
-
38
- /**
39
- * Ref: https://en.wikipedia.org/wiki/Spherical_coordinate_system
40
- * The poles (phi) are at the positive and negative y axis.
41
- * The equator starts at positive z.
42
- */
43
- export default class SphericalCoordinates {
44
- // Todo [rho, theta, phi] ?
45
-
46
- // Cartographic (bearing 0 north, pitch 0 look from above)
47
- bearing: number;
48
- pitch: number;
49
- altitude: number;
50
-
51
- // lnglatZ coordinates
52
- longitude: number;
53
- latitude: number;
54
- lng: number;
55
- lat: number;
56
- z: number;
57
-
58
- /**
59
- * @param {Object} options
60
- * @param {Number} [options.phi] =0 - rotation around X (latitude)
61
- * @param {Number} [options.theta] =0 - rotation around Y (longitude)
62
- * @param {Number} [options.radius] =1 - Distance from center
63
- * @param {Number} [options.bearing]
64
- * @param {Number} [options.pitch]
65
- * @param {Number} [options.altitude]
66
- * @param {Number} [options.radiusScale] =1
67
- */
68
- constructor(options?: SphericalCoordinatesOptions);
69
-
70
- fromLngLatZ(lngLatZ: number[]): SphericalCoordinates;
71
- fromVector3(v: number[]): SphericalCoordinates;
72
-
73
- clone(): SphericalCoordinates;
74
- copy(other: SphericalCoordinates): SphericalCoordinates;
75
- set(radius: number, phi: number, theta: number): SphericalCoordinates;
76
-
77
- equals(other: SphericalCoordinates): boolean;
78
- exactEquals(other: SphericalCoordinates): boolean;
79
-
80
- toString(): string;
81
- formatString(options?: FormatOptions): string;
82
- toVector3(): Vector3;
83
-
84
- // restrict phi to be betwee EPS and PI-EPS
85
- makeSafe(): SphericalCoordinates;
86
- check(): SphericalCoordinates;
87
- }
@@ -1,65 +0,0 @@
1
- // Copyright (c) 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
-
21
- import Vector from './base/vector';
22
-
23
- /* Two-element vector class */
24
- export default class Vector2 extends Vector<Vector2> {
25
- static ZERO: number[];
26
- get ELEMENTS(): number;
27
-
28
- constructor();
29
- constructor(array: readonly number[]);
30
- constructor(x: number, y: number);
31
-
32
- set(x: number, y: number): Vector2;
33
-
34
- copy(array: readonly number[]): Vector2;
35
-
36
- fromObject(object): Vector2;
37
- // {
38
- // if (config.debug) {
39
- // checkNumber(object.x);
40
- // checkNumber(object.y);
41
- // }
42
- // this[0] = object.x;
43
- // this[1] = object.y;
44
- // return this.check();
45
- // }
46
-
47
- toObject(object: object): object;
48
-
49
- // x,y inherited from Vector
50
-
51
- horizontalAngle(): number;
52
-
53
- verticalAngle(): number;
54
-
55
- // Transforms
56
- transform(matrix4: readonly number[]): Vector2;
57
- // transforms as point (4th component is implicitly 1)
58
- transformAsPoint(matrix4: readonly number[]): Vector2;
59
- // transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
60
- transformAsVector(matrix4: readonly number[]): Vector2;
61
-
62
- transformByMatrix3(matrix3: readonly number[]): Vector2;
63
- transformByMatrix2x3(matrix2x3: readonly number[]): Vector2;
64
- transformByMatrix2(matrix2: readonly number[]): Vector2;
65
- }
@@ -1,65 +0,0 @@
1
- // Copyright (c) 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
-
21
- import Vector from './base/vector';
22
-
23
- /** Three-element vector class */
24
- export default class Vector3 extends Vector<Vector3> {
25
- static readonly ZERO: Vector3;
26
- get ELEMENTS(): number;
27
-
28
- constructor();
29
- constructor(array: readonly number[]);
30
- constructor(x: number, y: number, z: number);
31
-
32
- set(x: number, y: number, z: number);
33
-
34
- copy(array: readonly number[]);
35
-
36
- fromObject(object);
37
- toObject(object);
38
-
39
- // x,y inherited from Vector
40
-
41
- z: number;
42
-
43
- // ACCESSORS
44
- angle(vector: readonly number[]): number;
45
-
46
- // MODIFIERS
47
- cross(vector: readonly number[]): Vector3;
48
-
49
- rotateX(args: {radians: number; origin?: readonly number[]}): Vector3;
50
- rotateY(args: {radians: number; origin?: readonly number[]}): Vector3;
51
- rotateZ(args: {radians: number; origin?: readonly number[]}): Vector3;
52
-
53
- // Transforms
54
-
55
- // transforms as point (4th component is implicitly 1)
56
- transform(matrix4: readonly number[]): Vector3;
57
- // transforms as point (4th component is implicitly 1)
58
- transformAsPoint(matrix4: readonly number[]): Vector3;
59
- // transforms as vector (4th component is implicitly 0, ignores translation. slightly faster)
60
- transformAsVector(matrix4: readonly number[]): Vector3;
61
-
62
- transformByMatrix3(matrix3: readonly number[]): Vector3;
63
- transformByMatrix2(matrix2: readonly number[]): Vector3;
64
- transformByQuaternion(quaternion: readonly number[]): Vector3;
65
- }
@@ -1,34 +0,0 @@
1
- import Vector from './base/vector';
2
-
3
- /** Four-element vector class */
4
- export default class Vector4 extends Vector<Vector4> {
5
- static ZERO: number[];
6
- get ELEMENTS(): number;
7
-
8
- /** construct a new Vector4 initialize to [0, 0, 0, 0] */
9
- constructor();
10
- /** construct a new Vector4 initialize to ...x, y, z, w */
11
- constructor(x: number, y: number, z: number, w: number);
12
- /** construct a new Vector4 initialize to array [x, y, z, w] */
13
- constructor(array: readonly number[]);
14
-
15
- set(x, y, z, w);
16
-
17
- copy(array);
18
-
19
- fromObject(object);
20
-
21
- toObject(object);
22
-
23
- // x,y inherited from Vector
24
- z: number;
25
- w: number;
26
-
27
- transform(matrix4: readonly number[]): Vector4;
28
- transformByMatrix3(matrix3: readonly number[]): Vector4;
29
- transformByMatrix2(matrix2: readonly number[]): Vector4;
30
- transformByQuaternion(quaternion: readonly number[]): Vector4;
31
-
32
- // three.js compatibility
33
- applyMatrix4(m: readonly number[]): Vector4;
34
- }
@@ -1,80 +0,0 @@
1
- type TypedArray =
2
- | Int8Array
3
- | Uint8Array
4
- | Int16Array
5
- | Uint16Array
6
- | Int32Array
7
- | Uint32Array
8
- | Uint8ClampedArray
9
- | Float32Array
10
- | Float64Array;
11
-
12
- type NumberArray = TypedArray | number[];
13
-
14
- type ConfigurationOptions = {
15
- EPSILON?: number;
16
- debug?: boolean;
17
- precision?: number;
18
- printTypes?: boolean;
19
- printDegrees?: boolean;
20
- printRowMajor?: boolean;
21
- _cartographicRadians?: boolean;
22
- };
23
-
24
- export const config: ConfigurationOptions;
25
-
26
- export function configure(options?: ConfigurationOptions): ConfigurationOptions;
27
-
28
- export function formatValue(value: number, options?: ConfigurationOptions): string;
29
-
30
- /**
31
- * Check if value is an "array"
32
- * Returns `true` if value is either an array or a typed array
33
- *
34
- * Note: returns `false` for `ArrayBuffer` and `DataView` instances
35
- */
36
- export function isArray(value: any): boolean;
37
-
38
- export function clone(array: number[]): number[];
39
- export function clone(array: TypedArray): TypedArray;
40
-
41
- export function toRadians(degrees: number): number;
42
- export function toRadians(degrees: number[]): number[];
43
- export function toRadians(degrees: TypedArray): TypedArray;
44
- export function toDegrees(radians: number): number;
45
- export function toDegrees(radians: number[]): number[];
46
- export function toDegrees(radians: TypedArray): TypedArray;
47
-
48
- // GLSL math function equivalents: Work on both single values and vectors
49
-
50
- /* eslint-disable no-shadow */
51
-
52
- export function radians(degrees, result?);
53
- export function degrees(radians, result?);
54
-
55
- /** "GLSL equivalent" of `Math.sin` Works on single values and vectors */
56
- export function sin(radians: number): number;
57
- export function sin(radians: number[]): number[];
58
- // "GLSL equivalent" of Math. : Works on single values and vectors
59
- export function cos(radians);
60
- /** "GLSL equivalent" of `Math.tan`: Works on single values and vectors */
61
- export function tan(radians);
62
-
63
- /** "GLSL equivalent" of `Math.asin`: Works on single values and vectors */
64
- export function asin(radians);
65
- /** "GLSL equivalent" of `Math.acos`: Works on single values and vectors */
66
- export function acos(radians);
67
- /** "GLSL equivalent" of `Math.atan`: Works on single values and vectors */
68
- export function atan(radians);
69
-
70
- /** GLSL style value clamping: Works on single values and vectors */
71
- export function clamp(value, min, max);
72
-
73
- // Interpolate between two numbers or two arrays
74
- export function lerp(a, b, t: number);
75
-
76
- export function equals(a, b, epsilon?: number);
77
-
78
- export function exactEquals(a, b);
79
-
80
- export function withEpsilon(epsilon: number, func: any): any;
@@ -1,17 +0,0 @@
1
- import {NumberArray} from '@math.gl/core/';
2
-
3
- type SegmentVisitor = (p1: NumberArray, p2: NumberArray, i1: number, i2: number) => void;
4
-
5
- export default class Polygon {
6
- constructor(
7
- points: NumberArray | NumberArray[],
8
- options?: {start?: number; end?: number; size?: number; isClosed?: boolean}
9
- );
10
-
11
- // https://en.wikipedia.org/wiki/Shoelace_formula
12
- getSignedArea(): number;
13
- getArea(): number;
14
- getWindingDirection(): number;
15
- forEachSegment(visitor: SegmentVisitor): void;
16
- modifyWindingDirection(direction: number): boolean;
17
- }
package/src/index.d.ts DELETED
@@ -1,54 +0,0 @@
1
- // lib
2
- export * from './lib/common';
3
-
4
- // classes
5
- export {default as Vector2} from './classes/vector2';
6
- export {default as Vector3} from './classes/vector3';
7
- export {default as Vector4} from './classes/vector4';
8
- export {default as Matrix3} from './classes/matrix3';
9
- export {default as Matrix4} from './classes/matrix4';
10
- export {default as Quaternion} from './classes/quaternion';
11
-
12
- // extras
13
-
14
- // export {checkNumber} from './lib/validators';
15
- export function assert(condition: boolean, message?: string): void;
16
-
17
- // experimental
18
- export {default as SphericalCoordinates} from './classes/spherical-coordinates';
19
- export {default as Pose} from './classes/pose';
20
- export {default as Euler} from './classes/euler';
21
-
22
- export const _MathUtils: {
23
- EPSILON1: number;
24
- EPSILON2: number;
25
- EPSILON3: number;
26
- EPSILON4: number;
27
- EPSILON5: number;
28
- EPSILON6: number;
29
- EPSILON7: number;
30
- EPSILON8: number;
31
- EPSILON9: number;
32
- EPSILON10: number;
33
- EPSILON11: number;
34
- EPSILON12: number;
35
- EPSILON13: number;
36
- EPSILON14: number;
37
- EPSILON15: number;
38
- EPSILON16: number;
39
- EPSILON17: number;
40
- EPSILON18: number;
41
- EPSILON19: number;
42
- EPSILON20: number;
43
-
44
- PI_OVER_TWO: number;
45
- PI_OVER_FOUR: number;
46
- PI_OVER_SIX: number;
47
-
48
- TWO_PI: number;
49
- };
50
-
51
- // DEPRECATED
52
- export {default as _SphericalCoordinates} from './classes/spherical-coordinates';
53
- export {default as _Pose} from './classes/pose';
54
- export {default as _Euler} from './classes/euler';
package/src/index.js DELETED
@@ -1,86 +0,0 @@
1
- // Copyright (c) 2017 Uber Technologies, Inc.
2
- //
3
- // Permission is hereby granted, free of charge, to any person obtaining a copy
4
- // of this software and associated documentation files (the "Software"), to deal
5
- // in the Software without restriction, including without limitation the rights
6
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- // copies of the Software, and to permit persons to whom the Software is
8
- // furnished to do so, subject to the following conditions:
9
- //
10
- // The above copyright notice and this permission notice shall be included in
11
- // all copies or substantial portions of the Software.
12
- //
13
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- // THE SOFTWARE.
20
-
21
- import {config} from './lib/common';
22
-
23
- // math.gl classes
24
- export {default as Vector2} from './classes/vector2';
25
- export {default as Vector3} from './classes/vector3';
26
- export {default as Vector4} from './classes/vector4';
27
- export {default as Matrix3} from './classes/matrix3';
28
- export {default as Matrix4} from './classes/matrix4';
29
- export {default as Quaternion} from './classes/quaternion';
30
-
31
- export {
32
- // math.gl global utility methods
33
- config,
34
- configure,
35
- formatValue,
36
- isArray,
37
- clone,
38
- equals,
39
- exactEquals,
40
- toRadians,
41
- toDegrees,
42
- // math.gl "GLSL"-style functions
43
- radians,
44
- degrees,
45
- sin,
46
- cos,
47
- tan,
48
- asin,
49
- acos,
50
- atan,
51
- clamp,
52
- lerp,
53
- withEpsilon
54
- } from './lib/common';
55
-
56
- export {checkNumber} from './lib/validators';
57
-
58
- export {default as _MathUtils} from './lib/math-utils';
59
-
60
- export {default as SphericalCoordinates} from './classes/spherical-coordinates';
61
- export {default as Pose} from './classes/pose';
62
- export {default as Euler} from './classes/euler';
63
-
64
- export {default as assert} from './lib/assert';
65
-
66
- const globals = {
67
- // eslint-disable-next-line no-restricted-globals
68
- self: typeof self !== 'undefined' && self,
69
- window: typeof window !== 'undefined' && window,
70
- global: typeof global !== 'undefined' && global
71
- };
72
-
73
- const global_ = globals.global || globals.self || globals.window;
74
-
75
- // Make config avalable as global variable for access in debugger
76
- // TODO - integrate with probe.gl (as soft dependency) to persist across reloades
77
-
78
- // @ts-ignore error TS2339: Property 'mathgl' does not exist on type 'Window | Global
79
- global_.mathgl = {
80
- config
81
- };
82
-
83
- // DEPRECATED
84
- export {default as _SphericalCoordinates} from './classes/spherical-coordinates';
85
- export {default as _Pose} from './classes/pose';
86
- export {default as _Euler} from './classes/euler';
@@ -1,80 +0,0 @@
1
- type TypedArray =
2
- | Int8Array
3
- | Uint8Array
4
- | Int16Array
5
- | Uint16Array
6
- | Int32Array
7
- | Uint32Array
8
- | Uint8ClampedArray
9
- | Float32Array
10
- | Float64Array;
11
-
12
- type NumberArray = TypedArray | number[];
13
-
14
- type ConfigurationOptions = {
15
- EPSILON?: number;
16
- debug?: boolean;
17
- precision?: number;
18
- printTypes?: boolean;
19
- printDegrees?: boolean;
20
- printRowMajor?: boolean;
21
- _cartographicRadians?: boolean;
22
- };
23
-
24
- export const config: ConfigurationOptions;
25
-
26
- export function configure(options?: ConfigurationOptions): ConfigurationOptions;
27
-
28
- export function formatValue(value: number, options?: ConfigurationOptions): string;
29
-
30
- /**
31
- * Check if value is an "array"
32
- * Returns `true` if value is either an array or a typed array
33
- *
34
- * Note: returns `false` for `ArrayBuffer` and `DataView` instances
35
- */
36
- export function isArray(value: any): boolean;
37
-
38
- export function clone(array: number[]): number[];
39
- export function clone(array: TypedArray): TypedArray;
40
-
41
- export function toRadians(degrees: number): number;
42
- export function toRadians(degrees: number[]): number[];
43
- export function toRadians(degrees: TypedArray): TypedArray;
44
- export function toDegrees(radians: number): number;
45
- export function toDegrees(radians: number[]): number[];
46
- export function toDegrees(radians: TypedArray): TypedArray;
47
-
48
- // GLSL math function equivalents: Work on both single values and vectors
49
-
50
- /* eslint-disable no-shadow */
51
-
52
- export function radians(degrees, result?);
53
- export function degrees(radians, result?);
54
-
55
- /** "GLSL equivalent" of `Math.sin` Works on single values and vectors */
56
- export function sin(radians: number): number;
57
- export function sin(radians: number[]): number[];
58
- // "GLSL equivalent" of Math. : Works on single values and vectors
59
- export function cos(radians);
60
- /** "GLSL equivalent" of `Math.tan`: Works on single values and vectors */
61
- export function tan(radians);
62
-
63
- /** "GLSL equivalent" of `Math.asin`: Works on single values and vectors */
64
- export function asin(radians);
65
- /** "GLSL equivalent" of `Math.acos`: Works on single values and vectors */
66
- export function acos(radians);
67
- /** "GLSL equivalent" of `Math.atan`: Works on single values and vectors */
68
- export function atan(radians);
69
-
70
- /** GLSL style value clamping: Works on single values and vectors */
71
- export function clamp(value, min, max);
72
-
73
- // Interpolate between two numbers or two arrays
74
- export function lerp(a, b, t: number);
75
-
76
- export function equals(a, b, epsilon?: number);
77
-
78
- export function exactEquals(a, b);
79
-
80
- export function withEpsilon(epsilon: number, func: any): any;