@pirireis/webglobeplugins 0.9.10 → 0.9.11

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 (166) hide show
  1. package/Math/angle-calculation.js +8 -8
  2. package/Math/arc.js +18 -18
  3. package/Math/bounds/line-bbox.js +80 -78
  4. package/Math/constants.js +3 -3
  5. package/Math/juction/arc-plane.js +23 -23
  6. package/Math/juction/line-sphere.js +11 -11
  7. package/Math/juction/plane-plane.js +11 -11
  8. package/Math/line.js +16 -14
  9. package/Math/methods.js +72 -67
  10. package/Math/plane.js +18 -16
  11. package/Math/quaternion.js +49 -45
  12. package/Math/utils.js +2 -2
  13. package/Math/vec3.js +45 -42
  14. package/algorithms/search-binary.js +4 -4
  15. package/altitude-locator/draw-subset-obj.js +8 -7
  16. package/altitude-locator/plugin.js +113 -97
  17. package/arrowfield/adaptor.js +4 -3
  18. package/arrowfield/index.js +2 -2
  19. package/arrowfield/plugin.js +65 -62
  20. package/bearing-line/index.js +1 -1
  21. package/bearing-line/plugin.js +225 -200
  22. package/circle-line-chain/chain-list-map.js +88 -82
  23. package/circle-line-chain/plugin.js +154 -129
  24. package/circle-line-chain/util.js +1 -1
  25. package/compass-rose/compass-rose-padding-flat.js +126 -104
  26. package/compass-rose/compass-text-writer.js +70 -62
  27. package/compass-rose/index.js +2 -2
  28. package/compassrose/compassrose.js +50 -46
  29. package/compassrose/index.js +1 -1
  30. package/heatwave/index.js +2 -2
  31. package/heatwave/isobar/objectarraylabels.js +48 -44
  32. package/heatwave/isobar/plugin.js +123 -104
  33. package/heatwave/isobar/quadtreecontours.js +92 -76
  34. package/heatwave/plugins/heatwaveglobeshell.js +87 -69
  35. package/index.js +11 -11
  36. package/package.json +1 -1
  37. package/partialrings/buffer-manager.js +64 -32
  38. package/partialrings/index.js +1 -1
  39. package/partialrings/plugin.js +84 -48
  40. package/partialrings/program.js +47 -136
  41. package/pin/pin-object-array.js +86 -83
  42. package/pin/pin-point-totem.js +22 -21
  43. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +10 -10
  44. package/point-heat-map/plugin-webworker.js +45 -40
  45. package/point-heat-map/point-to-heat-map-flow.js +42 -40
  46. package/point-tracks/key-methods.js +1 -1
  47. package/point-tracks/plugin.js +142 -127
  48. package/programs/arrowfield/index.js +1 -1
  49. package/programs/arrowfield/logic.js +62 -170
  50. package/programs/arrowfield/object.js +35 -33
  51. package/programs/data2legend/density-to-legend.js +21 -45
  52. package/programs/data2legend/point-to-density-texture.js +27 -52
  53. package/programs/float2legendwithratio/index.js +1 -1
  54. package/programs/float2legendwithratio/logic.js +42 -88
  55. package/programs/float2legendwithratio/object.js +46 -43
  56. package/programs/globe-util/is-globe-moved.js +11 -10
  57. package/programs/globeshell/index.js +1 -1
  58. package/programs/globeshell/wiggle/index.js +1 -1
  59. package/programs/globeshell/wiggle/logic.js +98 -191
  60. package/programs/globeshell/wiggle/object.js +35 -33
  61. package/programs/helpers/blender/program.js +19 -36
  62. package/programs/helpers/fadeaway/index.js +1 -1
  63. package/programs/helpers/fadeaway/logic.js +13 -35
  64. package/programs/helpers/fadeaway/object.js +10 -9
  65. package/programs/helpers/index.js +1 -1
  66. package/programs/index.js +8 -8
  67. package/programs/line-on-globe/angled-line.js +32 -91
  68. package/programs/line-on-globe/circle-accurate-3d.js +32 -82
  69. package/programs/line-on-globe/circle-accurate-flat.js +50 -108
  70. package/programs/line-on-globe/circle-accurate.js +33 -103
  71. package/programs/line-on-globe/circle.js +32 -97
  72. package/programs/line-on-globe/degree-padding-around-circle-3d.js +33 -83
  73. package/programs/line-on-globe/lines-color-instanced-flat.js +34 -79
  74. package/programs/line-on-globe/linestrip.js +39 -100
  75. package/programs/line-on-globe/naive-accurate-flexible.js +48 -118
  76. package/programs/line-on-globe/to-the-surface.js +29 -58
  77. package/programs/line-on-globe/util.js +1 -1
  78. package/programs/picking/pickable-renderer.js +33 -117
  79. package/programs/point-on-globe/element-globe-surface-glow.js +38 -78
  80. package/programs/point-on-globe/element-point-glow.js +35 -103
  81. package/programs/point-on-globe/square-pixel-point.js +27 -76
  82. package/programs/programcache.js +13 -13
  83. package/programs/rings/distancering/circleflatprogram.js +21 -63
  84. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +145 -156
  85. package/programs/rings/distancering/circlepaddysharedbuffer.js +197 -121
  86. package/programs/rings/distancering/index.js +4 -4
  87. package/programs/rings/distancering/paddyflatprogram.js +20 -73
  88. package/programs/rings/distancering/paddyflatprogram2d.js +22 -75
  89. package/programs/rings/distancering/paddyflatprogram3d.js +20 -73
  90. package/programs/rings/partial-ring/piece-of-pie.js +35 -137
  91. package/programs/totems/camerauniformblock.js +51 -64
  92. package/programs/totems/canvas-webglobe-info.js +40 -48
  93. package/programs/totems/gpu-selection-uniform-block.js +40 -44
  94. package/programs/totems/index.js +1 -1
  95. package/programs/two-d/pixel-padding-for-compass.js +29 -90
  96. package/programs/util.js +7 -6
  97. package/programs/vectorfields/index.js +1 -1
  98. package/programs/vectorfields/logics/drawrectangleparticles.js +29 -70
  99. package/programs/vectorfields/logics/index.js +3 -3
  100. package/programs/vectorfields/logics/pixelbased.js +35 -91
  101. package/programs/vectorfields/logics/ubo.js +25 -31
  102. package/programs/vectorfields/pingpongbuffermanager.js +34 -30
  103. package/rangerings/index.js +4 -4
  104. package/rangerings/plugin.js +252 -202
  105. package/rangerings/rangeringangletext.js +120 -108
  106. package/rangerings/ring-account.js +69 -52
  107. package/shaders/fragment-toy/firework.js +1 -55
  108. package/shaders/fragment-toy/singularity.js +1 -55
  109. package/timetracks/adaptors-line-strip.js +37 -26
  110. package/timetracks/adaptors.js +61 -47
  111. package/timetracks/index.js +4 -4
  112. package/timetracks/plugin-line-strip.js +63 -59
  113. package/timetracks/plugin.js +69 -65
  114. package/timetracks/program-line-strip.js +103 -296
  115. package/timetracks/program.js +113 -419
  116. package/timetracks/programpoint-line-strip.js +44 -97
  117. package/timetracks/programpoint.js +44 -90
  118. package/util/account/bufferoffsetmanager.js +95 -72
  119. package/util/account/index.js +1 -1
  120. package/util/account/single-attribute-buffer-management/buffer-manager.js +43 -39
  121. package/util/account/single-attribute-buffer-management/buffer-orchestrator.js +94 -64
  122. package/util/account/single-attribute-buffer-management/index.js +3 -3
  123. package/util/account/single-attribute-buffer-management/object-store.js +30 -28
  124. package/util/account/util.js +4 -2
  125. package/util/algorithms/search-binary.js +4 -4
  126. package/util/check/get.js +5 -5
  127. package/util/check/typecheck.js +15 -13
  128. package/util/geometry/index.js +11 -9
  129. package/util/gl-util/buffer/attribute-loader.js +20 -8
  130. package/util/gl-util/buffer/index.js +1 -1
  131. package/util/gl-util/draw-options/methods.js +7 -7
  132. package/util/gl-util/uniform-block/manager.js +67 -55
  133. package/util/heatwavedatamanager/datamanager.js +116 -56
  134. package/util/heatwavedatamanager/index.js +2 -2
  135. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +40 -37
  136. package/util/heatwavedatamanager/pointcoordsmeta.js +10 -9
  137. package/util/index.js +6 -6
  138. package/util/interpolation/timetrack/index.js +1 -1
  139. package/util/interpolation/timetrack/timetrack-interpolator.js +29 -27
  140. package/util/interpolation/timetrack/web-worker-str.js +1 -179
  141. package/util/interpolation/timetrack/web-worker.js +4 -4
  142. package/util/jshelpers/data-filler.js +7 -7
  143. package/util/jshelpers/timefilters.js +7 -7
  144. package/util/picking/fence.js +7 -7
  145. package/util/picking/picker-displayer.js +52 -46
  146. package/util/programs/draw-texture-on-canvas.js +21 -39
  147. package/util/programs/shapesonglobe.js +64 -104
  148. package/util/programs/supersampletotextures.js +39 -45
  149. package/util/programs/texturetoglobe.js +48 -98
  150. package/util/shaderfunctions/geometrytransformations.js +27 -322
  151. package/util/shaderfunctions/nodata.js +1 -7
  152. package/util/shaderfunctions/noisefunctions.js +9 -39
  153. package/util/surface-line-data/arcs-to-cuts.js +23 -20
  154. package/util/webglobe/rasteroverlay.js +37 -35
  155. package/util/webglobjectbuilders.js +60 -55
  156. package/util/webglobjectbuilders1.js +49 -48
  157. package/waveparticles/adaptor.js +7 -6
  158. package/waveparticles/index.js +2 -2
  159. package/waveparticles/plugin.js +84 -79
  160. package/wind/imagetovectorfieldandmagnitude.js +15 -15
  161. package/wind/index.js +4 -4
  162. package/wind/plugin.js +251 -453
  163. package/wind/vectorfieldimage.js +5 -5
  164. package/write-text/attached-text-writer.js +48 -46
  165. package/write-text/context-text.js +58 -51
  166. package/write-text/context-text3.js +74 -69
