@pirireis/webglobeplugins 0.9.15 → 0.10.1-alpha

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/Math/plane.js CHANGED
@@ -1,57 +1,56 @@
1
1
  import { EPSILON } from "./constants";
2
- import { vec3 } from "./vec3";
3
- const _0vector = /*@__PURE__*/ vec3.create(0, 0, 0);
4
- const _1vector = /*@__PURE__*/ vec3.create(1, 1, 1);
5
- export const plane = Object.freeze({
6
- create(normal = vec3.create(), distance = 0) {
7
- return {
8
- normal: vec3.clone(normal),
9
- distance: distance
10
- };
11
- },
12
- set(out, normal, distance) {
13
- vec3.copy(out.normal, normal);
14
- out.distance = distance;
15
- return out;
16
- },
17
- fromValues(out, nx, ny, nz, distance) {
18
- vec3.set(out.normal, nx, ny, nz);
19
- out.distance = distance;
20
- },
21
- copy(out, a) {
22
- vec3.copy(out.normal, a.normal);
23
- out.distance = a.distance;
24
- return out;
25
- },
26
- clone(a) {
27
- return {
28
- normal: vec3.clone(a.normal),
29
- distance: a.distance
30
- };
31
- },
32
- distanceToPoint(plane, point) {
33
- return vec3.dot(plane.normal, point) - plane.distance;
34
- },
35
- projectPoint(out, plane, point) {
36
- const distance = this.distanceToPoint(plane, point);
37
- vec3.multiplyScalar(out, plane.normal, distance);
38
- vec3.subtract(out, point, out);
39
- },
40
- equals(plane, other) {
41
- return vec3.equals(plane.normal, other.normal) && Math.abs(plane.distance - other.distance) < EPSILON;
42
- },
43
- fromNormalAndCoplanarPoint(out, normal, point) {
44
- vec3.copy(out.normal, normal);
45
- out.distance = vec3.dot(point, normal);
46
- },
47
- fromPoints(out, a, b, c) {
48
- vec3.subtract(_0vector, b, a);
49
- vec3.subtract(_1vector, c, a);
50
- vec3.cross(out.normal, _0vector, _1vector);
51
- vec3.normalize(out.normal, out.normal);
52
- out.distance = vec3.dot(out.normal, a);
53
- },
54
- getUnitSphereRadiusAngle(plane) {
55
- return Math.acos(Math.max(Math.min(plane.distance, 1), -1));
56
- }
57
- });
2
+ import { copy as vec3copy, create as vec3create, clone as vec3clone, set as vec3set, dot, subtract, multiplyScalar, cross, normalize, equals as vec3equals } from "./vec3";
3
+ const _0vector = /*@__PURE__*/ vec3create(0, 0, 0);
4
+ const _1vector = /*@__PURE__*/ vec3create(1, 1, 1);
5
+ function create(normal = vec3create(), distance = 0) {
6
+ return {
7
+ normal: vec3clone(normal),
8
+ distance: distance
9
+ };
10
+ }
11
+ function set(out, normal, distance) {
12
+ vec3copy(out.normal, normal);
13
+ out.distance = distance;
14
+ return out;
15
+ }
16
+ function fromValues(out, nx, ny, nz, distance) {
17
+ vec3set(out.normal, nx, ny, nz);
18
+ out.distance = distance;
19
+ }
20
+ function copy(out, a) {
21
+ vec3copy(out.normal, a.normal);
22
+ out.distance = a.distance;
23
+ return out;
24
+ }
25
+ function clone(a) {
26
+ return {
27
+ normal: vec3clone(a.normal),
28
+ distance: a.distance
29
+ };
30
+ }
31
+ function distanceToPoint(plane, point) {
32
+ return dot(plane.normal, point) - plane.distance;
33
+ }
34
+ function projectPoint(out, plane, point) {
35
+ const distance = distanceToPoint(plane, point);
36
+ multiplyScalar(out, plane.normal, distance);
37
+ subtract(out, point, out);
38
+ }
39
+ function equals(plane, other) {
40
+ return vec3equals(plane.normal, other.normal) && Math.abs(plane.distance - other.distance) < EPSILON;
41
+ }
42
+ function fromNormalAndCoplanarPoint(out, normal, point) {
43
+ vec3copy(out.normal, normal);
44
+ out.distance = dot(point, normal);
45
+ }
46
+ function fromPoints(out, a, b, c) {
47
+ subtract(_0vector, b, a);
48
+ subtract(_1vector, c, a);
49
+ cross(out.normal, _0vector, _1vector);
50
+ normalize(out.normal, out.normal);
51
+ out.distance = dot(out.normal, a);
52
+ }
53
+ function getUnitSphereRadiusAngle(plane) {
54
+ return Math.acos(Math.max(Math.min(plane.distance, 1), -1));
55
+ }
56
+ export { create, set, fromValues, copy, clone, distanceToPoint, projectPoint, equals, fromNormalAndCoplanarPoint, fromPoints, getUnitSphereRadiusAngle };
@@ -1,101 +1,106 @@
1
- import { vec3 } from './vec3';
1
+ import { dot } from './vec3';
2
2
  import { EPSILON } from './constants';
