@math.gl/core 3.5.7 → 3.6.0-alpha.3
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 +66 -0
- package/dist/classes/base/math-array.d.ts.map +1 -0
- package/dist/classes/base/math-array.js +216 -0
- package/dist/classes/base/matrix.d.ts +14 -0
- package/dist/classes/base/matrix.d.ts.map +1 -0
- package/dist/classes/base/matrix.js +61 -0
- package/dist/classes/base/vector.d.ts +44 -0
- package/dist/classes/base/vector.d.ts.map +1 -0
- package/dist/classes/base/vector.js +126 -0
- package/dist/classes/euler.d.ts +77 -0
- package/dist/classes/euler.d.ts.map +1 -0
- package/dist/classes/euler.js +485 -0
- package/dist/classes/matrix3.d.ts +60 -0
- package/dist/classes/matrix3.d.ts.map +1 -0
- package/dist/classes/matrix3.js +201 -0
- package/dist/classes/matrix4.d.ts +226 -0
- package/dist/classes/matrix4.d.ts.map +1 -0
- package/dist/classes/matrix4.js +538 -0
- package/dist/classes/pose.d.ts +40 -0
- package/dist/classes/pose.d.ts.map +1 -0
- package/dist/classes/pose.js +109 -0
- package/dist/classes/quaternion.d.ts +63 -0
- package/dist/classes/quaternion.d.ts.map +1 -0
- package/dist/classes/quaternion.js +262 -0
- package/dist/classes/spherical-coordinates.d.ts +60 -0
- package/dist/classes/spherical-coordinates.d.ts.map +1 -0
- package/dist/classes/spherical-coordinates.js +148 -0
- package/dist/classes/vector2.d.ts +55 -0
- package/dist/classes/vector2.d.ts.map +1 -0
- package/dist/classes/vector2.js +111 -0
- package/dist/classes/vector3.d.ts +56 -0
- package/dist/classes/vector3.d.ts.map +1 -0
- package/dist/classes/vector3.js +133 -0
- package/dist/classes/vector4.d.ts +41 -0
- package/dist/classes/vector4.d.ts.map +1 -0
- package/dist/classes/vector4.js +114 -0
- package/dist/es5/classes/base/math-array.js +57 -61
- package/dist/es5/classes/base/math-array.js.map +1 -1
- package/dist/es5/classes/base/matrix.js +0 -14
- package/dist/es5/classes/base/matrix.js.map +1 -1
- package/dist/es5/classes/base/vector.js +0 -12
- package/dist/es5/classes/base/vector.js.map +1 -1
- package/dist/es5/classes/euler.js +63 -49
- package/dist/es5/classes/euler.js.map +1 -1
- package/dist/es5/classes/matrix3.js +60 -33
- package/dist/es5/classes/matrix3.js.map +1 -1
- package/dist/es5/classes/matrix4.js +167 -164
- package/dist/es5/classes/matrix4.js.map +1 -1
- package/dist/es5/classes/pose.js +7 -6
- package/dist/es5/classes/pose.js.map +1 -1
- package/dist/es5/classes/quaternion.js +44 -36
- package/dist/es5/classes/quaternion.js.map +1 -1
- package/dist/es5/classes/spherical-coordinates.js +12 -8
- package/dist/es5/classes/spherical-coordinates.js.map +1 -1
- package/dist/es5/classes/vector2.js.map +1 -1
- package/dist/es5/classes/vector3.js +7 -2
- package/dist/es5/classes/vector3.js.map +1 -1
- package/dist/es5/classes/vector4.js +7 -2
- package/dist/es5/classes/vector4.js.map +1 -1
- package/dist/es5/docs/README.md +0 -0
- package/dist/es5/index.js +71 -89
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/assert.js.map +1 -1
- package/dist/es5/lib/common.js +40 -43
- package/dist/es5/lib/common.js.map +1 -1
- package/dist/es5/lib/gl-matrix-extras.js.map +1 -1
- package/dist/es5/lib/gl-matrix.d.js +2 -0
- package/dist/es5/lib/gl-matrix.d.js.map +1 -0
- package/dist/es5/lib/math-utils.js.map +1 -1
- package/dist/es5/lib/validators.js.map +1 -1
- package/dist/esm/classes/base/math-array.js +45 -47
- package/dist/esm/classes/base/math-array.js.map +1 -1
- package/dist/esm/classes/base/matrix.js +0 -11
- package/dist/esm/classes/base/matrix.js.map +1 -1
- package/dist/esm/classes/base/vector.js +0 -10
- package/dist/esm/classes/base/vector.js.map +1 -1
- package/dist/esm/classes/euler.js +61 -48
- package/dist/esm/classes/euler.js.map +1 -1
- package/dist/esm/classes/matrix3.js +55 -33
- package/dist/esm/classes/matrix3.js.map +1 -1
- package/dist/esm/classes/matrix4.js +156 -136
- package/dist/esm/classes/matrix4.js.map +1 -1
- package/dist/esm/classes/pose.js +8 -4
- package/dist/esm/classes/pose.js.map +1 -1
- package/dist/esm/classes/quaternion.js +37 -27
- package/dist/esm/classes/quaternion.js.map +1 -1
- package/dist/esm/classes/spherical-coordinates.js +15 -5
- package/dist/esm/classes/spherical-coordinates.js.map +1 -1
- package/dist/esm/classes/vector2.js.map +1 -1
- package/dist/esm/classes/vector3.js +7 -2
- package/dist/esm/classes/vector3.js.map +1 -1
- package/dist/esm/classes/vector4.js +7 -2
- package/dist/esm/classes/vector4.js.map +1 -1
- package/dist/esm/docs/README.md +0 -0
- package/dist/esm/index.js +2 -13
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/assert.js.map +1 -1
- package/dist/esm/lib/common.js +41 -44
- package/dist/esm/lib/common.js.map +1 -1
- package/dist/esm/lib/gl-matrix-extras.js.map +1 -1
- package/dist/esm/lib/gl-matrix.d.js +2 -0
- package/dist/esm/lib/gl-matrix.d.js.map +1 -0
- package/dist/esm/lib/math-utils.js.map +1 -1
- package/dist/esm/lib/validators.js.map +1 -1
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/lib/assert.d.ts +2 -0
- package/dist/lib/assert.d.ts.map +1 -0
- package/dist/lib/assert.js +5 -0
- package/dist/lib/common.d.ts +93 -0
- package/dist/lib/common.d.ts.map +1 -0
- package/dist/lib/common.js +210 -0
- package/dist/lib/gl-matrix-extras.d.ts +7 -0
- package/dist/lib/gl-matrix-extras.d.ts.map +1 -0
- package/dist/lib/gl-matrix-extras.js +49 -0
- package/dist/lib/math-utils.d.ts +28 -0
- package/dist/lib/math-utils.d.ts.map +1 -0
- package/dist/lib/math-utils.js +28 -0
- package/dist/lib/validators.d.ts +6 -0
- package/dist/lib/validators.d.ts.map +1 -0
- package/dist/lib/validators.js +33 -0
- package/package.json +5 -4
- package/src/classes/base/math-array.ts +265 -0
- package/src/classes/base/{matrix.js → matrix.ts} +15 -19
- package/src/classes/base/{vector.js → vector.ts} +47 -54
- package/src/classes/{euler.js → euler.ts} +121 -221
- package/src/classes/matrix3.ts +253 -0
- package/src/classes/matrix4.ts +668 -0
- package/src/classes/{pose.js → pose.ts} +52 -49
- package/src/classes/{quaternion.js → quaternion.ts} +107 -95
- package/src/classes/{spherical-coordinates.js → spherical-coordinates.ts} +84 -54
- package/src/classes/vector2.ts +127 -0
- package/src/classes/{vector3.js → vector3.ts} +43 -55
- package/src/classes/{vector4.js → vector4.ts} +44 -48
- package/src/docs/README.md +0 -0
- package/{dist/esm/index.d.ts → src/index.ts} +32 -34
- package/src/lib/{assert.js → assert.ts} +1 -1
- package/src/lib/common.ts +304 -0
- package/src/lib/{gl-matrix-extras.js → gl-matrix-extras.ts} +26 -5
- package/src/lib/gl-matrix.d.ts +266 -0
- package/src/lib/{math-utils.js → math-utils.ts} +0 -0
- package/src/lib/{validators.js → validators.ts} +10 -6
- package/dist/es5/addons/polygon.d.ts +0 -17
- package/dist/es5/classes/base/math-array.d.ts +0 -56
- package/dist/es5/classes/base/matrix.d.ts +0 -15
- package/dist/es5/classes/base/vector.d.ts +0 -45
- package/dist/es5/classes/euler.d.ts +0 -92
- package/dist/es5/classes/matrix3.d.ts +0 -91
- package/dist/es5/classes/matrix4.d.ts +0 -161
- package/dist/es5/classes/pose.d.ts +0 -92
- package/dist/es5/classes/quaternion.d.ts +0 -107
- package/dist/es5/classes/spherical-coordinates.d.ts +0 -87
- package/dist/es5/classes/vector2.d.ts +0 -65
- package/dist/es5/classes/vector3.d.ts +0 -65
- package/dist/es5/classes/vector4.d.ts +0 -34
- package/dist/es5/index.d.ts +0 -54
- package/dist/es5/lib/common.d.ts +0 -80
- package/dist/esm/addons/polygon.d.ts +0 -17
- package/dist/esm/classes/base/math-array.d.ts +0 -56
- package/dist/esm/classes/base/matrix.d.ts +0 -15
- package/dist/esm/classes/base/vector.d.ts +0 -45
- package/dist/esm/classes/euler.d.ts +0 -92
- package/dist/esm/classes/matrix3.d.ts +0 -91
- package/dist/esm/classes/matrix4.d.ts +0 -161
- package/dist/esm/classes/pose.d.ts +0 -92
- package/dist/esm/classes/quaternion.d.ts +0 -107
- package/dist/esm/classes/spherical-coordinates.d.ts +0 -87
- package/dist/esm/classes/vector2.d.ts +0 -65
- package/dist/esm/classes/vector3.d.ts +0 -65
- package/dist/esm/classes/vector4.d.ts +0 -34
- package/dist/esm/lib/common.d.ts +0 -80
- package/src/addons/polygon.d.ts +0 -17
- package/src/classes/base/math-array.d.ts +0 -56
- package/src/classes/base/math-array.js +0 -250
- package/src/classes/base/matrix.d.ts +0 -15
- package/src/classes/base/vector.d.ts +0 -45
- package/src/classes/euler.d.ts +0 -92
- package/src/classes/matrix3.d.ts +0 -91
- package/src/classes/matrix3.js +0 -225
- package/src/classes/matrix4.d.ts +0 -161
- package/src/classes/matrix4.js +0 -530
- package/src/classes/pose.d.ts +0 -92
- package/src/classes/quaternion.d.ts +0 -107
- package/src/classes/spherical-coordinates.d.ts +0 -87
- package/src/classes/vector2.d.ts +0 -65
- package/src/classes/vector2.js +0 -122
- package/src/classes/vector3.d.ts +0 -65
- package/src/classes/vector4.d.ts +0 -34
- package/src/index.d.ts +0 -54
- package/src/index.js +0 -86
- package/src/lib/common.d.ts +0 -80
- 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
|
-
}
|
package/dist/esm/lib/common.d.ts
DELETED
|
@@ -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;
|
package/src/addons/polygon.d.ts
DELETED
|
@@ -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
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
/** Base class for vectors and matrices */
|
|
3
|
-
export default abstract class MathArray<DerivedType> extends Array<number> {
|
|
4
|
-
// Defined by derived class
|
|
5
|
-
abstract get ELEMENTS(): number;
|
|
6
|
-
|
|
7
|
-
clone(): DerivedType;
|
|
8
|
-
|
|
9
|
-
// TODO - define more sophisticated object type per class?
|
|
10
|
-
from(array: readonly number[]): DerivedType;
|
|
11
|
-
from(object: object): DerivedType;
|
|
12
|
-
|
|
13
|
-
fromArray(array: readonly number[], offset?: number): DerivedType;
|
|
14
|
-
// todo
|
|
15
|
-
to(arrayOrObject): any;
|
|
16
|
-
toTarget(target): any;
|
|
17
|
-
|
|
18
|
-
toArray(array?: number[], offset?: number): number[];
|
|
19
|
-
toFloat32Array(): Float32Array;
|
|
20
|
-
toString(): string;
|
|
21
|
-
formatString(opts: object): string;
|
|
22
|
-
equals(array: readonly number[]): boolean;
|
|
23
|
-
exactEquals(array: readonly number[]): boolean;
|
|
24
|
-
|
|
25
|
-
// Modifiers
|
|
26
|
-
|
|
27
|
-
negate(): DerivedType;
|
|
28
|
-
lerp(a: readonly number[], b: readonly number[], t: number): DerivedType;
|
|
29
|
-
|
|
30
|
-
min(vector: readonly number[]): DerivedType;
|
|
31
|
-
max(vector: readonly number[]): DerivedType;
|
|
32
|
-
|
|
33
|
-
clamp(minVector: readonly number[], maxVector: readonly number[]): DerivedType;
|
|
34
|
-
|
|
35
|
-
add(...vectors): DerivedType;
|
|
36
|
-
subtract(...vectors): DerivedType;
|
|
37
|
-
|
|
38
|
-
scale(scale): DerivedType;
|
|
39
|
-
|
|
40
|
-
// three.js compatibility
|
|
41
|
-
|
|
42
|
-
sub(a): DerivedType;
|
|
43
|
-
setScalar(a): DerivedType;
|
|
44
|
-
addScalar(a): DerivedType;
|
|
45
|
-
subScalar(a): DerivedType;
|
|
46
|
-
multiplyScalar(scalar): DerivedType;
|
|
47
|
-
divideScalar(a): DerivedType;
|
|
48
|
-
clampScalar(min, max): DerivedType;
|
|
49
|
-
elements: number[];
|
|
50
|
-
|
|
51
|
-
// Cesium compatibility
|
|
52
|
-
multiplyByScalar(scalar): DerivedType;
|
|
53
|
-
|
|
54
|
-
// private
|
|
55
|
-
check(): DerivedType;
|
|
56
|
-
}
|