package/Math/methods.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.globe2Dcoordinates = exports.globe3Dcoordinates = exports.pixelXYLenghtToUnitVectorWithHeight = exports.wgs84ToMercator = exports.wgs84ToCartesian3d = exports.wgs84ToUnitVector = exports.sphericalLinearInterpolation_Cartesian3d = exports.sphericalLinearInterpolation_Mercator = exports.sphericalLinearInterpolation_UnitVector = exports.radianToCartesian3d = exports.radianToMercator = exports.cartesian3dToRadian = exports.length3 = exports.dot3 = exports.normalize3 = exports.RADIANS = void 0;
4
- const constants_ts_1 = require("./constants.ts");
4
+ var constants_1 = require("./constants");
5
5
  /**
6
6
  * @typedef {Array<number>} vec3 [x, y, z]
7
7
  * @typedef {Array<number>} vec2 [x, y]
@@ -12,14 +12,14 @@ const constants_ts_1 = require("./constants.ts");
12
12
  // *********************************************************
13
13
  // **************** VECTOR OPERATIONS **********************
14
14
  // *********************************************************
15
- const RADIANS = Math.PI / 180;
15
+ var RADIANS = Math.PI / 180;
16
16
  exports.RADIANS = RADIANS;
17
17
  /**
18
18
  * @param {vec3} a
19
19
  * @returns {vec3}
20
20
  */
