@pirireis/webglobeplugins 0.9.6 → 0.9.7

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 (226) hide show
  1. package/package.json +5 -2
  2. package/Math/angle-calculation.js +0 -14
  3. package/Math/arc.ts +0 -76
  4. package/Math/bounds/line-bbox.js +0 -225
  5. package/Math/constants.ts +0 -11
  6. package/Math/frustum/camera.ts +0 -32
  7. package/Math/frustum/from-globeinfo.ts +0 -63
  8. package/Math/frustum/types.ts +0 -11
  9. package/Math/globe-util/horizon-plane.ts +0 -137
  10. package/Math/index.js +0 -0
  11. package/Math/juction/arc-plane.ts +0 -114
  12. package/Math/juction/line-sphere.ts +0 -30
  13. package/Math/juction/plane-plane.ts +0 -66
  14. package/Math/line.ts +0 -70
  15. package/Math/matrix4.ts +0 -0
  16. package/Math/methods.js +0 -237
  17. package/Math/plane.ts +0 -86
  18. package/Math/quaternion.ts +0 -120
  19. package/Math/roadmap.md +0 -10
  20. package/Math/types.ts +0 -45
  21. package/Math/utils.js +0 -3
  22. package/Math/vec3.ts +0 -155
  23. package/algorithms/search-binary.js +0 -14
  24. package/altitude-locator/adaptors.js +0 -0
  25. package/altitude-locator/draw-subset-obj.js +0 -27
  26. package/altitude-locator/keymethod.js +0 -0
  27. package/altitude-locator/plugin.js +0 -439
  28. package/altitude-locator/types.js +0 -26
  29. package/arrowfield/adaptor.js +0 -11
  30. package/arrowfield/index.js +0 -3
  31. package/arrowfield/plugin.js +0 -128
  32. package/bearing-line/index.js +0 -2
  33. package/bearing-line/plugin.js +0 -512
  34. package/circle-line-chain/chain-list-map.js +0 -221
  35. package/circle-line-chain/init.js +0 -0
  36. package/circle-line-chain/plugin.js +0 -469
  37. package/circle-line-chain/readme.md +0 -57
  38. package/circle-line-chain/util.js +0 -1
  39. package/compass-rose/compass-rose-padding-flat.js +0 -266
  40. package/compass-rose/compass-text-writer.js +0 -173
  41. package/compass-rose/index.js +0 -3
  42. package/compassrose/compassrose.js +0 -341
  43. package/compassrose/index.js +0 -2
  44. package/depth-locator/readme.md +0 -26
  45. package/globe-types.ts +0 -13
  46. package/heatwave/index.js +0 -4
  47. package/heatwave/isobar/objectarraylabels.js +0 -247
  48. package/heatwave/isobar/plugin.js +0 -340
  49. package/heatwave/isobar/quadtreecontours.js +0 -336
  50. package/heatwave/plugins/heatwaveglobeshell.js +0 -258
  51. package/jest.config.js +0 -6
  52. package/partialrings/buffer-manager.js +0 -89
  53. package/partialrings/goals.md +0 -17
  54. package/partialrings/index.js +0 -3
  55. package/partialrings/plugin.js +0 -160
  56. package/partialrings/program.js +0 -324
  57. package/pin/pin-object-array.js +0 -381
  58. package/pin/pin-point-totem.js +0 -77
  59. package/point-heat-map/adaptors/timetracksplugin-format-to-this.js +0 -78
  60. package/point-heat-map/index.js +0 -0
  61. package/point-heat-map/plugin-webworker.js +0 -151
  62. package/point-heat-map/point-to-heat-map-flow.js +0 -150
  63. package/point-heat-map/readme.md +0 -15
  64. package/point-tracks/key-methods.js +0 -3
  65. package/point-tracks/plugin.js +0 -394
  66. package/programs/arrowfield/index.js +0 -2
  67. package/programs/arrowfield/logic.js +0 -286
  68. package/programs/arrowfield/object.js +0 -89
  69. package/programs/data2legend/density-to-legend.js +0 -115
  70. package/programs/data2legend/point-to-density-texture.js +0 -114
  71. package/programs/float2legendwithratio/index.js +0 -3
  72. package/programs/float2legendwithratio/logic.js +0 -194
  73. package/programs/float2legendwithratio/object.js +0 -141
  74. package/programs/globe-util/is-globe-moved.js +0 -27
  75. package/programs/globeshell/index.js +0 -2
  76. package/programs/globeshell/noise/noises.js +0 -0
  77. package/programs/globeshell/wiggle/index.js +0 -6
  78. package/programs/globeshell/wiggle/logic.js +0 -371
  79. package/programs/globeshell/wiggle/object.js +0 -93
  80. package/programs/helpers/blender/index.js +0 -0
  81. package/programs/helpers/blender/program.js +0 -91
  82. package/programs/helpers/fadeaway/index.js +0 -3
  83. package/programs/helpers/fadeaway/logic.js +0 -76
  84. package/programs/helpers/fadeaway/object.js +0 -20
  85. package/programs/helpers/index.js +0 -2
  86. package/programs/index.js +0 -21
  87. package/programs/interface.ts +0 -7
  88. package/programs/line-on-globe/angled-line.js +0 -206
  89. package/programs/line-on-globe/circle-accurate-3d.js +0 -167
  90. package/programs/line-on-globe/circle-accurate-flat.js +0 -262
  91. package/programs/line-on-globe/circle-accurate.js +0 -202
  92. package/programs/line-on-globe/circle.js +0 -191
  93. package/programs/line-on-globe/degree-padding-around-circle-3d.js +0 -188
  94. package/programs/line-on-globe/index.js +0 -0
  95. package/programs/line-on-globe/lines-color-instanced-flat.js +0 -151
  96. package/programs/line-on-globe/linestrip.ts +0 -228
  97. package/programs/line-on-globe/naive-accurate-flexible.js +0 -239
  98. package/programs/line-on-globe/to-the-surface.js +0 -129
  99. package/programs/line-on-globe/util.js +0 -8
  100. package/programs/picking/pickable-renderer.js +0 -216
  101. package/programs/point-on-globe/element-globe-surface-glow.js +0 -168
  102. package/programs/point-on-globe/element-point-glow.js +0 -184
  103. package/programs/point-on-globe/square-pixel-point.js +0 -189
  104. package/programs/programcache.ts +0 -131
  105. package/programs/rings/distancering/circleflatprogram.js +0 -136
  106. package/programs/rings/distancering/circlepaddingfreeangleprogram.js +0 -378
  107. package/programs/rings/distancering/circlepaddysharedbuffer.js +0 -420
  108. package/programs/rings/distancering/index.js +0 -5
  109. package/programs/rings/distancering/paddyflatprogram.js +0 -146
  110. package/programs/rings/distancering/paddyflatprogram2d.js +0 -150
  111. package/programs/rings/distancering/paddyflatprogram3d.js +0 -146
  112. package/programs/rings/distancering/shader.js +0 -0
  113. package/programs/rings/index.js +0 -1
  114. package/programs/rings/partial-ring/piece-of-pie.js +0 -315
  115. package/programs/totems/camerauniformblock.d.ts +0 -48
  116. package/programs/totems/camerauniformblock.js +0 -197
  117. package/programs/totems/canvas-webglobe-info.js +0 -136
  118. package/programs/totems/gpu-selection-uniform-block.js +0 -132
  119. package/programs/totems/index.ts +0 -2
  120. package/programs/two-d/pixel-circle.js +0 -0
  121. package/programs/two-d/pixel-padding-for-compass.js +0 -174
  122. package/programs/util.js +0 -20
  123. package/programs/vectorfields/index.js +0 -3
  124. package/programs/vectorfields/logics/drawrectangleparticles.js +0 -125
  125. package/programs/vectorfields/logics/index.js +0 -5
  126. package/programs/vectorfields/logics/pixelbased.js +0 -161
  127. package/programs/vectorfields/logics/ubo.js +0 -64
  128. package/programs/vectorfields/pingpongbuffermanager.js +0 -80
  129. package/publish.bat +0 -60
  130. package/rangerings/enum.js +0 -3
  131. package/rangerings/index.js +0 -5
  132. package/rangerings/plugin.js +0 -649
  133. package/rangerings/rangeringangletext.js +0 -368
  134. package/rangerings/ring-account.js +0 -129
  135. package/shaders/fragment-toy/firework.js +0 -55
  136. package/shaders/fragment-toy/singularity.js +0 -59
  137. package/shape-on-terrain/arc/naive/plugin.ts +0 -304
  138. package/shape-on-terrain/goal.md +0 -12
  139. package/tests/Math/junction/arc-plane.test.ts +0 -133
  140. package/tests/Math/junction/plane-plane.test.ts +0 -82
  141. package/tests/Math/plane.test.ts +0 -43
  142. package/tests/Math/vec3.test.ts +0 -14
  143. package/timetracks/adaptors-line-strip.js +0 -80
  144. package/timetracks/adaptors.js +0 -133
  145. package/timetracks/index.js +0 -6
  146. package/timetracks/plugin-line-strip.js +0 -295
  147. package/timetracks/plugin.js +0 -304
  148. package/timetracks/program-line-strip.js +0 -688
  149. package/timetracks/program.js +0 -850
  150. package/timetracks/programpoint-line-strip.js +0 -175
  151. package/timetracks/programpoint.js +0 -168
  152. package/timetracks/readme.md +0 -1
  153. package/tsconfig.json +0 -22
  154. package/types.ts +0 -17
  155. package/util/account/bufferoffsetmanager.js +0 -209
  156. package/util/account/index.js +0 -6
  157. package/util/account/single-attribute-buffer-management/buffer-manager.ts +0 -119
  158. package/util/account/single-attribute-buffer-management/buffer-orchestrator.ts +0 -173
  159. package/util/account/single-attribute-buffer-management/index.ts +0 -13
  160. package/util/account/single-attribute-buffer-management/object-store.ts +0 -65
  161. package/util/account/single-attribute-buffer-management/types.ts +0 -39
  162. package/util/account/util.js +0 -22
  163. package/util/algorithms/index.js +0 -0
  164. package/util/algorithms/search-binary.js +0 -26
  165. package/util/check/get.js +0 -13
  166. package/util/check/index.js +0 -0
  167. package/util/check/typecheck.js +0 -39
  168. package/util/geometry/index.js +0 -53
  169. package/util/gl-util/buffer/attribute-loader.ts +0 -85
  170. package/util/gl-util/buffer/index.ts +0 -6
  171. package/util/gl-util/buffer/types.ts +0 -13
  172. package/util/gl-util/draw-options/methods.ts +0 -66
  173. package/util/gl-util/draw-options/types.ts +0 -28
  174. package/util/gl-util/uniform-block/manager.ts +0 -187
  175. package/util/gl-util/uniform-block/roadmap.md +0 -70
  176. package/util/gl-util/uniform-block/shader.js +0 -0
  177. package/util/gl-util/uniform-block/types.ts +0 -27
  178. package/util/heatwavedatamanager/datamanager.js +0 -168
  179. package/util/heatwavedatamanager/index.js +0 -3
  180. package/util/heatwavedatamanager/pointcoordinatesdatacalculator.js +0 -133
  181. package/util/heatwavedatamanager/pointcoordsmeta.js +0 -22
  182. package/util/index.js +0 -13
  183. package/util/interpolation/index.js +0 -0
  184. package/util/interpolation/timetrack/index.js +0 -9
  185. package/util/interpolation/timetrack/timetrack-interpolator.js +0 -88
  186. package/util/interpolation/timetrack/web-worker-str.js +0 -180
  187. package/util/interpolation/timetrack/web-worker.js +0 -51
  188. package/util/jshelpers/data-filler.js +0 -19
  189. package/util/jshelpers/equality.js +0 -17
  190. package/util/jshelpers/index.js +0 -1
  191. package/util/jshelpers/timefilters.js +0 -32
  192. package/util/picking/fence.js +0 -46
  193. package/util/picking/picker-displayer.js +0 -177
  194. package/util/programs/draw-texture-on-canvas.js +0 -102
  195. package/util/programs/index.js +0 -1
  196. package/util/programs/shapesonglobe.js +0 -246
  197. package/util/programs/supersampletotextures.js +0 -142
  198. package/util/programs/texturetoglobe.js +0 -203
  199. package/util/shaderfunctions/geometrytransformations.ts +0 -388
  200. package/util/shaderfunctions/index.js +0 -2
  201. package/util/shaderfunctions/nodata.js +0 -10
  202. package/util/shaderfunctions/noisefunctions.js +0 -44
  203. package/util/surface-line-data/arc-bboxes.ts +0 -42
  204. package/util/surface-line-data/arcs-to-cuts.js +0 -74
  205. package/util/surface-line-data/cut-arc.js +0 -0
  206. package/util/surface-line-data/flow.ts +0 -52
  207. package/util/surface-line-data/rbush-manager.js +0 -0
  208. package/util/surface-line-data/types.ts +0 -27
  209. package/util/surface-line-data/web-worker.js +0 -0
  210. package/util/webglobe/gldefaultstates.js +0 -5
  211. package/util/webglobe/index.js +0 -2
  212. package/util/webglobe/rasteroverlay.js +0 -96
  213. package/util/webglobjectbuilders.ts +0 -456
  214. package/util/webglobjectbuilders1.js +0 -271
  215. package/waveparticles/adaptor.js +0 -16
  216. package/waveparticles/index.js +0 -3
  217. package/waveparticles/plugin.js +0 -313
  218. package/wind/imagetovectorfieldandmagnitude.js +0 -39
  219. package/wind/index.js +0 -5
  220. package/wind/plugin.js +0 -1057
  221. package/wind/vectorfieldimage.js +0 -27
  222. package/write-text/attached-text-writer.js +0 -105
  223. package/write-text/context-text.js +0 -125
  224. package/write-text/context-text3.js +0 -178
  225. package/write-text/index.js +0 -1
  226. package/write-text/writer-plugin.js +0 -7