3
- export const quaternion = Object.freeze({
4
- create(x = 0, y = 0, z = 0, w = 1) {
5
- return [x, y, z, w];
6
- },
7
- set(out, x, y, z, w) {
8
- out[0] = x;
9
- out[1] = y;
10
- out[2] = z;
11
- out[3] = w;
12
- },
13
- copy(out, a) {
14
- out[0] = a[0];
15
- out[1] = a[1];
16
- out[2] = a[2];
17
- out[3] = a[3];
18
- },
19
- clone(a) {
20
- return [a[0], a[1], a[2], a[3]];
21
- },
22
- multiply(out, a, b) {
23
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
24
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
25
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
26
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
27
- this.set(out, x, y, z, w);
28
- return out;
29
- },
30
- randomUnit(out) {
31
- const u1 = Math.random();
32
- const u2 = Math.random();
33
- const u3 = Math.random();
34
- const sqrt1MinusU1 = Math.sqrt(1 - u1);
35
- const sqrtU1 = Math.sqrt(u1);
36
- const x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
37
- const y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
38
- const z = sqrtU1 * Math.sin(2 * Math.PI * u3);
39
- const w = sqrtU1 * Math.cos(2 * Math.PI * u3);
40
- this.set(out, x, y, z, w);
41
- this.normalize(out, out);
42
- return out;
43
- },
44
- rotateQuaternion(out, a, b) {
45
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
46
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
47
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
48
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
49
- this.set(out, x, y, z, w);
50
- this.normalize(out, out);
51
- },
52
- lengthSquared(a) {
53
- return a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
54
- },
55
- length(a) {
56
- return Math.sqrt(this.lengthSquared(a));
57
- },
58
- normalize(out, input) {
59
- const len = Math.sqrt(this.lengthSquared(input));
60
- if (len < EPSILON) {
61
- this.set(out, 0, 0, 0, 1);
3
+ function create(x = 0, y = 0, z = 0, w = 1) {
4
+ return [x, y, z, w];
5
+ }
6
+ function set(out, x, y, z, w) {
7
+ out[0] = x;
8
+ out[1] = y;
9
+ out[2] = z;
10
+ out[3] = w;
11
+ }
12
+ function copy(out, a) {
13
+ out[0] = a[0];
14
+ out[1] = a[1];
15
+ out[2] = a[2];
16
+ out[3] = a[3];
17
+ }
18
+ function clone(a) {
19
+ return [a[0], a[1], a[2], a[3]];
20
+ }
21
+ function lengthSquared(a) {
22
+ return a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
23
+ }
24
+ function length(a) {
25
+ return Math.sqrt(lengthSquared(a));
26
+ }
27
+ function normalize(out, input) {
28
+ const len = Math.sqrt(lengthSquared(input));
29
+ if (len < EPSILON) {
30
+ set(out, 0, 0, 0, 1);
31
+ }
32
+ else {
33
+ const invLen = 1 / len;
34
+ set(out, input[0] * invLen, input[1] * invLen, input[2] * invLen, input[3] * invLen);
35
+ }
36
+ }
37
+ function multiply(out, a, b) {
38
+ const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
39
+ const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
40
+ const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
41
+ const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
42
+ set(out, x, y, z, w);
43
+ return out;
44
+ }
45
+ function randomUnit(out) {
46
+ const u1 = Math.random();
47
+ const u2 = Math.random();
48
+ const u3 = Math.random();
49
+ const sqrt1MinusU1 = Math.sqrt(1 - u1);
50
+ const sqrtU1 = Math.sqrt(u1);
51
+ const x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
52
+ const y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
53
+ const z = sqrtU1 * Math.sin(2 * Math.PI * u3);
54
+ const w = sqrtU1 * Math.cos(2 * Math.PI * u3);
55
+ set(out, x, y, z, w);
56
+ normalize(out, out);
57
+ return out;
58
+ }
59
+ function rotateQuaternion(out, a, b) {
60
+ const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
61
+ const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
62
+ const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
63
+ const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
64
+ set(out, x, y, z, w);
65
+ normalize(out, out);
66
+ }
67
+ function fromUnitVectors(out, from, to) {
68
+ const d = dot(from, to) + 1;
69
+ if (d < EPSILON) {
70
+ if (Math.abs(from[0]) > Math.abs(from[2])) {
71
+ set(out, -from[1], from[0], 0, 0);
62
72
  }
63
73
  else {
64
- const invLen = 1 / len;
65
- this.set(out, input[0] * invLen, input[1] * invLen, input[2] * invLen, input[3] * invLen);
74
+ set(out, 0, -from[2], from[1], 0);
66
75
  }
67
- },
68
- fromUnitVectors(out, from, to) {
69
- const d = vec3.dot(from, to) + 1;
70
- if (d < EPSILON) {
71
- if (Math.abs(from[0]) > Math.abs(from[2])) {
72
- this.set(out, -from[1], from[0], 0, 0);
73
- }
74
- else {
75
- this.set(out, 0, -from[2], from[1], 0);
76
- }
77
- }
78
- else {
79
- const x = from[1] * to[2] - from[2] * to[1];
80
- const y = from[2] * to[0] - from[0] * to[2];
81
- const z = from[0] * to[1] - from[1] * to[0];
82
- this.set(out, x, y, z, d);
83
- }
84
- },
85
- fromTwoQuaternions(out, from, to) {
86
- const x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
87
- const y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
88
- const z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
89
- const w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
90
- this.set(out, x, y, z, w);
91
- this.normalize(out, out);
92
- },
93
- conjugate(out, a) {
94
- this.set(out, -a[0], -a[1], -a[2], a[3]);
95
- },
96
- fromAxisAngle(out, axis, angle) {
97
- const halfAngle = angle / 2;
98
- const s = Math.sin(halfAngle);
99
- this.set(out, axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(halfAngle));
100
- },
101
- });
76
+ }
77
+ else {
78
+ const x = from[1] * to[2] - from[2] * to[1];
79
+ const y = from[2] * to[0] - from[0] * to[2];
80
+ const z = from[0] * to[1] - from[1] * to[0];
81
+ set(out, x, y, z, d);
82
+ }
83
+ }
84
+ function fromTwoQuaternions(out, from, to) {
85
+ const x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
86
+ const y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
87
+ const z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
88
+ const w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
89
+ set(out, x, y, z, w);
90
+ normalize(out, out);
91
+ }
92
+ function conjugate(out, a) {
93
+ set(out, -a[0], -a[1], -a[2], a[3]);
94
+ }
95
+ function fromAxisAngle(out, axis, angle) {
96
+ const halfAngle = angle / 2;
97
+ const s = Math.sin(halfAngle);
98
+ set(out, axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(halfAngle));
99
+ }
100
+ function reverse(out, a) {
101
+ out[0] = -a[0];
102
+ out[1] = -a[1];
103
+ out[2] = -a[2];
104
+ out[3] = a[3];
105
+ }
106
+ export { create, set, copy, clone, length, lengthSquared, normalize, multiply, randomUnit, rotateQuaternion, fromUnitVectors, fromTwoQuaternions, conjugate, fromAxisAngle, reverse };
package/Math/vec3.js CHANGED
@@ -1,123 +1,122 @@
1
1
  import { EPSILON } from './constants';
2
- export const vec3 = Object.freeze({
3
- create(x = 0, y = 0, z = 1) {
4
- return [x, y, z];
5
- },
6
- set(out, x, y, z) {
7
- out[0] = x;
8
- out[1] = y;
9
- out[2] = z;
10
- },
11
- clone(a) {
12
- return [a[0], a[1], a[2]];
13
- },
14
- copy(out, a) {
15
- out[0] = a[0];
16
- out[1] = a[1];
17
- out[2] = a[2];
18
- return out;
19
- },
20
- add(out, a, b) {
21
- out[0] = a[0] + b[0];
22
- out[1] = a[1] + b[1];
23
- out[2] = a[2] + b[2];
24
- return out;
25
- },
26
- subtract(out, a, b) {
27
- out[0] = a[0] - b[0];
28
- out[1] = a[1] - b[1];
29
- out[2] = a[2] - b[2];
30
- },
31
- dot(a, b) {
32
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
33
- },
34
- cross(out, a, b) {
35
- const x = a[1] * b[2] - a[2] * b[1];
36
- const y = a[2] * b[0] - a[0] * b[2];
37
- const z = a[0] * b[1] - a[1] * b[0];
38
- out[0] = x;
39
- out[1] = y;
40
- out[2] = z;
41
- },
42
- multiplyScalar(out, a, b) {
43
- out[0] = a[0] * b;
44
- out[1] = a[1] * b;
45
- out[2] = a[2] * b;
46
- },
47
- divideScalar(out, a, b) {
48
- if (b === 0) {
49
- throw new Error('Division by zero');
50
- }
51
- out[0] = a[0] / b;
52
- out[1] = a[1] / b;
53
- out[2] = a[2] / b;
54
- },
55
- lengthSquared(a) {
56
- return a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
57
- },
58
- length(a) {
59
- return Math.sqrt(this.lengthSquared(a));
60
- },
61
- normalize(outVec, inVec) {
62
- const len = this.length(inVec);
63
- if (len === 0) {
64
- throw new Error('Cannot normalize a zero vector');
65
- }
66
- outVec[0] = inVec[0] / len;
67
- outVec[1] = inVec[1] / len;
68
- outVec[2] = inVec[2] / len;
69
- },
70
- distanceSquared(a, b) {
71
- const dx = a[0] - b[0];
72
- const dy = a[1] - b[1];
73
- const dz = a[2] - b[2];
74
- return dx * dx + dy * dy + dz * dz;
75
- },
76
- distance(a, b) {
77
- return Math.sqrt(this.distanceSquared(a, b));
78
- },
79
- equals(a, b) {
80
- return (Math.abs(a[0] - b[0]) < EPSILON &&
81
- Math.abs(a[1] - b[1]) < EPSILON &&
82
- Math.abs(a[2] - b[2]) < EPSILON);
83
- },
84
- toUnitVectorLongLat(out, a) {
85
- const len = this.length(a); // TODO Might drop length check
86
- if (len === 0) {
87
- throw new Error('Cannot convert a zero vector to unit vector');
88
- }
89
- out[0] = Math.atan2(a[1], a[0]); // Longitude
90
- out[1] = Math.asin(a[2] / len); // Latitude
91
- },
92
- fromUnitVectorLongLat(out, longLat) {
93
- const longitude = longLat[0];
94
- const latitude = longLat[1];
95
- const cosLat = Math.cos(latitude);
96
- out[0] = cosLat * Math.cos(longitude);
97
- out[1] = cosLat * Math.sin(longitude);
98
- out[2] = Math.sin(latitude);
99
- },
100
- applyQuaternion(out, a, q) {
101
- const x = a[0], y = a[1], z = a[2];
102
- const qx = q[0], qy = q[1], qz = q[2], qw = q[3];
103
- // Calculate the quaternion multiplication
104
- const ix = qw * x + qy * z - qz * y;
105
- const iy = qw * y + qz * x - qx * z;
106
- const iz = qw * z + qx * y - qy * x;
107
- const iw = -qx * x - qy * y - qz * z;
108
- // Apply the quaternion to the vector
109
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
110
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
111
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
112
- },
113
- randomUnit(out) {
114
- const theta = Math.random() * 2 * Math.PI;
115
- const phi = Math.acos(2 * Math.random() - 1);
116
- out[0] = Math.sin(phi) * Math.cos(theta);
117
- out[1] = Math.sin(phi) * Math.sin(theta);
118
- out[2] = Math.cos(phi);
119
- },
120
- str(a) {
121
- return `Vec3(${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)})`;
2
+ function create(x = 0, y = 0, z = 1) {
3
+ return [x, y, z];
4
+ }
5
+ function set(out, x, y, z) {
6
+ out[0] = x;
7
+ out[1] = y;
8
+ out[2] = z;
9
+ }
10
+ function clone(a) {
11
+ return [a[0], a[1], a[2]];
12
+ }
13
+ function copy(out, a) {
14
+ out[0] = a[0];
15
+ out[1] = a[1];
16
+ out[2] = a[2];
17
+ return out;
18
+ }
19
+ function add(out, a, b) {
20
+ out[0] = a[0] + b[0];
21
+ out[1] = a[1] + b[1];
22
+ out[2] = a[2] + b[2];
23
+ return out;
24
+ }
25
+ function subtract(out, a, b) {
26
+ out[0] = a[0] - b[0];
27
+ out[1] = a[1] - b[1];
28
+ out[2] = a[2] - b[2];
29
+ }
30
+ function dot(a, b) {
31
+ return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
32
+ }
33
+ function cross(out, a, b) {
34
+ const x = a[1] * b[2] - a[2] * b[1];
35
+ const y = a[2] * b[0] - a[0] * b[2];
36
+ const z = a[0] * b[1] - a[1] * b[0];
37
+ out[0] = x;
38
+ out[1] = y;
39
+ out[2] = z;
40
+ }
41
+ function multiplyScalar(out, a, b) {
42
+ out[0] = a[0] * b;
43
+ out[1] = a[1] * b;
44
+ out[2] = a[2] * b;
45
+ }
46
+ function divideScalar(out, a, b) {
47
+ if (b === 0) {
48
+ throw new Error('Division by zero');
122
49
  }
123
- });
50
+ out[0] = a[0] / b;
51
+ out[1] = a[1] / b;
52
+ out[2] = a[2] / b;
53
+ }
54
+ function lengthSquared(a) {
55
+ return a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
56
+ }
57
+ function length(a) {
58
+ return Math.sqrt(lengthSquared(a));
59
+ }
60
+ function normalize(outVec, inVec) {
61
+ const len = length(inVec);
62
+ if (len === 0) {
63
+ throw new Error('Cannot normalize a zero vector');
64
+ }
65
+ outVec[0] = inVec[0] / len;
66
+ outVec[1] = inVec[1] / len;
67
+ outVec[2] = inVec[2] / len;
68
+ }
69
+ function distanceSquared(a, b) {
70
+ const dx = a[0] - b[0];
71
+ const dy = a[1] - b[1];
72
+ const dz = a[2] - b[2];
73
+ return dx * dx + dy * dy + dz * dz;
74
+ }
75
+ function distance(a, b) {
76
+ return Math.sqrt(distanceSquared(a, b));
77
+ }
78
+ function equals(a, b) {
79
+ return (Math.abs(a[0] - b[0]) < EPSILON &&
80
+ Math.abs(a[1] - b[1]) < EPSILON &&
81
+ Math.abs(a[2] - b[2]) < EPSILON);
82
+ }
83
+ function toUnitVectorLongLat(out, a) {
84
+ const len = length(a); // TODO Might drop length check
85
+ if (len === 0) {
86
+ throw new Error('Cannot convert a zero vector to unit vector');
87
+ }
88
+ out[0] = Math.atan2(a[1], a[0]); // Longitude
89
+ out[1] = Math.asin(a[2] / len); // Latitude
90
+ }
91
+ function fromUnitVectorLongLat(out, longLat) {
92
+ const longitude = longLat[0];
93
+ const latitude = longLat[1];
94
+ const cosLat = Math.cos(latitude);
95
+ out[0] = cosLat * Math.cos(longitude);
96
+ out[1] = cosLat * Math.sin(longitude);
97
+ out[2] = Math.sin(latitude);
98
+ }
99
+ function applyQuaternion(out, a, q) {
100
+ const x = a[0], y = a[1], z = a[2];
101
+ const qx = q[0], qy = q[1], qz = q[2], qw = q[3];
102
+ // Calculate the quaternion multiplication
103
+ const ix = qw * x + qy * z - qz * y;
104
+ const iy = qw * y + qz * x - qx * z;
105
+ const iz = qw * z + qx * y - qy * x;
106
+ const iw = -qx * x - qy * y - qz * z;
107
+ // Apply the quaternion to the vector
108
+ out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
109
+ out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
110
+ out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
111
+ }
112
+ function randomUnit(out) {
113
+ const theta = Math.random() * 2 * Math.PI;
114
+ const phi = Math.acos(2 * Math.random() - 1);
115
+ out[0] = Math.sin(phi) * Math.cos(theta);
116
+ out[1] = Math.sin(phi) * Math.sin(theta);
117
+ out[2] = Math.cos(phi);
118
+ }
119
+ function str(a) {
120
+ return `Vec3(${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)})`;
121
+ }
122
+ export { create, set, clone, copy, add, subtract, dot, cross, multiplyScalar, divideScalar, lengthSquared, length, normalize, distanceSquared, distance, equals, toUnitVectorLongLat, fromUnitVectorLongLat, applyQuaternion, randomUnit, str };
@@ -1,4 +1,5 @@
1
- import { getColorRampModed, DataManager, PointCoordinatesDataCalculator } from "../../util";
1
+ import { getColorRampModed, DataManager, } from "../../util/index";
2
+ import { TexturePointSampler } from "../../util/heatwavedatamanager/texture-point-sampler";
2
3
  import { GlobeShellWiggle, Float2LegendWithRatio } from "../../programs";
3
4
  import { opacityCheck } from "../../util/check/typecheck";
4
5
  /**
@@ -50,9 +51,9 @@ export default class HeatWaveGlobeShellPlugin {
50
51
  this._escapeValue = escapeValue;
51
52
  this.heatProgram.setEscapeValue(escapeValue);
52
53
  }
53
- _createPointCoordinatesDataCalculator() {
54
- this.coordinatesDataCalculator = new PointCoordinatesDataCalculator(this._bbox, this._dataWidthHeight.width, this._dataWidthHeight.height);
55
- this.dataManager.register(this._coordinatesDataCalculatorID(), this.coordinatesDataCalculator.updateData.bind(this.coordinatesDataCalculator));
54
+ _createTexturePointSampler() {
55
+ this.coordinatesDataCalculator = new TexturePointSampler(this._bbox, this._dataWidthHeight.width, this._dataWidthHeight.height);
56
+ this.dataManager.register(this._coordinatesDataCalculatorID(), this.coordinatesDataCalculator.updateTextureData.bind(this.coordinatesDataCalculator));
56
57
  }
57
58
  _coordinatesDataCalculatorID() {
58
59
  return this.id + "_coordinatesDataCalculator";
@@ -77,9 +78,9 @@ export default class HeatWaveGlobeShellPlugin {
77
78
  this.globeShell.setBBox({ minLon, minLat, maxLon, maxLat });
78
79
  this.drawHeat();
79
80
  }
80
- getPointCoordinatesDataCalculator() {
81
+ getTexturePointSampler() {
81
82
  if (!this.coordinatesDataCalculator)
82
- this._createPointCoordinatesDataCalculator();
83
+ this._createTexturePointSampler();
83
84
  return this.coordinatesDataCalculator;
84
85
  }
85
86
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.9.15",
3
+ "version": "0.10.1-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",