21
- const normalize3 = (a) => {
22
- const len = length3(a);
21
+ var normalize3 = function (a) {
22
+ var len = length3(a);
23
23
  return [a[0] / len, a[1] / len, a[2] / len];
24
24
  };
25
25
  exports.normalize3 = normalize3;
@@ -28,7 +28,7 @@ exports.normalize3 = normalize3;
28
28
  * @param {vec3} b
29
29
  * @returns {number}
30
30
  */
31
- const dot3 = (a, b) => {
31
+ var dot3 = function (a, b) {
32
32
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
33
33
  };
34
34
  exports.dot3 = dot3;
@@ -36,7 +36,7 @@ exports.dot3 = dot3;
36
36
  * @param {vec3} a
37
37
  * @returns {number}
38
38
  */
39
- const length3 = (a) => {
39
+ var length3 = function (a) {
40
40
  return Math.sqrt(dot3(a, a));
41
41
  };
42
42
  exports.length3 = length3;
@@ -47,13 +47,13 @@ exports.length3 = length3;
47
47
  * @param {vec3} cartesian
48
48
  * @returns {vec2} long lat in radians
49
49
  */
50
- const cartesian3dToRadian = (cartesian) => {
51
- const x = cartesian[0];
52
- const y = cartesian[1];
53
- const z = cartesian[2];
50
+ var cartesian3dToRadian = function (cartesian) {
51
+ var x = cartesian[0];
52
+ var y = cartesian[1];
53
+ var z = cartesian[2];
54
54
  // const length = Math.sqrt(x * x + y * y + z * z);
55
- const long = Math.atan2(y, x);
56
- const lat = Math.asin(z); // length);
55
+ var long = Math.atan2(y, x);
56
+ var lat = Math.asin(z); // length);
57
57
  return [long, lat];
58
58
  };
59
59
  exports.cartesian3dToRadian = cartesian3dToRadian;
@@ -61,18 +61,18 @@ exports.cartesian3dToRadian = cartesian3dToRadian;
61
61
  * @param {vec2} xy long lat in radians
62
62
  * @returns {vec2} long lat in mercator meters
63
63
  */
64
- const radianToMercator = (xy) => {
65
- return [constants_ts_1.WORLD_RADIUS_MERCATOR * xy[0], constants_ts_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
64
+ var radianToMercator = function (xy) {
65
+ return [constants_1.WORLD_RADIUS_MERCATOR * xy[0], constants_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + xy[1] / 2))];
66
66
  };
67
67
  exports.radianToMercator = radianToMercator;
68
68
  /**
69
69
  * @param {vec2} xy long lat radians
70
70
  * @returns {vec3} cartesian
71
71
  */
72
- const radianToCartesian3d = (xy) => {
73
- const x = Math.cos(xy[1]) * Math.cos(xy[0]);
74
- const y = Math.cos(xy[1]) * Math.sin(xy[0]);
75
- const z = -Math.sin(xy[1]);
72
+ var radianToCartesian3d = function (xy) {
73
+ var x = Math.cos(xy[1]) * Math.cos(xy[0]);
74
+ var y = Math.cos(xy[1]) * Math.sin(xy[0]);
75
+ var z = -Math.sin(xy[1]);
76
76
  return [x, y, z];
77
77
  };
78
78
  exports.radianToCartesian3d = radianToCartesian3d;
@@ -85,12 +85,12 @@ exports.radianToCartesian3d = radianToCartesian3d;
85
85
  * @param {fraction} ratio
86
86
  * @returns {vec3}
87
87
  */
88
- const sphericalLinearInterpolation_UnitVector = (normalizedA, normalizedB, ratio) => {
89
- const theta = Math.acos(dot3(normalizedA, normalizedB));
88
+ var sphericalLinearInterpolation_UnitVector = function (normalizedA, normalizedB, ratio) {
89
+ var theta = Math.acos(dot3(normalizedA, normalizedB));
90
90
  if (theta < 0.000001)
91
91
  return normalizedA; // CALIBRATE?
92
- const sinTheta = Math.sin(theta);
93
- const result = [
92
+ var sinTheta = Math.sin(theta);
93
+ var result = [
94
94
  (Math.sin((1.0 - ratio) * theta) * normalizedA[0] + Math.sin(ratio * theta) * normalizedB[0]) / sinTheta,
95
95
  (Math.sin((1.0 - ratio) * theta) * normalizedA[1] + Math.sin(ratio * theta) * normalizedB[1]) / sinTheta,
96
96
  (Math.sin((1.0 - ratio) * theta) * normalizedA[2] + Math.sin(ratio * theta) * normalizedB[2]) / sinTheta
@@ -104,9 +104,9 @@ exports.sphericalLinearInterpolation_UnitVector = sphericalLinearInterpolation_U
104
104
  * @param {fraction} ratio
105
105
  * @returns
106
106
  */
107
- const sphericalLinearInterpolation_Mercator = (normalizedA, normalizedB, ratio) => {
108
- const unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
109
- const angles = cartesian3dToRadian(unitVector);
107
+ var sphericalLinearInterpolation_Mercator = function (normalizedA, normalizedB, ratio) {
108
+ var unitVector = sphericalLinearInterpolation_UnitVector(normalizedA, normalizedB, ratio);
109
+ var angles = cartesian3dToRadian(unitVector);
110
110
  return radianToMercator(angles);
111
111
  };
112
112
  exports.sphericalLinearInterpolation_Mercator = sphericalLinearInterpolation_Mercator;
@@ -115,9 +115,9 @@ exports.sphericalLinearInterpolation_Mercator = sphericalLinearInterpolation_Mer
115
115
  * @param {vec4} b vec3 unit vector and length
116
116
  * @param {fraction} ratio
117
117
  */
118
- const sphericalLinearInterpolation_Cartesian3d = (a, b, ratio) => {
119
- const unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
120
- const height = a[3] + (b[3] - a[3]) * ratio;
118
+ var sphericalLinearInterpolation_Cartesian3d = function (a, b, ratio) {
119
+ var unitVector = sphericalLinearInterpolation_UnitVector(a, b, ratio);
120
+ var height = a[3] + (b[3] - a[3]) * ratio;
121
121
  return [unitVector[0] * height, unitVector[1] * height, unitVector[2] * height];
122
122
  };
123
123
  exports.sphericalLinearInterpolation_Cartesian3d = sphericalLinearInterpolation_Cartesian3d;
@@ -126,12 +126,12 @@ exports.sphericalLinearInterpolation_Cartesian3d = sphericalLinearInterpolation_
126
126
  * @param {wgs84} coordinates
127
127
  * @returns {vec3}
128
128
  */
129
- const wgs84ToUnitVector = (coordinates) => {
130
- const long = coordinates[0] * RADIANS;
131
- const lat = coordinates[1] * RADIANS;
132
- const x = Math.cos(lat) * Math.cos(long);
133
- const y = Math.cos(lat) * Math.sin(long);
134
- const z = Math.sin(lat);
129
+ var wgs84ToUnitVector = function (coordinates) {
130
+ var long = coordinates[0] * RADIANS;
131
+ var lat = coordinates[1] * RADIANS;
132
+ var x = Math.cos(lat) * Math.cos(long);
133
+ var y = Math.cos(lat) * Math.sin(long);
134
+ var z = Math.sin(lat);
135
135
  return [x, y, z];
136
136
  };
137
137
  exports.wgs84ToUnitVector = wgs84ToUnitVector;
@@ -141,13 +141,13 @@ exports.wgs84ToUnitVector = wgs84ToUnitVector;
141
141
  * @param {number} height
142
142
  * @returns {vec3} cartesian3D
143
143
  */
144
- const wgs84ToCartesian3d = (long, lat, height) => {
145
- const longRad = long * RADIANS;
146
- const latRad = lat * RADIANS;
147
- const x = Math.cos(latRad) * Math.cos(longRad);
148
- const y = Math.cos(latRad) * Math.sin(longRad);
149
- const z = Math.sin(latRad);
150
- const radius = constants_ts_1.WORLD_RADIUS_3D + height;
144
+ var wgs84ToCartesian3d = function (long, lat, height) {
145
+ var longRad = long * RADIANS;
146
+ var latRad = lat * RADIANS;
147
+ var x = Math.cos(latRad) * Math.cos(longRad);
148
+ var y = Math.cos(latRad) * Math.sin(longRad);
149
+ var z = Math.sin(latRad);
150
+ var radius = constants_1.WORLD_RADIUS_3D + height;
151
151
  return [x * radius, y * radius, z * radius];
152
152
  };
153
153
  exports.wgs84ToCartesian3d = wgs84ToCartesian3d;
@@ -156,46 +156,51 @@ exports.wgs84ToCartesian3d = wgs84ToCartesian3d;
156
156
  * @param {number} lat
157
157
  * @returns {vec2} mercator
158
158
  */
159
- const wgs84ToMercator = (long, lat) => {
160
- return [constants_ts_1.WORLD_RADIUS_MERCATOR * long * RADIANS, constants_ts_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + lat * RADIANS / 2))];
159
+ var wgs84ToMercator = function (long, lat) {
160
+ return [constants_1.WORLD_RADIUS_MERCATOR * long * RADIANS, constants_1.WORLD_RADIUS_MERCATOR * Math.log(Math.tan(Math.PI / 4 + lat * RADIANS / 2))];
161
161
  };
162
162
  exports.wgs84ToMercator = wgs84ToMercator;
163
163
  /**
164
164
  * @param {vec2} pixelXY
165
165
  * @returns {vec2} long lat in radians
166
166
  */
167
- const pixelXYToRadians = (pixelXY) => {
168
- const long = (2.0 * pixelXY[0] - 1.0) * Math.PI;
169
- const lat = (2.0 * pixelXY[1] - 1.0) * Math.PI / 2.0;
167
+ var pixelXYToRadians = function (pixelXY) {
168
+ var long = (2.0 * pixelXY[0] - 1.0) * Math.PI;
169
+ var lat = (2.0 * pixelXY[1] - 1.0) * Math.PI / 2.0;
170
170
  return [long, lat];
171
171
  };
172
- const pixelXYLenghtToUnitVectorWithHeight = (pixelXYHeight) => {
173
- const [long, lat] = pixelXYToRadians(pixelXYHeight);
174
- const radius = constants_ts_1.WORLD_RADIUS_3D + pixelXYHeight[2];
172
+ var pixelXYLenghtToUnitVectorWithHeight = function (pixelXYHeight) {
173
+ var _a = pixelXYToRadians(pixelXYHeight), long = _a[0], lat = _a[1];
174
+ var radius = constants_1.WORLD_RADIUS_3D + pixelXYHeight[2];
175
175
  return radianToCartesian3d([long, lat]).concat(radius);
176
176
  };
177
177
  exports.pixelXYLenghtToUnitVectorWithHeight = pixelXYLenghtToUnitVectorWithHeight;
178
- const globe3Dcoordinates = (globe, height = 0) => (longlats, { paddingCount = 0, paddingValue = NaN }) => {
179
- const len = longlats.length / 2;
180
- const result = new Float32Array(len * 3 + paddingCount * 3).fill(paddingValue);
181
- for (let i = 0; i < len; i++) {
182
- const long = longlats[i * 2];
183
- const lat = longlats[i * 2 + 1];
184
- const xyz = globe.api_GetCartesian3DPoint(long, lat, height, 0);
185
- result.set(xyz, i * 3);
186
- }
187
- return result;
178
+ var globe3Dcoordinates = function (globe, height) {
179
+ if (height === void 0) { height = 0; }
180
+ return function (longlats, _a) {
181
+ var _b = _a.paddingCount, paddingCount = _b === void 0 ? 0 : _b, _c = _a.paddingValue, paddingValue = _c === void 0 ? NaN : _c;
182
+ var len = longlats.length / 2;
183
+ var result = new Float32Array(len * 3 + paddingCount * 3).fill(paddingValue);
184
+ for (var i = 0; i < len; i++) {
185
+ var long = longlats[i * 2];
186
+ var lat = longlats[i * 2 + 1];
187
+ var xyz = globe.api_GetCartesian3DPoint(long, lat, height, 0);
188
+ result.set(xyz, i * 3);
189
+ }
190
+ return result;
191
+ };
188
192
  };
189
193
  exports.globe3Dcoordinates = globe3Dcoordinates;
190
- const globe2Dcoordinates = (globe) => (longlats, { paddingCount = 0, paddingValue = NaN }) => {
191
- const len = longlats.length / 2;
192
- const result = new Float32Array(len * 2 + paddingCount * 2).fill(paddingValue);
193
- for (let i = 0; i < len; i++) {
194
- const long = longlats[i * 2];
195
- const lat = longlats[i * 2 + 1];
196
- const xyz = globe.api_GetMercator2DPoint(long, lat);
194
+ var globe2Dcoordinates = function (globe) { return function (longlats, _a) {
195
+ var _b = _a.paddingCount, paddingCount = _b === void 0 ? 0 : _b, _c = _a.paddingValue, paddingValue = _c === void 0 ? NaN : _c;
196
+ var len = longlats.length / 2;
197
+ var result = new Float32Array(len * 2 + paddingCount * 2).fill(paddingValue);
198
+ for (var i = 0; i < len; i++) {
199
+ var long = longlats[i * 2];
200
+ var lat = longlats[i * 2 + 1];
201
+ var xyz = globe.api_GetMercator2DPoint(long, lat);
197
202
  result.set(xyz, i * 2);
198
203
  }
199
204
  return result;
200
- };
205
+ }; };
201
206
  exports.globe2Dcoordinates = globe2Dcoordinates;
package/Math/plane.js CHANGED
@@ -1,60 +1,62 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.plane = void 0;
4
- const constants_1 = require("./constants");
5
- const vec3_1 = require("./vec3");
6
- const _0vector = /*@__PURE__*/ vec3_1.vec3.create(0, 0, 0);
7
- const _1vector = /*@__PURE__*/ vec3_1.vec3.create(1, 1, 1);
4
+ var constants_1 = require("./constants");
5
+ var vec3_1 = require("./vec3");
6
+ var _0vector = /*@__PURE__*/ vec3_1.vec3.create(0, 0, 0);
7
+ var _1vector = /*@__PURE__*/ vec3_1.vec3.create(1, 1, 1);
8
8
  exports.plane = Object.freeze({
9
- create(normal = vec3_1.vec3.create(), distance = 0) {
9
+ create: function (normal, distance) {
10
+ if (normal === void 0) { normal = vec3_1.vec3.create(); }
11
+ if (distance === void 0) { distance = 0; }
10
12
  return {
11
13
  normal: vec3_1.vec3.clone(normal),
12
14
  distance: distance
13
15
  };
14
16
  },
15
- set(out, normal, distance) {
17
+ set: function (out, normal, distance) {
16
18
  vec3_1.vec3.copy(out.normal, normal);
17
19
  out.distance = distance;
18
20
  return out;
19
21
  },
20
- fromValues(out, nx, ny, nz, distance) {
22
+ fromValues: function (out, nx, ny, nz, distance) {
21
23
  vec3_1.vec3.set(out.normal, nx, ny, nz);
22
24
  out.distance = distance;
23
25
  },
24
- copy(out, a) {
26
+ copy: function (out, a) {
25
27
  vec3_1.vec3.copy(out.normal, a.normal);
26
28
  out.distance = a.distance;
27
29
  return out;
28
30
  },
29
- clone(a) {
31
+ clone: function (a) {
30
32
  return {
31
33
  normal: vec3_1.vec3.clone(a.normal),
32
34
  distance: a.distance
33
35
  };
34
36
  },
35
- distanceToPoint(plane, point) {
37
+ distanceToPoint: function (plane, point) {
36
38
  return vec3_1.vec3.dot(plane.normal, point) - plane.distance;
37
39
  },
38
- projectPoint(out, plane, point) {
39
- const distance = this.distanceToPoint(plane, point);
40
+ projectPoint: function (out, plane, point) {
41
+ var distance = this.distanceToPoint(plane, point);
40
42
  vec3_1.vec3.multiplyScalar(out, plane.normal, distance);
41
43
  vec3_1.vec3.subtract(out, point, out);
42
44
  },
43
- equals(plane, other) {
45
+ equals: function (plane, other) {
44
46
  return vec3_1.vec3.equals(plane.normal, other.normal) && Math.abs(plane.distance - other.distance) < constants_1.EPSILON;
45
47
  },
46
- fromNormalAndCoplanarPoint(out, normal, point) {
48
+ fromNormalAndCoplanarPoint: function (out, normal, point) {
47
49
  vec3_1.vec3.copy(out.normal, normal);
48
50
  out.distance = vec3_1.vec3.dot(point, normal);
49
51
  },
50
- fromPoints(out, a, b, c) {
52
+ fromPoints: function (out, a, b, c) {
51
53
  vec3_1.vec3.subtract(_0vector, b, a);
52
54
  vec3_1.vec3.subtract(_1vector, c, a);
53
55
  vec3_1.vec3.cross(out.normal, _0vector, _1vector);
54
56
  vec3_1.vec3.normalize(out.normal, out.normal);
55
57
  out.distance = vec3_1.vec3.dot(out.normal, a);
56
58
  },
57
- getUnitSphereRadiusAngle(plane) {
59
+ getUnitSphereRadiusAngle: function (plane) {
58
60
  return Math.acos(Math.max(Math.min(plane.distance, 1), -1));
59
61
  }
60
62
  });
@@ -1,75 +1,79 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.quaternion = void 0;
4
- const vec3_1 = require("./vec3");
5
- const constants_1 = require("./constants");
4
+ var vec3_1 = require("./vec3");
5
+ var constants_1 = require("./constants");
6
6
  exports.quaternion = Object.freeze({
7
- create(x = 0, y = 0, z = 0, w = 1) {
7
+ create: function (x, y, z, w) {
8
+ if (x === void 0) { x = 0; }
9
+ if (y === void 0) { y = 0; }
10
+ if (z === void 0) { z = 0; }
11
+ if (w === void 0) { w = 1; }
8
12
  return [x, y, z, w];
9
13
  },
10
- set(out, x, y, z, w) {
14
+ set: function (out, x, y, z, w) {
11
15
  out[0] = x;
12
16
  out[1] = y;
13
17
  out[2] = z;
14
18
  out[3] = w;
15
19
  },
16
- copy(out, a) {
20
+ copy: function (out, a) {
17
21
  out[0] = a[0];
18
22
  out[1] = a[1];
19
23
  out[2] = a[2];
20
24
  out[3] = a[3];
21
25
  },
22
- clone(a) {
26
+ clone: function (a) {
23
27
  return [a[0], a[1], a[2], a[3]];
24
28
  },
25
- multiply(out, a, b) {
26
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
27
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
28
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
29
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
29
+ multiply: function (out, a, b) {
30
+ var x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
31
+ var y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
32
+ var z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
33
+ var w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
30
34
  this.set(out, x, y, z, w);
31
35
  return out;
32
36
  },
33
- randomUnit(out) {
34
- const u1 = Math.random();
35
- const u2 = Math.random();
36
- const u3 = Math.random();
37
- const sqrt1MinusU1 = Math.sqrt(1 - u1);
38
- const sqrtU1 = Math.sqrt(u1);
39
- const x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
40
- const y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
41
- const z = sqrtU1 * Math.sin(2 * Math.PI * u3);
42
- const w = sqrtU1 * Math.cos(2 * Math.PI * u3);
37
+ randomUnit: function (out) {
38
+ var u1 = Math.random();
39
+ var u2 = Math.random();
40
+ var u3 = Math.random();
41
+ var sqrt1MinusU1 = Math.sqrt(1 - u1);
42
+ var sqrtU1 = Math.sqrt(u1);
43
+ var x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
44
+ var y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
45
+ var z = sqrtU1 * Math.sin(2 * Math.PI * u3);
46
+ var w = sqrtU1 * Math.cos(2 * Math.PI * u3);
43
47
  this.set(out, x, y, z, w);
44
48
  this.normalize(out, out);
45
49
  return out;
46
50
  },
47
- rotateQuaternion(out, a, b) {
48
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
49
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
50
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
51
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
51
+ rotateQuaternion: function (out, a, b) {
52
+ var x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
53
+ var y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
54
+ var z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
55
+ var w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
52
56
  this.set(out, x, y, z, w);
53
57
  this.normalize(out, out);
54
58
  },
55
- lengthSquared(a) {
59
+ lengthSquared: function (a) {
56
60
  return a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
57
61
  },
58
- length(a) {
62
+ length: function (a) {
59
63
  return Math.sqrt(this.lengthSquared(a));
60
64
  },
61
- normalize(out, input) {
62
- const len = Math.sqrt(this.lengthSquared(input));
65
+ normalize: function (out, input) {
66
+ var len = Math.sqrt(this.lengthSquared(input));
63
67
  if (len < constants_1.EPSILON) {
64
68
  this.set(out, 0, 0, 0, 1);
65
69
  }
66
70
  else {
67
- const invLen = 1 / len;
71
+ var invLen = 1 / len;
68
72
  this.set(out, input[0] * invLen, input[1] * invLen, input[2] * invLen, input[3] * invLen);
69
73
  }
70
74
  },
71
- fromUnitVectors(out, from, to) {
72
- const d = vec3_1.vec3.dot(from, to) + 1;
75
+ fromUnitVectors: function (out, from, to) {
76
+ var d = vec3_1.vec3.dot(from, to) + 1;
73
77
  if (d < constants_1.EPSILON) {
74
78
  if (Math.abs(from[0]) > Math.abs(from[2])) {
75
79
  this.set(out, -from[1], from[0], 0, 0);
@@ -79,26 +83,26 @@ exports.quaternion = Object.freeze({
79
83
  }
80
84
  }
81
85
  else {
82
- const x = from[1] * to[2] - from[2] * to[1];
83
- const y = from[2] * to[0] - from[0] * to[2];
84
- const z = from[0] * to[1] - from[1] * to[0];
86
+ var x = from[1] * to[2] - from[2] * to[1];
87
+ var y = from[2] * to[0] - from[0] * to[2];
88
+ var z = from[0] * to[1] - from[1] * to[0];
85
89
  this.set(out, x, y, z, d);
86
90
  }
87
91
  },
88
- fromTwoQuaternions(out, from, to) {
89
- const x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
90
- const y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
91
- const z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
92
- const w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
92
+ fromTwoQuaternions: function (out, from, to) {
93
+ var x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
94
+ var y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
95
+ var z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
96
+ var w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
93
97
  this.set(out, x, y, z, w);
94
98
  this.normalize(out, out);
95
99
  },
96
- conjugate(out, a) {
100
+ conjugate: function (out, a) {
97
101
  this.set(out, -a[0], -a[1], -a[2], a[3]);
98
102
  },
99
- fromAxisAngle(out, axis, angle) {
100
- const halfAngle = angle / 2;
101
- const s = Math.sin(halfAngle);
103
+ fromAxisAngle: function (out, axis, angle) {
104
+ var halfAngle = angle / 2;
105
+ var s = Math.sin(halfAngle);
102
106
  this.set(out, axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(halfAngle));
103
107
  },
104
108
  });
package/Math/utils.js CHANGED
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const vector3d_1 = require("./vector3d");
4
- const quaternion_1 = require("./quaternion");
3
+ var vector3d_1 = require("./vector3d");
4
+ var quaternion_1 = require("./quaternion");
package/Math/vec3.js CHANGED
@@ -1,53 +1,56 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.vec3 = void 0;
4
- const constants_1 = require("./constants");
4
+ var constants_1 = require("./constants");
5
5
  exports.vec3 = Object.freeze({
6
- create(x = 0, y = 0, z = 1) {
6
+ create: function (x, y, z) {
7
+ if (x === void 0) { x = 0; }
8
+ if (y === void 0) { y = 0; }
9
+ if (z === void 0) { z = 1; }
7
10
  return [x, y, z];
8
11
  },
9
- set(out, x, y, z) {
12
+ set: function (out, x, y, z) {
10
13
  out[0] = x;
11
14
  out[1] = y;
12
15
  out[2] = z;
13
16
  },
14
- clone(a) {
17
+ clone: function (a) {
15
18
  return [a[0], a[1], a[2]];
16
19
  },
17
- copy(out, a) {
20
+ copy: function (out, a) {
18
21
  out[0] = a[0];
19
22
  out[1] = a[1];
20
23
  out[2] = a[2];
21
24
  return out;
22
25
  },
23
- add(out, a, b) {
26
+ add: function (out, a, b) {
24
27
  out[0] = a[0] + b[0];
25
28
  out[1] = a[1] + b[1];
26
29
  out[2] = a[2] + b[2];
27
30
  return out;
28
31
  },
29
- subtract(out, a, b) {
32
+ subtract: function (out, a, b) {
30
33
  out[0] = a[0] - b[0];
31
34
  out[1] = a[1] - b[1];
32
35
  out[2] = a[2] - b[2];
33
36
  },
34
- dot(a, b) {
37
+ dot: function (a, b) {
35
38
  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
36
39
  },
37
- cross(out, a, b) {
38
- const x = a[1] * b[2] - a[2] * b[1];
39
- const y = a[2] * b[0] - a[0] * b[2];
40
- const z = a[0] * b[1] - a[1] * b[0];
40
+ cross: function (out, a, b) {
41
+ var x = a[1] * b[2] - a[2] * b[1];
42
+ var y = a[2] * b[0] - a[0] * b[2];
43
+ var z = a[0] * b[1] - a[1] * b[0];
41
44
  out[0] = x;
42
45
  out[1] = y;
43
46
  out[2] = z;
44
47
  },
45
- multiplyScalar(out, a, b) {
48
+ multiplyScalar: function (out, a, b) {
46
49
  out[0] = a[0] * b;
47
50
  out[1] = a[1] * b;
48
51
  out[2] = a[2] * b;
49
52
  },
50
- divideScalar(out, a, b) {
53
+ divideScalar: function (out, a, b) {
51
54
  if (b === 0) {
52
55
  throw new Error('Division by zero');
53
56
  }
@@ -55,14 +58,14 @@ exports.vec3 = Object.freeze({
55
58
  out[1] = a[1] / b;
56
59
  out[2] = a[2] / b;
57
60
  },
58
- lengthSquared(a) {
61
+ lengthSquared: function (a) {
59
62
  return a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
60
63
  },
61
- length(a) {
64
+ length: function (a) {
62
65
  return Math.sqrt(this.lengthSquared(a));
63
66
  },
64
- normalize(outVec, inVec) {
65
- const len = this.length(inVec);
67
+ normalize: function (outVec, inVec) {
68
+ var len = this.length(inVec);
66
69
  if (len === 0) {
67
70
  throw new Error('Cannot normalize a zero vector');
68
71
  }
@@ -70,57 +73,57 @@ exports.vec3 = Object.freeze({
70
73
  outVec[1] = inVec[1] / len;
71
74
  outVec[2] = inVec[2] / len;
72
75
  },
73
- distanceSquared(a, b) {
74
- const dx = a[0] - b[0];
75
- const dy = a[1] - b[1];
76
- const dz = a[2] - b[2];
76
+ distanceSquared: function (a, b) {
77
+ var dx = a[0] - b[0];
78
+ var dy = a[1] - b[1];
79
+ var dz = a[2] - b[2];
77
80
  return dx * dx + dy * dy + dz * dz;
78
81
  },
79
- distance(a, b) {
82
+ distance: function (a, b) {
80
83
  return Math.sqrt(this.distanceSquared(a, b));
81
84
  },
82
- equals(a, b) {
85
+ equals: function (a, b) {
83
86
  return (Math.abs(a[0] - b[0]) < constants_1.EPSILON &&
84
87
  Math.abs(a[1] - b[1]) < constants_1.EPSILON &&
85
88
  Math.abs(a[2] - b[2]) < constants_1.EPSILON);
86
89
  },
87
- toUnitVectorLongLat(out, a) {
88
- const len = this.length(a); // TODO Might drop length check
90
+ toUnitVectorLongLat: function (out, a) {
91
+ var len = this.length(a); // TODO Might drop length check
89
92
  if (len === 0) {
90
93
  throw new Error('Cannot convert a zero vector to unit vector');
91
94
  }
92
95
  out[0] = Math.atan2(a[1], a[0]); // Longitude
93
96
  out[1] = Math.asin(a[2] / len); // Latitude
94
97
  },
95
- fromUnitVectorLongLat(out, longLat) {
96
- const longitude = longLat[0];
97
- const latitude = longLat[1];
98
- const cosLat = Math.cos(latitude);
98
+ fromUnitVectorLongLat: function (out, longLat) {
99
+ var longitude = longLat[0];
100
+ var latitude = longLat[1];
101
+ var cosLat = Math.cos(latitude);
99
102
  out[0] = cosLat * Math.cos(longitude);
100
103
  out[1] = cosLat * Math.sin(longitude);
101
104
  out[2] = Math.sin(latitude);
102
105
  },
103
- applyQuaternion(out, a, q) {
104
- const x = a[0], y = a[1], z = a[2];
105
- const qx = q[0], qy = q[1], qz = q[2], qw = q[3];
106
+ applyQuaternion: function (out, a, q) {
107
+ var x = a[0], y = a[1], z = a[2];
108
+ var qx = q[0], qy = q[1], qz = q[2], qw = q[3];
106
109
  // Calculate the quaternion multiplication
107
- const ix = qw * x + qy * z - qz * y;
108
- const iy = qw * y + qz * x - qx * z;
109
- const iz = qw * z + qx * y - qy * x;
110
- const iw = -qx * x - qy * y - qz * z;
110
+ var ix = qw * x + qy * z - qz * y;
111
+ var iy = qw * y + qz * x - qx * z;
112
+ var iz = qw * z + qx * y - qy * x;
113
+ var iw = -qx * x - qy * y - qz * z;
111
114
  // Apply the quaternion to the vector
112
115
  out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
113
116
  out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
114
117
  out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
115
118
  },
116
- randomUnit(out) {
117
- const theta = Math.random() * 2 * Math.PI;
118
- const phi = Math.acos(2 * Math.random() - 1);
119
+ randomUnit: function (out) {
120
+ var theta = Math.random() * 2 * Math.PI;
121
+ var phi = Math.acos(2 * Math.random() - 1);
119
122
  out[0] = Math.sin(phi) * Math.cos(theta);
120
123
  out[1] = Math.sin(phi) * Math.sin(theta);
121
124
  out[2] = Math.cos(phi);
122
125
  },
123
- str(a) {
124
- return `Vec3(${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)})`;
126
+ str: function (a) {
127
+ return "Vec3(".concat(a[0].toFixed(2), ", ").concat(a[1].toFixed(2), ", ").concat(a[2].toFixed(2), ")");
125
128
  }
126
129
  });