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