@@ -1,388 +0,0 @@
1
- // Z in kolometers
2
- //
3
-
4
-
5
-
6
- export const POLE = `
7
- #ifndef POLE
8
- #define POLE 20037508.34
9
- #endif
10
- `;
11
-
12
- export const R = `
13
- #ifndef R
14
- #define R 6378137.0
15
- #endif
16
- `;
17
-
18
- export const PI = `
19
- #ifndef PI
20
- #define PI 3.141592653589793
21
-
22
- #endif
23
- `;
24
-
25
- export const POLE_BY_PI = `
26
- #ifndef POLE_BY_PI
27
- #define POLE_BY_PI 6378137.0
28
- #endif
29
- `;
30
-
31
- export const R_3D = `
32
- #ifndef R_3D
33
- #define R_3D 6378.137
34
- #endif
35
- `;
36
-
37
- export const pixelXYToCartesian3DPoint = R_3D + PI + `
38
- vec3 pixelXYToCartesian3DPoint( vec3 position) {
39
- float longRad = PI * (2.0 * position.x - 1.0);
40
- float latRad = PI * position.y;
41
- float radius = R_3D + position.z;
42
- float x = radius * sin(latRad) * cos(longRad);
43
- float y = radius * sin(latRad) * sin(longRad);
44
- float z = radius * cos(latRad);
45
- return vec3(x, y, z);
46
- }
47
- `;
48
-
49
- export const pixelXYToCartesian2DPoint = PI + POLE + POLE_BY_PI + `
50
- vec2 pixelXYToCartesian2DPoint( vec2 position, vec2 translate, vec2 mapWH, vec2 screenWH) {
51
- float x = (2.0 * position.x - 1.0) * POLE;
52
- x = ((x - translate.x) / mapWH.x) * screenWH.x;
53
- float y = log( tan( ( 1.0 - position.y ) * PI / 2.0 ) ) * POLE_BY_PI;
54
- y = (1.0 - (y - translate.y) / mapWH.y) * screenWH.y;
55
- return vec2(x, y);
56
- }
57
- `;
58
-
59
- // TODO: rename it to mercatorXYToGLPosition
60
- export const mercatorXYToGLPosition = `
61
- vec4 mercatorXYToGLPosition( vec2 position) { // projection, translate, mapWH, screenWH comes from camera uniform block
62
- float x = (( position.x - translate.x ) / mapWH.x) * screenWH.x;
63
- float y = (1.0 - (position.y - translate.y) / mapWH.y) * screenWH.y;
64
- return projection * vec4(x, y, 0.0, 1.0);
65
- }
66
- `;
67
-
68
- export const cartesian3DToGLPosition = `
69
- vec4 cartesian3DToGLPosition( vec3 position) {
70
- return projection * view * vec4(position - translate, 1.0);
71
- }
72
- `
73
-
74
-
75
- // pi / pole = 2 / R
76
-
77
- export const longLatRadToMercator = R + PI + `
78
- vec2 longLatRadToMercator( vec2 longLatRad) {
79
- float x = R * longLatRad.x;
80
- float y = R * log( tan( PI / 4.0 + longLatRad.y / 2.0 ) );
81
- y -= mix(-60.0, 60.0, abs(longLatRad.y + PI / 8.0) / (PI / 4.0));
82
- return vec2(x, y);
83
- }
84
- `;
85
-
86
-
87
- export const longLatRadToCartesian3D = R_3D + `
88
- vec3 longLatRadToCartesian3D( vec2 longLat) {
89
- float x = R_3D * cos(longLat.y) * cos(longLat.x);
90
- float y = R_3D * cos(longLat.y) * sin(longLat.x);
91
- float z = R_3D * sin(longLat.y);
92
- return vec3(x, y, z);
93
- }
94
- `;
95
-
96
- export const longLatRadToCartesian3DWithR = `
97
- vec3 longLatRadToCartesian3DWithR( vec2 longLat, float radius) {
98
- float x = radius * cos(longLat.y) * cos(longLat.x);
99
- float y = radius * cos(longLat.y) * sin(longLat.x);
100
- float z = radius * sin(longLat.y);
101
- return vec3(x, y, z);
102
- }
103
- `;
104
-
105
- // TODO: Make it precise. It doesnt use haversine formula. If this changes, change the formmula which calculates text position.
106
- export const circleLimpFromLongLatRadCenterCartesian3D = R + `
107
- vec3 circleLimpFromLongLatRadCenterCartesian3D( vec2 center, float radius, float angle) {
108
- vec3 geoW = longLatRadToCartesian3D(center);
109
- vec3 normal = normalize(geoW);
110
- vec3 tangent1 = cross(normal, vec3(0.0, 0.0, -1.0));
111
- if ( length(tangent1) < 0.1 ){ tangent1 = cross(normal, vec3(0.0, -1.0, 0.0)); }
112
- tangent1 = normalize(tangent1);
113
- // rotate tangent with given angle
114
- tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);
115
- float radius_in_angle = radius/R;
116
- float projected_radius = sin(radius_in_angle) * R / 1000.0;
117
- return (geoW * cos(radius_in_angle))+ tangent1 * projected_radius;
118
- }
119
- `;
120
-
121
-
122
-
123
- // TODO: Make it precise. Y axis is not correct.
124
-
125
- export const circleLimpFromLongLatRadCenterMercatorRealDistanceNew = PI + `
126
- vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle) {
127
- float ang = angle + PI / 2.0; // Shift angle to align with +x axis
128
- float r = radius / R;
129
- float cos_r = cos(r);
130
- float sin_r = sin(r);
131
-
132
- float sin_lat = sin(center.y) * cos_r + cos(center.y) * sin_r * cos(ang);
133
- float lat = asin(sin_lat);
134
-
135
- float delta_long = atan(sin(ang) * sin_r * cos(center.y), cos_r - sin(center.y) * sin_lat);
136
- float longi = center.x + delta_long;
137
-
138
-
139
- return vec2(
140
- R * longi,
141
- R * log(tan(PI / 4.0 + lat / 2.0))
142
- );
143
- }`;
144
-
145
-
146
- export const circleLimpFromLongLatRadCenterMercatorRealDistance = PI + `
147
- vec2 circleLimpFromLongLatRadCenterMercatorRealDistance(vec2 center, float radius, float angle){
148
- float ang = angle + PI / 2.0; // this is there because the other methods are implemented in, angle 0 is +x axis orientatation
149
- float r = radius / R;
150
- float sin_lat = sin(center.y) * cos(r) + cos(center.y) * sin(r) * cos(ang);
151
- float lat = asin(sin_lat);
152
- float longi = center.x + atan(sin(ang) * sin(r) * cos(center.y), cos(r) - sin(center.y) * sin_lat);
153
- return longLatRadToMercator(vec2(longi, lat));
154
- }
155
- `;
156
-
157
- // TODO: reconstruct this function
158
- export const circleLimpFromLongLatRadCenterMercatorRealDistancePadding = `
159
- vec2 circleLimpFromLongLatRadCenterMercatorRealDistancePadding(vec2 center, float radius, float angle){
160
- float radius_radian = radius / R;
161
- float new_angle;
162
- if (angle != - 1.5707963267948966192313216916398) {
163
- float section = floor(angle / (PI / 2.0)) + 1.0;
164
- float lat = center.y - radius_radian * sin(angle);
165
- float scale = 1.0 / abs(cos(lat));
166
- new_angle = atan(tan(angle) * scale);
167
- if (section == 2.0) {
168
- new_angle = mod(new_angle, PI);
169
- } else if (section == 3.0) {
170
- new_angle = new_angle + PI;
171
- }
172
- } else {
173
- new_angle = angle;
174
- }
175
- float new_lat = center.y - radius_radian * sin(new_angle);
176
- float new_scale = 1.0 / abs(cos(new_lat));
177
-
178
- vec2 center_ = longLatRadToMercator(center);
179
- float x = center_.x + new_scale * radius * cos(new_angle);
180
- float y = center_.y - new_scale * radius * sin(new_angle);
181
- return vec2(x, y);
182
- }
183
- `
184
-
185
-
186
- export const circleLimpFromLongLatRadCenterMercatorCompass = `
187
- vec2 circleLimpFromLongLatRadCenterMercatorCompass(vec2 center, float radius, float angle){
188
- vec2 center_ = longLatRadToMercator(center);
189
- float y = -sin(angle) * radius + center_.y;
190
- float x = cos(angle) * radius + center_.x;
191
- return vec2(x, y);
192
- } `;
193
-
194
-
195
- // Function to convert Cartesian coordinates back to spherical (latitude, longitude)
196
- export const cartesianToSpherical = `
197
- vec2 cartesianToSpherical(vec3 point) {
198
- float lat = degrees(asin(point.z)); // Latitude
199
- float lon = degrees(atan(point.y, point.x)); // Longitude
200
-
201
- return vec2(lat, lon);
202
- } `;
203
-
204
- // Main function to calculate an intermediate point
205
-
206
-
207
-
208
- export const angleBetweenTwoPointsRadian = `
209
- float angleBetweenTwoPointsRadian(vec2 start_, vec2 end_) {
210
- float start_lat = log(tan((1.0 - start_.y) * PI / 2.0));
211
- float end_lat = log(tan((1.0 - end_.y) * PI / 2.0));
212
- float angle = atan((end_lat - start_lat) / (end_.x - start_.x));
213
- return angle;
214
- }
215
- `
216
-
217
- export const circleCircumferenceInterPolationOf2PointsRadian = `
218
- float circleCircumferenceInterPolationOf2PointsRadian(vec2 center, vec2 target, float bearing_angle, float ratio) {
219
- vec2 t = target - center;
220
- float mainAngle = atan(t.x, t.y);
221
- float angle = mainAngle - * ratio;
222
- return angle;
223
- }
224
- `
225
-
226
-
227
-
228
-
229
- export const realDistanceOnSphereR1 = `
230
- float realDistanceOnSphereR1(vec2 longLat1, vec2 longLat2) {
231
- float dLat = longLat2.y - longLat1.y;
232
- float dLong = longLat2.x - longLat1.x;
233
- float a = sin(dLat / 2.0) * sin(dLat / 2.0) + cos(longLat1.y) * cos(longLat2.y) * sin(dLong / 2.0) * sin(dLong / 2.0);
234
- float c = 2.0 * atan(sqrt(a), sqrt(1.0 - a));
235
- return c;
236
- }
237
- `;
238
-
239
-
240
-
241
- const pointsOnSphereBetween = `
242
- vec3 pointsOnSphereBetween(vec3 a, vec3 b, float ratio) {
243
- // Normalize the input points to ensure they are on the unit sphere
244
- a = normalize(a);
245
- b = normalize(b);
246
-
247
- // Compute the dot product and clamp it to avoid numerical issues
248
- // float dotProduct = clamp(dot(a, b), -1.0, 1.0);
249
-
250
- // Compute the angle between the points
251
- float theta = acos(dot(a, b));
252
-
253
- // Handle the edge case where the points are nearly identical
254
- if (theta < 0.0001) {
255
- return normalize(mix(a, b, ratio)); // Linear interpolation as fallback
256
- }
257
-
258
- // Compute the interpolated point using spherical linear interpolation (slerp)
259
- float sinTheta = sin(theta);
260
- float factorA = sin((1.0 - ratio) * theta) / sinTheta;
261
- float factorB = sin(ratio * theta) / sinTheta;
262
-
263
- vec3 result = factorA * a + factorB * b;
264
-
265
- // Return the normalized result to ensure it lies on the sphere
266
- return normalize(result);
267
- }`;
268
-
269
-
270
- const slerp = `
271
- ${pointsOnSphereBetween}
272
- vec3 slerp(vec3 A, vec3 B, float t) {
273
- return pointsOnSphereBetween(A, B, t) * mix(length(A), length(B), t);
274
- }
275
- `
276
-
277
- const circleLimpFromLongLatRadCenterCartesian3D_accurate = R + `
278
- vec3 circleLimpFromLongLatRadCenterCartesian3D_accurate( vec3 geoW, float radius, float angle) {
279
- vec3 normal = normalize(geoW);
280
- vec3 tangent1 = cross(normal, vec3(0.0, 0.0, -1.0));
281
- if ( length(tangent1) < 0.1 ){ tangent1 = cross(normal, vec3(0.0, -1.0, 0.0)); }
282
- tangent1 = normalize(tangent1);
283
- // rotate tangent with given angle
284
- tangent1 = cos(angle) * tangent1 - sin(angle) * cross(normal, tangent1);
285
- float radius_in_angle = radius/R;
286
- float projected_radius = sin(radius_in_angle) * R / 1000.0;
287
- return (geoW * cos(radius_in_angle)) + tangent1 * projected_radius;
288
- }`;
289
-
290
-
291
- const circleOnSphere = `
292
- vec3 rotateVectorAroundAxis(vec3 v, vec3 axis, float angle) {
293
- float c = cos(angle);
294
- float s = sin(angle);
295
- float t = 1.0 - c;
296
- vec3 normalizedAxis = normalize(axis); // Ensure axis is unit length
297
-
298
- return vec3(
299
- (t * normalizedAxis.x * normalizedAxis.x + c) * v.x +
300
- (t * normalizedAxis.x * normalizedAxis.y - s * normalizedAxis.z) * v.y +
301
- (t * normalizedAxis.x * normalizedAxis.z + s * normalizedAxis.y) * v.z,
302
-
303
- (t * normalizedAxis.x * normalizedAxis.y + s * normalizedAxis.z) * v.x +
304
- (t * normalizedAxis.y * normalizedAxis.y + c) * v.y +
305
- (t * normalizedAxis.y * normalizedAxis.z - s * normalizedAxis.x) * v.z,
306
-
307
- (t * normalizedAxis.x * normalizedAxis.z - s * normalizedAxis.y) * v.x +
308
- (t * normalizedAxis.y * normalizedAxis.z + s * normalizedAxis.x) * v.y +
309
- (t * normalizedAxis.z * normalizedAxis.z + c) * v.z
310
- );
311
-
312
- // Alternative, more compact way using cross and dot products:
313
- // vec3 crossProd = cross(normalizedAxis, v);
314
- // float dotProd = dot(normalizedAxis, v);
315
- // return v * c + crossProd * s + normalizedAxis * dotProd * t;
316
- }
317
-
318
- /**
319
- * @brief Calculates a point on a circle drawn on the surface of a sphere.
320
- * The sphere is assumed to be centered at the origin (0,0,0).
321
- * The circle's center on the sphere surface is M, and H is a starting point on the circle.
322
- * The function returns the point obtained by rotating H around the axis defined by M by angle A.
323
- *
324
- * @param M The center point of the circle on the sphere's surface. The vector from the origin to M defines the rotation axis.
325
- * @param H A starting point on the circle (also on the sphere's surface).
326
- * @param A The angle of rotation in radians. Use radians(degrees) if your input is in degrees.
327
- * @return A vec3 representing the calculated point on the sphere's surface.
328
- */
329
- vec3 circleOnSphere(vec3 M, vec3 H, float A) {
330
- // The rotation axis is the vector from the origin to the circle's center point M on the sphere.
331
- // This axis vector needs to be normalized for the rotation formula.
332
- vec3 rotationAxis = normalize(M);
333
-
334
- // Rotate the starting point H around the rotation axis by angle A.
335
- vec3 rotatedPoint = rotateVectorAroundAxis(H, rotationAxis, A);
336
-
337
- // Optional but recommended: Re-normalize the result to ensure it stays exactly on the sphere's surface,
338
- // counteracting potential floating-point inaccuracies, especially if the original sphere radius was 1.
339
- // If the sphere has a different radius R, you might want to normalize and multiply by R:
340
- // float radius = length(M); // Assuming M is exactly on the surface
341
- // return normalize(rotatedPoint) * radius;
342
- // If it's a unit sphere:
343
- // return normalize(rotatedPoint);
344
-
345
- // For simplicity, returning the direct result of rotation. Assume M and H were perfectly on the sphere.
346
- return rotatedPoint;
347
- }`;
348
-
349
- const circleLimpFromLongLatRadCenterMercatorCompass_accurate = `
350
- vec2 circleLimpFromLongLatRadCenterMercatorCompass_accurate(vec2 center, float radius, float angle){
351
- float y = -sin(angle) * radius + center.y;
352
- float x = cos(angle) * radius + center.x;
353
- return vec2(x, y);
354
- } `;
355
-
356
- //TODO make it work...
357
- const circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate = PI + `
358
- vec2 circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate(vec2 mercator_center, float radius, float angle) {
359
- vec2 center = vec2(mercator_center.x /6378137.0 , asin(tanh(mercator_center.y / 6378137.0 )));
360
- float ang = angle + PI / 2.0; // Shift angle to align with +x axis
361
- float r = radius / R;
362
- float cos_r = cos(r);
363
- float sin_r = sin(r);
364
-
365
- float sin_lat = sin(center.y) * cos_r + cos(center.y) * sin_r * cos(ang);
366
- float lat = asin(sin_lat);
367
-
368
- float delta_long = atan(sin(ang) * sin_r * cos(center.y), cos_r - sin(center.y) * sin_lat);
369
- float longi = center.x + delta_long;
370
- // float y = mix(-80.5, 80.5, abs(center.y + PI / 2.0));
371
- vec2 limp = vec2(
372
- R * longi,
373
- R * log(tan(PI / 4.0 + lat / 2.0))
374
- );
375
- vec2 center_mercator = vec2(
376
- R * center.x,
377
- R * log(tan(PI/4.0+ center.y / 2.0))
378
- );
379
- return mercator_center - center_mercator + limp;
380
- }`;
381
-
382
- export {
383
- slerp,
384
- circleLimpFromLongLatRadCenterCartesian3D_accurate,
385
- circleLimpFromLongLatRadCenterMercatorCompass_accurate,
386
- circleLimpFromLongLatRadCenterMercatorRealDistanceNew_accurate,
387
- circleOnSphere,
388
- }
@@ -1,2 +0,0 @@
1
- export * from './geometrytransformations';
2
- export * from './nodata';
@@ -1,10 +0,0 @@
1
- const vertexIDtoTextureCoordinate = `
2
- vec2 vertexIDtoTextureCoordinate(float id, vec2 textureDimentions) {
3
- float x = mod(id, textureDimentions.x);
4
- float y = floor(id / textureDimentions.x);
5
- return vec2( x / textureDimentions.x, y / textureDimentions.y);
6
- }
7
- `;
8
-
9
-
10
- export {vertexIDtoTextureCoordinate};
@@ -1,44 +0,0 @@
1
- const permute34 = ```vec3 permute34(vec3 x) {
2
- x = ((x * 34.0) + 1.0) * x;
3
- return x - floor(x * (1.0 / 289.0)) * 289.0;
4
- }```;
5
-
6
- const waveNoice = ```float waveNoice(vec2 v)
7
- {
8
- const vec4 C = vec4(0.211324865405187, 0.366025403784439, -0.577350269189626, 0.024390243902439);
9
-
10
- vec2 i = floor(v + dot(v, C.yy));
11
- vec2 x0 = v - i + dot(i, C.xx);
12
-
13
- vec2 i1;
14
- i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
15
-
16
- vec4 x12 = x0.xyxy + C.xxzz;
17
- x12.xy -= i1;
18
-
19
- i = i - floor(i * (1.0 / 289.0)) * 289.0;
20
-
21
- vec3 p = permute(permute(i.y + vec3(0.0, i1.y, 1.0))
22
- + i.x + vec3(0.0, i1.x, 1.0));
23
-
24
- vec3 m = max(0.5 - vec3(dot(x0, x0), dot(x12.xy, x12.xy), dot(x12.zw, x12.zw)), 0.0);
25
- m = m * m;
26
- m = m * m;
27
-
28
- vec3 x = 2.0 * fract(p * C.www) - 1.0;
29
- vec3 h = abs(x) - 0.5;
30
- vec3 ox = floor(x + 0.5);
31
- vec3 a0 = x - ox;
32
-
33
- m *= inversesqrt(a0 * a0 + h * h);
34
-
35
- vec3 g;
36
- g.x = a0.x * x0.x + h.x * x0.y;
37
- g.yz = a0.yz * x12.xz + h.yz * x12.yw;
38
- return 130.0 * dot(m, g);
39
- }```;
40
-
41
-
42
- export default {
43
- permute34, waveNoice
44
- }
@@ -1,42 +0,0 @@
1
-
2
-
3
- // function naiveBBox(a: number[], b: number[]): BBox {
4
- // return {
5
- // minX: Math.min(a[0], b[0]),
6
- // minY: Math.min(a[1], b[1]),
7
- // maxX: Math.max(a[0], b[0]),
8
- // maxY: Math.max(a[1], b[1])
9
- // };
10
-
11
- // }
12
-
13
-
14
- // function slerp(a: Vector, b: Vector, t: number, theta: number, sinTheta: number): Vector {
15
-
16
- // }
17
-
18
-
19
- // function getArcBBoxes(arc: Arc, dotStep: number = 0.025): BBox[] {
20
- // const start = arc.start;
21
- // const end = arc.end;
22
- // const a = [start[0], start[1], start[2]];
23
- // const b = [end[0], end[1], end[2]];
24
-
25
-
26
-
27
-
28
- // const theta = Math.acos(a[0] * b[0] + a[1] * b[1] + a[2] * b[2]);
29
- // const step = dotStep / theta;
30
-
31
- // if (step >= 1) {
32
- // return [naiveBBox(start, end)];
33
- // }
34
-
35
-
36
- // let points = [start] as Vector[];
37
-
38
-
39
- // let currentStep =
40
-
41
- // return bbox;
42
- // }
@@ -1,74 +0,0 @@
1
-
2
-
3
-
4
-
5
- class ArcsToCutsManager {
6
-
7
- constructor(rbush, { dotDistanceOfArcCuts = 0.01 }) {
8
-
9
- this._map = new Map();
10
- this._dotDistanceOfArcCuts = dotDistanceOfArcCuts;
11
- this._rbush = rbush;
12
- }
13
-
14
-
15
-
16
- insertArcs(arc) {
17
-
18
- if (this._map.has(arc.id)) {
19
- this._deleteCuts(arc.id);
20
- }
21
-
22
-
23
- }
24
-
25
- _deleteCuts(id) {
26
- const cuts = this._map.get(id);
27
- if (cuts) {
28
- cuts.forEach(cut => cut.remove());
29
- }
30
- }
31
-
32
-
33
- _cutArcAndAddToRBush(arc) {
34
- const cuts = this._cutArcToBBoxs(arc);
35
- cuts.forEach(cut => {
36
- this._rbush.insert(cut);
37
- });
38
- this._map.set(arc.id, cuts);
39
- }
40
-
41
-
42
- _cutArcToBBoxs(arc) {
43
- const cuts = [];
44
-
45
- // Calculate the bounding box of the arc
46
-
47
-
48
- // Create a cut object and add it to the cuts array
49
- const cut = {
50
- minX: bbox.minX,
51
- minY: bbox.minY,
52
- maxX: bbox.maxX,
53
- maxY: bbox.maxY,
54
- arcId: arc.id,
55
- };
56
-
57
- cuts.push(cut);
58
- return cuts;
59
- }
60
- }
61
-
62
-
63
-
64
- function sphericalLinearInterpolation(phi1, lambda1, phi2, lambda2, t) {
65
- // Spherical linear interpolation between two points on a sphere
66
- // Args: phi1, lambda1: starting point (in radians)
67
- // phi2, lambda2: ending point (in radians)
68
- // t: interpolation parameter (0 <= t <= 1)
69
- // Returns: [phi, lambda] in radians
70
-
71
- const phi = phi1 + t * (phi2 - phi1);
72
- const lambda = lambda1 + t * (lambda2 - lambda1);
73
- return [phi, lambda];
74
- }
File without changes
@@ -1,52 +0,0 @@
1
-
2
-
3
-
4
-
5
- // class FlowManager {
6
- // _populateCount: number;
7
- // _rbush: RBush<any>;
8
- // _arcToCutsManager: ArcToCutsManager;
9
- // consturctor({ populateCount = 36, dotDistanceOfArcCuts = 1 / Math.pow(2, 10 - 1) }) {
10
- // this._populateCount = populateCount;
11
-
12
- // // does the cutting and id mapping(one to many)
13
- // // cuts have their bbox ready for rbush
14
- // this._rbush = new RBush(1000);
15
- // this._arcToCutsManager = new ArcToCutsManager({ dotDistanceOfArcCuts, rbush: this._rbush }); // 10km
16
-
17
- // }
18
-
19
-
20
-
21
-
22
-
23
- // /**
24
- // * adds or updates an arc in the rbush and the cuts manager
25
- // */
26
- // insertArc(arc: Arc) {
27
- // this._arcToCutsManager.insertArc(arc);
28
-
29
- // }
30
-
31
-
32
-
33
- // deleteArc(id: Arc['id']) {
34
- // this._arcToCutsManager.deleteArc(id);
35
- // }
36
-
37
-
38
- // queryBBox(bbox: BBox) {
39
-
40
- // const arcIDSet = new Set(this._rbush.query(bbox).map(x => x.id)); // sets Of ids of arcs
41
-
42
- // // arcs U bbox => arcs
43
-
44
-
45
- // // populate points
46
- // // return typed array of points belonging to all the arcs of cuts
47
- // }
48
-
49
-
50
-
51
-
52
- // }
File without changes
@@ -1,27 +0,0 @@
1
- type BBox = {
2
- minX: number;
3
- minY: number;
4
- maxX: number;
5
- maxY: number;
6
- id?: string;
7
- }
8
-
9
- type Point = { lon: number, lat: number };
10
- type Vector = [number, number, number]; // x y z
11
-
12
-
13
- type Arc = {
14
- id: string;
15
- start: number[];
16
- end: number[];
17
- };
18
-
19
-
20
- interface RBUSH {
21
- insert: (item: BBox) => void;
22
- remove: (item: BBox) => void;
23
- search: (bbox: BBox) => BBox[];
24
- clear: () => void;
25
- all: () => BBox[];
26
-
27
- }
File without changes
@@ -1,5 +0,0 @@
1
-
2
- export function defaultblendfunction(gl) {
3
- gl.blendEquation(gl.FUNC_ADD); // TODO: TESTING THIS
4
- gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA);
5
- }
@@ -1,2 +0,0 @@
1
- export * from './rasteroverlay';
2
- export * from './gldefaultstates';