@pirireis/webglobeplugins 0.9.6 → 0.9.8

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 (304) hide show
  1. package/{Math → dist/Math}/angle-calculation.js +15 -14
  2. package/dist/Math/arc.js +65 -0
  3. package/{Math → dist/Math}/bounds/line-bbox.js +188 -225
  4. package/dist/Math/constants.js +9 -0
  5. package/{Math/frustum/camera.ts → dist/Math/frustum/camera.js} +24 -32
  6. package/{Math/frustum/from-globeinfo.ts → dist/Math/frustum/from-globeinfo.js} +48 -63
  7. package/dist/Math/frustum/types.js +2 -0
  8. package/{Math/globe-util/horizon-plane.ts → dist/Math/globe-util/horizon-plane.js} +112 -137
  9. package/dist/Math/index.js +1 -0
  10. package/dist/Math/juction/arc-plane.js +83 -0
  11. package/dist/Math/juction/line-sphere.js +25 -0
  12. package/{Math/juction/plane-plane.ts → dist/Math/juction/plane-plane.js} +58 -66
  13. package/dist/Math/line.js +56 -0
  14. package/dist/Math/matrix4.js +1 -0
  15. package/{Math → dist/Math}/methods.js +201 -237
  16. package/dist/Math/plane.js +60 -0
  17. package/{Math/quaternion.ts → dist/Math/quaternion.js} +104 -120
  18. package/dist/Math/types.js +2 -0
  19. package/dist/Math/utils.js +4 -0
  20. package/{Math/vec3.ts → dist/Math/vec3.js} +126 -155
  21. package/dist/algorithms/search-binary.js +19 -0
  22. package/dist/altitude-locator/adaptors.js +1 -0
  23. package/{altitude-locator → dist/altitude-locator}/draw-subset-obj.js +18 -27
  24. package/dist/altitude-locator/keymethod.js +1 -0
  25. package/{altitude-locator → dist/altitude-locator}/plugin.js +341 -439
  26. package/{altitude-locator → dist/altitude-locator}/types.js +23 -26
  27. package/{arrowfield → dist/arrowfield}/adaptor.js +14 -11
  28. package/dist/arrowfield/index.js +10 -0
  29. package/{arrowfield → dist/arrowfield}/plugin.js +86 -128
  30. package/dist/bearing-line/index.js +8 -0
  31. package/{bearing-line → dist/bearing-line}/plugin.js +449 -512
  32. package/{circle-line-chain → dist/circle-line-chain}/chain-list-map.js +205 -221
  33. package/dist/circle-line-chain/init.js +1 -0
  34. package/{circle-line-chain → dist/circle-line-chain}/plugin.js +424 -469
  35. package/dist/circle-line-chain/util.js +5 -0
  36. package/{compass-rose → dist/compass-rose}/compass-rose-padding-flat.js +225 -266
  37. package/{compass-rose → dist/compass-rose}/compass-text-writer.js +153 -173
  38. package/dist/compass-rose/index.js +7 -0
  39. package/{compassrose → dist/compassrose}/compassrose.js +296 -341
  40. package/dist/compassrose/index.js +8 -0
  41. package/dist/globe-types.js +1 -0
  42. package/dist/heatwave/index.js +10 -0
  43. package/{heatwave → dist/heatwave}/isobar/objectarraylabels.js +202 -247
  44. package/{heatwave → dist/heatwave}/isobar/plugin.js +343 -340
  45. package/{heatwave → dist/heatwave}/isobar/quadtreecontours.js +300 -336
  46. package/{heatwave → dist/heatwave}/plugins/heatwaveglobeshell.js +206 -258
  47. package/dist/index.js +58 -0
  48. package/{jest.config.js → dist/jest.config.js} +7 -6
  49. package/{partialrings → dist/partialrings}/buffer-manager.js +81 -89
  50. package/dist/partialrings/index.js +41 -0
  51. package/{partialrings → dist/partialrings}/plugin.js +135 -160
  52. package/{partialrings → dist/partialrings}/program.js +204 -242
  53. package/{pin → dist/pin}/pin-object-array.js +305 -381
  54. package/{pin → dist/pin}/pin-point-totem.js +60 -77
  55. package/{point-heat-map → dist/point-heat-map}/adaptors/timetracksplugin-format-to-this.js +66 -78
  56. package/dist/point-heat-map/index.js +1 -0
  57. package/{point-heat-map → dist/point-heat-map}/plugin-webworker.js +126 -151
  58. package/{point-heat-map → dist/point-heat-map}/point-to-heat-map-flow.js +127 -150
  59. package/dist/point-tracks/key-methods.js +5 -0
  60. package/{point-tracks → dist/point-tracks}/plugin.js +338 -394
  61. package/dist/programs/arrowfield/index.js +7 -0
  62. package/{programs → dist/programs}/arrowfield/logic.js +144 -173
  63. package/{programs → dist/programs}/arrowfield/object.js +66 -89
  64. package/{programs → dist/programs}/data2legend/density-to-legend.js +76 -90
  65. package/{programs → dist/programs}/data2legend/point-to-density-texture.js +76 -90
  66. package/dist/programs/float2legendwithratio/index.js +8 -0
  67. package/{programs → dist/programs}/float2legendwithratio/logic.js +122 -145
  68. package/{programs → dist/programs}/float2legendwithratio/object.js +110 -141
  69. package/{programs → dist/programs}/globe-util/is-globe-moved.js +21 -27
  70. package/dist/programs/globeshell/index.js +8 -0
  71. package/dist/programs/globeshell/noise/noises.js +1 -0
  72. package/dist/programs/globeshell/wiggle/index.js +8 -0
  73. package/{programs → dist/programs}/globeshell/wiggle/logic.js +246 -272
  74. package/{programs → dist/programs}/globeshell/wiggle/object.js +72 -93
  75. package/dist/programs/helpers/blender/index.js +1 -0
  76. package/{programs → dist/programs}/helpers/blender/program.js +61 -73
  77. package/dist/programs/helpers/fadeaway/index.js +7 -0
  78. package/{programs → dist/programs}/helpers/fadeaway/logic.js +49 -53
  79. package/dist/programs/helpers/fadeaway/object.js +20 -0
  80. package/dist/programs/helpers/index.js +8 -0
  81. package/dist/programs/index.js +58 -0
  82. package/dist/programs/interface.js +1 -0
  83. package/{programs → dist/programs}/line-on-globe/angled-line.js +125 -155
  84. package/{programs → dist/programs}/line-on-globe/circle-accurate-3d.js +95 -121
  85. package/{programs → dist/programs}/line-on-globe/circle-accurate-flat.js +158 -204
  86. package/{programs → dist/programs}/line-on-globe/circle-accurate.js +117 -141
  87. package/{programs → dist/programs}/line-on-globe/circle.js +111 -135
  88. package/{programs → dist/programs}/line-on-globe/degree-padding-around-circle-3d.js +111 -140
  89. package/dist/programs/line-on-globe/index.js +1 -0
  90. package/{programs → dist/programs}/line-on-globe/lines-color-instanced-flat.js +91 -106
  91. package/{programs/line-on-globe/linestrip.ts → dist/programs/line-on-globe/linestrip.js} +108 -165
  92. package/{programs → dist/programs}/line-on-globe/naive-accurate-flexible.js +127 -171
  93. package/{programs → dist/programs}/line-on-globe/to-the-surface.js +83 -101
  94. package/dist/programs/line-on-globe/util.js +8 -0
  95. package/{programs → dist/programs}/picking/pickable-renderer.js +107 -135
  96. package/{programs → dist/programs}/point-on-globe/element-globe-surface-glow.js +101 -127
  97. package/{programs → dist/programs}/point-on-globe/element-point-glow.js +88 -119
  98. package/{programs → dist/programs}/point-on-globe/square-pixel-point.js +126 -141
  99. package/{programs/programcache.ts → dist/programs/programcache.js} +131 -131
  100. package/{programs → dist/programs}/rings/distancering/circleflatprogram.js +115 -95
  101. package/{programs → dist/programs}/rings/distancering/circlepaddingfreeangleprogram.js +320 -329
  102. package/{programs → dist/programs}/rings/distancering/circlepaddysharedbuffer.js +357 -420
  103. package/dist/programs/rings/distancering/index.js +14 -0
  104. package/{programs → dist/programs}/rings/distancering/paddyflatprogram.js +120 -94
  105. package/{programs → dist/programs}/rings/distancering/paddyflatprogram2d.js +122 -98
  106. package/{programs → dist/programs}/rings/distancering/paddyflatprogram3d.js +120 -94
  107. package/dist/programs/rings/distancering/shader.js +1 -0
  108. package/dist/programs/rings/index.js +17 -0
  109. package/{programs → dist/programs}/rings/partial-ring/piece-of-pie.js +181 -221
  110. package/{programs → dist/programs}/totems/camerauniformblock.js +147 -184
  111. package/{programs → dist/programs}/totems/canvas-webglobe-info.js +102 -128
  112. package/{programs → dist/programs}/totems/gpu-selection-uniform-block.js +104 -128
  113. package/dist/programs/totems/index.js +40 -0
  114. package/dist/programs/two-d/pixel-circle.js +1 -0
  115. package/{programs → dist/programs}/two-d/pixel-padding-for-compass.js +101 -113
  116. package/{programs → dist/programs}/util.js +17 -20
  117. package/dist/programs/vectorfields/index.js +23 -0
  118. package/{programs → dist/programs}/vectorfields/logics/drawrectangleparticles.js +65 -83
  119. package/dist/programs/vectorfields/logics/index.js +12 -0
  120. package/{programs → dist/programs}/vectorfields/logics/pixelbased.js +84 -103
  121. package/{programs → dist/programs}/vectorfields/logics/ubo.js +55 -56
  122. package/{programs → dist/programs}/vectorfields/pingpongbuffermanager.js +76 -80
  123. package/dist/rangerings/enum.js +5 -0
  124. package/dist/rangerings/index.js +15 -0
  125. package/{rangerings → dist/rangerings}/plugin.js +560 -649
  126. package/{rangerings → dist/rangerings}/rangeringangletext.js +329 -368
  127. package/{rangerings → dist/rangerings}/ring-account.js +117 -129
  128. package/{shaders → dist/shaders}/fragment-toy/firework.js +5 -2
  129. package/{shaders → dist/shaders}/fragment-toy/singularity.js +5 -5
  130. package/{shape-on-terrain/arc/naive/plugin.ts → dist/shape-on-terrain/arc/naive/plugin.js} +252 -304
  131. package/{timetracks → dist/timetracks}/adaptors-line-strip.js +71 -80
  132. package/{timetracks → dist/timetracks}/adaptors.js +122 -133
  133. package/dist/timetracks/index.js +19 -0
  134. package/{timetracks → dist/timetracks}/plugin-line-strip.js +250 -295
  135. package/{timetracks → dist/timetracks}/plugin.js +258 -304
  136. package/{timetracks → dist/timetracks}/program-line-strip.js +416 -493
  137. package/{timetracks → dist/timetracks}/program.js +464 -542
  138. package/{timetracks → dist/timetracks}/programpoint-line-strip.js +101 -122
  139. package/{timetracks → dist/timetracks}/programpoint.js +101 -122
  140. package/{types.ts → dist/types.js} +15 -17
  141. package/{util → dist/util}/account/bufferoffsetmanager.js +179 -209
  142. package/dist/util/account/index.js +23 -0
  143. package/{util/account/single-attribute-buffer-management/buffer-manager.ts → dist/util/account/single-attribute-buffer-management/buffer-manager.js} +108 -119
  144. package/{util/account/single-attribute-buffer-management/buffer-orchestrator.ts → dist/util/account/single-attribute-buffer-management/buffer-orchestrator.js} +150 -173
  145. package/dist/util/account/single-attribute-buffer-management/index.js +9 -0
  146. package/{util/account/single-attribute-buffer-management/object-store.ts → dist/util/account/single-attribute-buffer-management/object-store.js} +51 -65
  147. package/dist/util/account/single-attribute-buffer-management/types.js +2 -0
  148. package/{util → dist/util}/account/util.js +22 -22
  149. package/dist/util/algorithms/index.js +1 -0
  150. package/{util → dist/util}/algorithms/search-binary.js +28 -26
  151. package/dist/util/check/get.js +18 -0
  152. package/dist/util/check/index.js +1 -0
  153. package/dist/util/check/typecheck.js +49 -0
  154. package/{util → dist/util}/geometry/index.js +51 -53
  155. package/{util/gl-util/buffer/attribute-loader.ts → dist/util/gl-util/buffer/attribute-loader.js} +69 -85
  156. package/dist/util/gl-util/buffer/index.js +6 -0
  157. package/dist/util/gl-util/buffer/types.js +1 -0
  158. package/dist/util/gl-util/draw-options/methods.js +38 -0
  159. package/dist/util/gl-util/draw-options/types.js +15 -0
  160. package/{util/gl-util/uniform-block/manager.ts → dist/util/gl-util/uniform-block/manager.js} +156 -187
  161. package/dist/util/gl-util/uniform-block/shader.js +1 -0
  162. package/dist/util/gl-util/uniform-block/types.js +8 -0
  163. package/{util → dist/util}/heatwavedatamanager/datamanager.js +152 -168
  164. package/dist/util/heatwavedatamanager/index.js +10 -0
  165. package/{util → dist/util}/heatwavedatamanager/pointcoordinatesdatacalculator.js +122 -133
  166. package/{util → dist/util}/heatwavedatamanager/pointcoordsmeta.js +20 -22
  167. package/dist/util/index.js +57 -0
  168. package/dist/util/interpolation/index.js +1 -0
  169. package/dist/util/interpolation/timetrack/index.js +5 -0
  170. package/{util → dist/util}/interpolation/timetrack/timetrack-interpolator.js +79 -88
  171. package/{util → dist/util}/interpolation/timetrack/web-worker-str.js +5 -2
  172. package/{util → dist/util}/interpolation/timetrack/web-worker.js +48 -51
  173. package/{util → dist/util}/jshelpers/data-filler.js +20 -19
  174. package/{util → dist/util}/jshelpers/equality.js +20 -17
  175. package/dist/util/jshelpers/index.js +37 -0
  176. package/{util → dist/util}/jshelpers/timefilters.js +32 -32
  177. package/{util → dist/util}/picking/fence.js +46 -46
  178. package/{util → dist/util}/picking/picker-displayer.js +139 -177
  179. package/{util → dist/util}/programs/draw-texture-on-canvas.js +69 -82
  180. package/dist/util/programs/index.js +17 -0
  181. package/{util → dist/util}/programs/shapesonglobe.js +174 -206
  182. package/{util → dist/util}/programs/supersampletotextures.js +103 -132
  183. package/{util → dist/util}/programs/texturetoglobe.js +133 -154
  184. package/{util/shaderfunctions/geometrytransformations.ts → dist/util/shaderfunctions/geometrytransformations.js} +68 -116
  185. package/dist/util/shaderfunctions/index.js +18 -0
  186. package/{util → dist/util}/shaderfunctions/nodata.js +5 -4
  187. package/{util → dist/util}/shaderfunctions/noisefunctions.js +9 -10
  188. package/{util/surface-line-data/arc-bboxes.ts → dist/util/surface-line-data/arc-bboxes.js} +25 -42
  189. package/{util → dist/util}/surface-line-data/arcs-to-cuts.js +50 -74
  190. package/dist/util/surface-line-data/cut-arc.js +1 -0
  191. package/{util/surface-line-data/flow.ts → dist/util/surface-line-data/flow.js} +28 -52
  192. package/dist/util/surface-line-data/rbush-manager.js +1 -0
  193. package/dist/util/surface-line-data/types.js +1 -0
  194. package/dist/util/surface-line-data/web-worker.js +1 -0
  195. package/dist/util/webglobe/gldefaultstates.js +7 -0
  196. package/dist/util/webglobe/index.js +18 -0
  197. package/{util → dist/util}/webglobe/rasteroverlay.js +78 -96
  198. package/{util/webglobjectbuilders.ts → dist/util/webglobjectbuilders.js} +388 -456
  199. package/{util → dist/util}/webglobjectbuilders1.js +237 -271
  200. package/{waveparticles → dist/waveparticles}/adaptor.js +17 -16
  201. package/dist/waveparticles/index.js +10 -0
  202. package/{waveparticles → dist/waveparticles}/plugin.js +266 -313
  203. package/{wind → dist/wind}/imagetovectorfieldandmagnitude.js +35 -39
  204. package/dist/wind/index.js +14 -0
  205. package/{wind → dist/wind}/plugin.js +681 -812
  206. package/{wind → dist/wind}/vectorfieldimage.js +25 -27
  207. package/{write-text → dist/write-text}/attached-text-writer.js +91 -105
  208. package/{write-text → dist/write-text}/context-text.js +98 -125
  209. package/{write-text → dist/write-text}/context-text3.js +155 -178
  210. package/dist/write-text/index.js +5 -0
  211. package/{write-text → dist/write-text}/writer-plugin.js +8 -7
  212. package/package.json +5 -2
  213. package/Math/arc.ts +0 -76
  214. package/Math/constants.ts +0 -11
  215. package/Math/frustum/types.ts +0 -11
  216. package/Math/index.js +0 -0
  217. package/Math/juction/arc-plane.ts +0 -114
  218. package/Math/juction/line-sphere.ts +0 -30
  219. package/Math/line.ts +0 -70
  220. package/Math/matrix4.ts +0 -0
  221. package/Math/plane.ts +0 -86
  222. package/Math/roadmap.md +0 -10
  223. package/Math/types.ts +0 -45
  224. package/Math/utils.js +0 -3
  225. package/algorithms/search-binary.js +0 -14
  226. package/altitude-locator/adaptors.js +0 -0
  227. package/altitude-locator/keymethod.js +0 -0
  228. package/arrowfield/index.js +0 -3
  229. package/bearing-line/index.js +0 -2
  230. package/circle-line-chain/init.js +0 -0
  231. package/circle-line-chain/readme.md +0 -57
  232. package/circle-line-chain/util.js +0 -1
  233. package/compass-rose/index.js +0 -3
  234. package/compassrose/index.js +0 -2
  235. package/depth-locator/readme.md +0 -26
  236. package/globe-types.ts +0 -13
  237. package/heatwave/index.js +0 -4
  238. package/partialrings/goals.md +0 -17
  239. package/partialrings/index.js +0 -3
  240. package/point-heat-map/index.js +0 -0
  241. package/point-heat-map/readme.md +0 -15
  242. package/point-tracks/key-methods.js +0 -3
  243. package/programs/arrowfield/index.js +0 -2
  244. package/programs/float2legendwithratio/index.js +0 -3
  245. package/programs/globeshell/index.js +0 -2
  246. package/programs/globeshell/noise/noises.js +0 -0
  247. package/programs/globeshell/wiggle/index.js +0 -6
  248. package/programs/helpers/blender/index.js +0 -0
  249. package/programs/helpers/fadeaway/index.js +0 -3
  250. package/programs/helpers/fadeaway/object.js +0 -20
  251. package/programs/helpers/index.js +0 -2
  252. package/programs/index.js +0 -21
  253. package/programs/interface.ts +0 -7
  254. package/programs/line-on-globe/index.js +0 -0
  255. package/programs/line-on-globe/util.js +0 -8
  256. package/programs/rings/distancering/index.js +0 -5
  257. package/programs/rings/distancering/shader.js +0 -0
  258. package/programs/rings/index.js +0 -1
  259. package/programs/totems/camerauniformblock.d.ts +0 -48
  260. package/programs/totems/index.ts +0 -2
  261. package/programs/two-d/pixel-circle.js +0 -0
  262. package/programs/vectorfields/index.js +0 -3
  263. package/programs/vectorfields/logics/index.js +0 -5
  264. package/publish.bat +0 -60
  265. package/rangerings/enum.js +0 -3
  266. package/rangerings/index.js +0 -5
  267. package/shape-on-terrain/goal.md +0 -12
  268. package/tests/Math/junction/arc-plane.test.ts +0 -133
  269. package/tests/Math/junction/plane-plane.test.ts +0 -82
  270. package/tests/Math/plane.test.ts +0 -43
  271. package/tests/Math/vec3.test.ts +0 -14
  272. package/timetracks/index.js +0 -6
  273. package/timetracks/readme.md +0 -1
  274. package/tsconfig.json +0 -22
  275. package/util/account/index.js +0 -6
  276. package/util/account/single-attribute-buffer-management/index.ts +0 -13
  277. package/util/account/single-attribute-buffer-management/types.ts +0 -39
  278. package/util/algorithms/index.js +0 -0
  279. package/util/check/get.js +0 -13
  280. package/util/check/index.js +0 -0
  281. package/util/check/typecheck.js +0 -39
  282. package/util/gl-util/buffer/index.ts +0 -6
  283. package/util/gl-util/buffer/types.ts +0 -13
  284. package/util/gl-util/draw-options/methods.ts +0 -66
  285. package/util/gl-util/draw-options/types.ts +0 -28
  286. package/util/gl-util/uniform-block/roadmap.md +0 -70
  287. package/util/gl-util/uniform-block/shader.js +0 -0
  288. package/util/gl-util/uniform-block/types.ts +0 -27
  289. package/util/heatwavedatamanager/index.js +0 -3
  290. package/util/index.js +0 -13
  291. package/util/interpolation/index.js +0 -0
  292. package/util/interpolation/timetrack/index.js +0 -9
  293. package/util/jshelpers/index.js +0 -1
  294. package/util/programs/index.js +0 -1
  295. package/util/shaderfunctions/index.js +0 -2
  296. package/util/surface-line-data/cut-arc.js +0 -0
  297. package/util/surface-line-data/rbush-manager.js +0 -0
  298. package/util/surface-line-data/types.ts +0 -27
  299. package/util/surface-line-data/web-worker.js +0 -0
  300. package/util/webglobe/gldefaultstates.js +0 -5
  301. package/util/webglobe/index.js +0 -2
  302. package/waveparticles/index.js +0 -3
  303. package/wind/index.js +0 -5
  304. package/write-text/index.js +0 -1
@@ -1,14 +1,15 @@
1
- function bearingRealAngle(long, lat, endLong, endLat) {
2
- const rLong = Radians * long;
3
- const rLat = Radians * lat;
4
- const rEndLong = Radians * endLong;
5
- const rEndLat = Radians * endLat;
6
- const delta_long = rEndLong - rLong;
7
- const x = Math.sin(delta_long) * Math.cos(rEndLat);
8
- const y = Math.cos(rLat) * Math.sin(rEndLat) - Math.sin(rLat) * Math.cos(rEndLat) * Math.cos(delta_long);
9
- let initialBearing = Math.atan2(x, y) / Radians;
10
- initialBearing = (initialBearing + 360) % 360;
11
- return initialBearing;
12
- }
13
-
14
- export { bearingRealAngle };
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.bearingRealAngle = bearingRealAngle;
4
+ function bearingRealAngle(long, lat, endLong, endLat) {
5
+ const rLong = Radians * long;
6
+ const rLat = Radians * lat;
7
+ const rEndLong = Radians * endLong;
8
+ const rEndLat = Radians * endLat;
9
+ const delta_long = rEndLong - rLong;
10
+ const x = Math.sin(delta_long) * Math.cos(rEndLat);
11
+ const y = Math.cos(rLat) * Math.sin(rEndLat) - Math.sin(rLat) * Math.cos(rEndLat) * Math.cos(delta_long);
12
+ let initialBearing = Math.atan2(x, y) / Radians;
13
+ initialBearing = (initialBearing + 360) % 360;
14
+ return initialBearing;
15
+ }
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.arc = void 0;
4
+ const vec3_1 = require("./vec3");
5
+ const constants_1 = require("./constants");
6
+ const _0vector = /*@__PURE__*/ vec3_1.vec3.create(0, 0, 0);
7
+ const _1vector = /*@__PURE__*/ vec3_1.vec3.create(1, 1, 1);
8
+ exports.arc = Object.freeze({
9
+ create(p0, p1) {
10
+ const normal = vec3_1.vec3.create(0, 0, 0);
11
+ vec3_1.vec3.cross(normal, p0, p1);
12
+ const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]];
13
+ vec3_1.vec3.normalize(coverPlaneNormal, coverPlaneNormal);
14
+ const dot = vec3_1.vec3.dot(coverPlaneNormal, p0);
15
+ return {
16
+ p0: vec3_1.vec3.clone(p0),
17
+ p1: vec3_1.vec3.clone(p1),
18
+ normal: vec3_1.vec3.clone(normal),
19
+ coverPlane: {
20
+ normal: coverPlaneNormal,
21
+ distance: dot
22
+ }
23
+ };
24
+ },
25
+ set(out, p0, p1) {
26
+ vec3_1.vec3.copy(out.p0, p0);
27
+ vec3_1.vec3.copy(out.p1, p1);
28
+ vec3_1.vec3.cross(out.normal, p0, p1);
29
+ const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]];
30
+ vec3_1.vec3.normalize(coverPlaneNormal, coverPlaneNormal);
31
+ out.coverPlane.normal = coverPlaneNormal;
32
+ out.coverPlane.distance = vec3_1.vec3.dot(coverPlaneNormal, p0);
33
+ },
34
+ copy(out, a) {
35
+ vec3_1.vec3.copy(out.p0, a.p0);
36
+ vec3_1.vec3.copy(out.p1, a.p1);
37
+ vec3_1.vec3.copy(out.normal, a.normal);
38
+ out.coverPlane.normal = vec3_1.vec3.clone(a.coverPlane.normal);
39
+ out.coverPlane.distance = a.coverPlane.distance;
40
+ },
41
+ clone(a) {
42
+ return {
43
+ p0: vec3_1.vec3.clone(a.p0),
44
+ p1: vec3_1.vec3.clone(a.p1),
45
+ normal: vec3_1.vec3.clone(a.normal),
46
+ coverPlane: {
47
+ normal: vec3_1.vec3.clone(a.coverPlane.normal),
48
+ distance: a.coverPlane.distance
49
+ }
50
+ };
51
+ },
52
+ isPointOn(arc, point) {
53
+ const alignment = Math.abs(vec3_1.vec3.dot(point, arc.normal)) < constants_1.EPSILON;
54
+ const distance = Math.abs(vec3_1.vec3.lengthSquared(point) - 1) < constants_1.EPSILON;
55
+ const cover = vec3_1.vec3.dot(arc.coverPlane.normal, point) >= arc.coverPlane.distance;
56
+ return alignment || distance || cover;
57
+ },
58
+ equals(a, b) {
59
+ return vec3_1.vec3.equals(a.p0, b.p0) && vec3_1.vec3.equals(a.p1, b.p1);
60
+ },
61
+ populatePoints(out, arc, count) {
62
+ // rotate p0 around normal vector with a quaternion
63
+ // calculate angle
64
+ }
65
+ });
@@ -1,225 +1,188 @@
1
- function isClose(a, b, rtol = 1e-5, atol = 1e-8) {
2
- // JavaScript equivalent of NumPy's isclose
3
- return Math.abs(a - b) <= (atol + rtol * Math.abs(b));
4
- }
5
-
6
- function mod(n, m) {
7
- // Proper modulo operation that handles negative numbers
8
- return ((n % m) + m) % m;
9
- }
10
-
11
- function calculateInitialBearing(phi1, lambda1, phi2, lambda2) {
12
- // Calculates the initial bearing (forward azimuth) from point 1 to point 2
13
- if (isClose(Math.cos(phi1), 0)) { // Starting from a pole
14
- if (phi1 > 0) { // North pole
15
- return Math.PI; // Bearing is South
16
- } else { // South pole
17
- return 0; // Bearing is North
18
- }
19
- }
20
-
21
- const deltaLambda = lambda2 - lambda1;
22
- const y = Math.sin(deltaLambda) * Math.cos(phi2);
23
- const x = Math.cos(phi1) * Math.sin(phi2) - Math.sin(phi1) * Math.cos(phi2) * Math.cos(deltaLambda);
24
- const theta = Math.atan2(y, x);
25
- return theta;
26
- }
27
-
28
- function getGreatCircleArcBBox(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad) {
29
- // Calculates the bounding box around the great circle arc between two points
30
- // on a spherical surface, handling edge cases like poles and antimeridian crossing.
31
- // Args: Latitudes and longitudes in radians
32
- // Returns: [phiMin, phiMax, lambdaMin, lambdaMax] in radians
33
-
34
- // === Edge Case: Same Points ===
35
- if (isClose(phi1Rad, phi2Rad) && isClose(lambda1Rad, lambda2Rad)) {
36
- return [phi1Rad, phi1Rad, lambda1Rad, lambda1Rad];
37
- }
38
-
39
- // === Edge Case: Antipodal Points ===
40
- const deltaLambdaNorm = mod(lambda1Rad - lambda2Rad + Math.PI, 2 * Math.PI) - Math.PI;
41
- if (isClose(phi1Rad, -phi2Rad) && isClose(Math.abs(deltaLambdaNorm), Math.PI)) {
42
- // Path covers all longitudes and passes through poles
43
- return [-Math.PI / 2, Math.PI / 2, -Math.PI, Math.PI];
44
- }
45
-
46
- // === Longitude Bounds ===
47
- let lambda1Adj = lambda1Rad;
48
- let lambda2Adj = lambda2Rad;
49
-
50
- // Handle antimeridian crossing
51
- let deltaLambda = lambda2Rad - lambda1Rad;
52
- if (deltaLambda > Math.PI) {
53
- deltaLambda -= 2 * Math.PI;
54
- } else if (deltaLambda <= -Math.PI) {
55
- deltaLambda += 2 * Math.PI;
56
- }
57
-
58
- const crossesAntimeridian = Math.abs(lambda2Rad - lambda1Rad) > Math.PI;
59
-
60
- if (crossesAntimeridian) {
61
- // Add 2*pi to the smaller longitude
62
- if (lambda1Rad < lambda2Rad) {
63
- lambda1Adj += 2 * Math.PI;
64
- } else {
65
- lambda2Adj += 2 * Math.PI;
66
- }
67
- }
68
-
69
- const lambdaMin = Math.min(lambda1Adj, lambda2Adj);
70
- const lambdaMax = Math.max(lambda1Adj, lambda2Adj);
71
-
72
- // === Latitude Bounds ===
73
- let phiMin = Math.min(phi1Rad, phi2Rad);
74
- let phiMax = Math.max(phi1Rad, phi2Rad);
75
-
76
- // === Vertex Check ===
77
- // Check the maximum/minimum latitude reached by the great circle
78
- const theta12 = calculateInitialBearing(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad);
79
- const theta21 = calculateInitialBearing(phi2Rad, lambda2Rad, phi1Rad, lambda1Rad);
80
-
81
- const cosPhi1 = Math.cos(phi1Rad);
82
- if (!isClose(cosPhi1, 0)) { // Starting point is not a pole
83
- // Compute the absolute latitude of the vertex
84
- const argAcos = Math.abs(Math.sin(theta12) * cosPhi1);
85
- const phiVtxAbs = Math.acos(Math.min(Math.max(argAcos, -1.0), 1.0));
86
-
87
- // Check if the path crosses the northern vertex
88
- if (isClose(theta12, 0) && phiVtxAbs > phiMax) { // Starting due north
89
- phiMax = phiVtxAbs;
90
- } else if (isClose(Math.abs(theta12), Math.PI) && -phiVtxAbs < phiMin) { // Starting due south
91
- phiMin = -phiVtxAbs;
92
- } else {
93
- // General case: Check if the path crosses the vertex
94
- const finalBearingAtP2 = mod(theta21 + Math.PI + Math.PI, 2 * Math.PI) - Math.PI;
95
-
96
- // Northern vertex check
97
- if ((-Math.PI / 2 < theta12 && theta12 < Math.PI / 2) &&
98
- !(finalBearingAtP2 >= -Math.PI / 2 && finalBearingAtP2 <= Math.PI / 2)) {
99
- if (phiVtxAbs > phiMax) {
100
- phiMax = phiVtxAbs;
101
- }
102
- }
103
-
104
- // Southern vertex check
105
- if (!(theta12 >= -Math.PI / 2 && theta12 <= Math.PI / 2) &&
106
- (-Math.PI / 2 < finalBearingAtP2 && finalBearingAtP2 < Math.PI / 2)) {
107
- if (-phiVtxAbs < phiMin) {
108
- phiMin = -phiVtxAbs;
109
- }
110
- }
111
- }
112
- }
113
-
114
- return [phiMin, phiMax, lambdaMin, lambdaMax];
115
- }
116
-
117
-
118
-
119
-
120
- // --- Example Usage ---
121
- function degreesToRadians(deg) {
122
- return deg * Math.PI / 180;
123
- }
124
-
125
- function radiansToDegrees(rad) {
126
- return rad * 180 / Math.PI;
127
- }
128
-
129
-
130
- export { getGreatCircleArcBBox };
131
-
132
- // Test Case 1: London to Tokyo
133
- const lat1Deg = 51.5, lon1Deg = -0.1;
134
- const lat2Deg = 35.7, lon2Deg = 139.7;
135
-
136
- const phi1 = degreesToRadians(lat1Deg);
137
- const lambda1 = degreesToRadians(lon1Deg);
138
- const phi2 = degreesToRadians(lat2Deg);
139
- const lambda2 = degreesToRadians(lon2Deg);
140
-
141
- const [phiMinRad, phiMaxRad, lambdaMinRad, lambdaMaxRad] = getGreatCircleArcBBox(phi1, lambda1, phi2, lambda2);
142
-
143
- const phiMinDeg = radiansToDegrees(phiMinRad);
144
- const phiMaxDeg = radiansToDegrees(phiMaxRad);
145
- const lambdaMinDeg = radiansToDegrees(lambdaMinRad);
146
- const lambdaMaxDeg = radiansToDegrees(lambdaMaxRad);
147
-
148
- console.log("Input Points (Radians):");
149
- console.log(` P1: Latitude=${lat1Deg}, Longitude=${lon1Deg}`);
150
- console.log(` P2: Latitude=${lat2Deg}, Longitude=${lon2Deg}`);
151
- console.log(` P1: Latitude=${phi1.toFixed(4)}, Longitude=${lambda1.toFixed(4)}`);
152
- console.log(` P2: Latitude=${phi2.toFixed(4)}, Longitude=${lambda2.toFixed(4)}`);
153
- console.log("-".repeat(20));
154
- console.log("Bounding Box (Radians):");
155
- // console phys://console.log(` Minimum Latitude (phi_min): ${phiMinRad.toFixed(4)}`);
156
- console.log(` Maximum Latitude (phi_max): ${phiMaxRad.toFixed(4)}`);
157
- console.log(` Minimum Longitude (lambda_min): ${lambdaMinRad.toFixed(4)}`);
158
- console.log(` Maximum Longitude (lambda_max): ${lambdaMaxRad.toFixed(4)}`);
159
- console.log("-".repeat(20));
160
- console.log("Bounding Box (Degrees):");
161
- console.log(` Minimum Latitude: ${phiMinDeg.toFixed(2)}°`);
162
- console.log(` Maximum Latitude: ${phiMaxDeg.toFixed(2)}°`);
163
- console.log(` Minimum Longitude: ${lambdaMinDeg.toFixed(2)}°`);
164
- console.log(` Maximum Longitude: ${lambdaMaxDeg.toFixed(2)}°`);
165
-
166
- // --- Antimeridian Crossing Test ---
167
- console.log("\n" + "=".repeat(30));
168
- console.log("Antimeridian Crossing Test");
169
- const lat1DegAm = -18, lon1DegAm = 178;
170
- const lat2DegAm = -14, lon2DegAm = -172;
171
-
172
- const phi1Am = degreesToRadians(lat1DegAm);
173
- const lambda1Am = degreesToRadians(lon1DegAm);
174
- const phi2Am = degreesToRadians(lat2DegAm);
175
- const lambda2Am = degreesToRadians(lon2DegAm);
176
-
177
- const [phiMinRadAm, phiMaxRadAm, lambdaMinRadAm, lambdaMaxRadAm] = getGreatCircleArcBBox(phi1Am, lambda1Am, phi2Am, lambda2Am);
178
-
179
- const phiMinDegAm = radiansToDegrees(phiMinRadAm);
180
- const phiMaxDegAm = radiansToDegrees(phiMaxRadAm);
181
- const lambdaMinDegAm = radiansToDegrees(lambdaMinRadAm);
182
- const lambdaMaxDegAm = radiansToDegrees(lambdaMaxRadAm);
183
-
184
- console.log(`Input Points (Degrees): P1=(${lat1DegAm}, ${lon1DegAm}), P2=(${lat2DegAm}, ${lon2DegAm})`);
185
- console.log("Bounding Box (Radians):");
186
- console.log(` phi_min=${phiMinRadAm.toFixed(4)}, phi_max=${phiMaxRadAm.toFixed(4)}`);
187
- console.log(` lambda_min=${lambdaMinRadAm.toFixed(4)}, lambda_max=${lambdaMaxRadAm.toFixed(4)}`);
188
- console.log("Bounding Box (Degrees):");
189
- console.log(` Min Latitude: ${phiMinDegAm.toFixed(2)}°`);
190
- console.log(` Max Latitude: ${phiMaxDegAm.toFixed(2)}°`);
191
- console.log(` Min Longitude: ${lambdaMinDegAm.toFixed(2)}° (178° expected)`);
192
- console.log(` Max Longitude: ${lambdaMaxDegAm.toFixed(2)}° (188° expected, which is -172° + 360°)`);
193
-
194
- // --- Polar Crossing Test ---
195
- console.log("\n" + "=".repeat(30));
196
- console.log("Polar Crossing Test");
197
- const lat1DegP = 80, lon1DegP = 20;
198
- const lat2DegP = 80, lon2DegP = -100;
199
-
200
- const phi1P = degreesToRadians(lat1DegP);
201
- const lambda1P = degreesToRadians(lon1DegP);
202
- const phi2P = degreesToRadians(lat2DegP);
203
- const lambda2P = degreesToRadians(lon2DegP);
204
-
205
- const [phiMinRadP, phiMaxRadP, lambdaMinRadP, lambdaMaxRadP] = getGreatCircleArcBBox(phi1P, lambda1P, phi2P, lambda2P);
206
-
207
- const phiMinDegP = radiansToDegrees(phiMinRadP);
208
- const phiMaxDegP = radiansToDegrees(phiMaxRadP);
209
- const lambdaMinDegP = radiansToDegrees(lambdaMinRadP);
210
- const lambdaMaxDegP = radiansToDegrees(lambdaMaxRadP);
211
-
212
- console.log(`Input Points (Degrees): P1=(${lat1DegP}, ${lon1DegP}), P2=(${lat2DegP}, ${lon2DegP})`);
213
- console.log("Bounding Box (Radians):");
214
- console.log(` phi_min=${phiMinRadP.toFixed(4)}, phi_max=${phiMaxRadP.toFixed(4)}`);
215
- console.log(` lambda_min=${lambdaMinRadP.toFixed(4)}, lambda_max=${lambdaMaxRadP.toFixed(4)}`);
216
- console.log("Bounding Box (Degrees):");
217
- console.log(` Min Latitude: ${phiMinDegP.toFixed(2)}°`);
218
- console.log(` Max Latitude: ${phiMaxDegP.toFixed(2)}° (Should be close to North Pole > 80°)`);
219
- console.log(` Min Longitude: ${lambdaMinDegP.toFixed(2)}°`);
220
- console.log(` Max Longitude: ${lambdaMaxDegP.toFixed(2)}°`);
221
-
222
-
223
-
224
- // --- line points intersection with bbox ---
225
-
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGreatCircleArcBBox = getGreatCircleArcBBox;
4
+ function isClose(a, b, rtol = 1e-5, atol = 1e-8) {
5
+ // JavaScript equivalent of NumPy's isclose
6
+ return Math.abs(a - b) <= (atol + rtol * Math.abs(b));
7
+ }
8
+ function mod(n, m) {
9
+ // Proper modulo operation that handles negative numbers
10
+ return ((n % m) + m) % m;
11
+ }
12
+ function calculateInitialBearing(phi1, lambda1, phi2, lambda2) {
13
+ // Calculates the initial bearing (forward azimuth) from point 1 to point 2
14
+ if (isClose(Math.cos(phi1), 0)) { // Starting from a pole
15
+ if (phi1 > 0) { // North pole
16
+ return Math.PI; // Bearing is South
17
+ }
18
+ else { // South pole
19
+ return 0; // Bearing is North
20
+ }
21
+ }
22
+ const deltaLambda = lambda2 - lambda1;
23
+ const y = Math.sin(deltaLambda) * Math.cos(phi2);
24
+ const x = Math.cos(phi1) * Math.sin(phi2) - Math.sin(phi1) * Math.cos(phi2) * Math.cos(deltaLambda);
25
+ const theta = Math.atan2(y, x);
26
+ return theta;
27
+ }
28
+ function getGreatCircleArcBBox(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad) {
29
+ // Calculates the bounding box around the great circle arc between two points
30
+ // on a spherical surface, handling edge cases like poles and antimeridian crossing.
31
+ // Args: Latitudes and longitudes in radians
32
+ // Returns: [phiMin, phiMax, lambdaMin, lambdaMax] in radians
33
+ // === Edge Case: Same Points ===
34
+ if (isClose(phi1Rad, phi2Rad) && isClose(lambda1Rad, lambda2Rad)) {
35
+ return [phi1Rad, phi1Rad, lambda1Rad, lambda1Rad];
36
+ }
37
+ // === Edge Case: Antipodal Points ===
38
+ const deltaLambdaNorm = mod(lambda1Rad - lambda2Rad + Math.PI, 2 * Math.PI) - Math.PI;
39
+ if (isClose(phi1Rad, -phi2Rad) && isClose(Math.abs(deltaLambdaNorm), Math.PI)) {
40
+ // Path covers all longitudes and passes through poles
41
+ return [-Math.PI / 2, Math.PI / 2, -Math.PI, Math.PI];
42
+ }
43
+ // === Longitude Bounds ===
44
+ let lambda1Adj = lambda1Rad;
45
+ let lambda2Adj = lambda2Rad;
46
+ // Handle antimeridian crossing
47
+ let deltaLambda = lambda2Rad - lambda1Rad;
48
+ if (deltaLambda > Math.PI) {
49
+ deltaLambda -= 2 * Math.PI;
50
+ }
51
+ else if (deltaLambda <= -Math.PI) {
52
+ deltaLambda += 2 * Math.PI;
53
+ }
54
+ const crossesAntimeridian = Math.abs(lambda2Rad - lambda1Rad) > Math.PI;
55
+ if (crossesAntimeridian) {
56
+ // Add 2*pi to the smaller longitude
57
+ if (lambda1Rad < lambda2Rad) {
58
+ lambda1Adj += 2 * Math.PI;
59
+ }
60
+ else {
61
+ lambda2Adj += 2 * Math.PI;
62
+ }
63
+ }
64
+ const lambdaMin = Math.min(lambda1Adj, lambda2Adj);
65
+ const lambdaMax = Math.max(lambda1Adj, lambda2Adj);
66
+ // === Latitude Bounds ===
67
+ let phiMin = Math.min(phi1Rad, phi2Rad);
68
+ let phiMax = Math.max(phi1Rad, phi2Rad);
69
+ // === Vertex Check ===
70
+ // Check the maximum/minimum latitude reached by the great circle
71
+ const theta12 = calculateInitialBearing(phi1Rad, lambda1Rad, phi2Rad, lambda2Rad);
72
+ const theta21 = calculateInitialBearing(phi2Rad, lambda2Rad, phi1Rad, lambda1Rad);
73
+ const cosPhi1 = Math.cos(phi1Rad);
74
+ if (!isClose(cosPhi1, 0)) { // Starting point is not a pole
75
+ // Compute the absolute latitude of the vertex
76
+ const argAcos = Math.abs(Math.sin(theta12) * cosPhi1);
77
+ const phiVtxAbs = Math.acos(Math.min(Math.max(argAcos, -1.0), 1.0));
78
+ // Check if the path crosses the northern vertex
79
+ if (isClose(theta12, 0) && phiVtxAbs > phiMax) { // Starting due north
80
+ phiMax = phiVtxAbs;
81
+ }
82
+ else if (isClose(Math.abs(theta12), Math.PI) && -phiVtxAbs < phiMin) { // Starting due south
83
+ phiMin = -phiVtxAbs;
84
+ }
85
+ else {
86
+ // General case: Check if the path crosses the vertex
87
+ const finalBearingAtP2 = mod(theta21 + Math.PI + Math.PI, 2 * Math.PI) - Math.PI;
88
+ // Northern vertex check
89
+ if ((-Math.PI / 2 < theta12 && theta12 < Math.PI / 2) &&
90
+ !(finalBearingAtP2 >= -Math.PI / 2 && finalBearingAtP2 <= Math.PI / 2)) {
91
+ if (phiVtxAbs > phiMax) {
92
+ phiMax = phiVtxAbs;
93
+ }
94
+ }
95
+ // Southern vertex check
96
+ if (!(theta12 >= -Math.PI / 2 && theta12 <= Math.PI / 2) &&
97
+ (-Math.PI / 2 < finalBearingAtP2 && finalBearingAtP2 < Math.PI / 2)) {
98
+ if (-phiVtxAbs < phiMin) {
99
+ phiMin = -phiVtxAbs;
100
+ }
101
+ }
102
+ }
103
+ }
104
+ return [phiMin, phiMax, lambdaMin, lambdaMax];
105
+ }
106
+ // --- Example Usage ---
107
+ function degreesToRadians(deg) {
108
+ return deg * Math.PI / 180;
109
+ }
110
+ function radiansToDegrees(rad) {
111
+ return rad * 180 / Math.PI;
112
+ }
113
+ // Test Case 1: London to Tokyo
114
+ const lat1Deg = 51.5, lon1Deg = -0.1;
115
+ const lat2Deg = 35.7, lon2Deg = 139.7;
116
+ const phi1 = degreesToRadians(lat1Deg);
117
+ const lambda1 = degreesToRadians(lon1Deg);
118
+ const phi2 = degreesToRadians(lat2Deg);
119
+ const lambda2 = degreesToRadians(lon2Deg);
120
+ const [phiMinRad, phiMaxRad, lambdaMinRad, lambdaMaxRad] = getGreatCircleArcBBox(phi1, lambda1, phi2, lambda2);
121
+ const phiMinDeg = radiansToDegrees(phiMinRad);
122
+ const phiMaxDeg = radiansToDegrees(phiMaxRad);
123
+ const lambdaMinDeg = radiansToDegrees(lambdaMinRad);
124
+ const lambdaMaxDeg = radiansToDegrees(lambdaMaxRad);
125
+ console.log("Input Points (Radians):");
126
+ console.log(` P1: Latitude=${lat1Deg}, Longitude=${lon1Deg}`);
127
+ console.log(` P2: Latitude=${lat2Deg}, Longitude=${lon2Deg}`);
128
+ console.log(` P1: Latitude=${phi1.toFixed(4)}, Longitude=${lambda1.toFixed(4)}`);
129
+ console.log(` P2: Latitude=${phi2.toFixed(4)}, Longitude=${lambda2.toFixed(4)}`);
130
+ console.log("-".repeat(20));
131
+ console.log("Bounding Box (Radians):");
132
+ // console phys://console.log(` Minimum Latitude (phi_min): ${phiMinRad.toFixed(4)}`);
133
+ console.log(` Maximum Latitude (phi_max): ${phiMaxRad.toFixed(4)}`);
134
+ console.log(` Minimum Longitude (lambda_min): ${lambdaMinRad.toFixed(4)}`);
135
+ console.log(` Maximum Longitude (lambda_max): ${lambdaMaxRad.toFixed(4)}`);
136
+ console.log("-".repeat(20));
137
+ console.log("Bounding Box (Degrees):");
138
+ console.log(` Minimum Latitude: ${phiMinDeg.toFixed(2)}°`);
139
+ console.log(` Maximum Latitude: ${phiMaxDeg.toFixed(2)}°`);
140
+ console.log(` Minimum Longitude: ${lambdaMinDeg.toFixed(2)}°`);
141
+ console.log(` Maximum Longitude: ${lambdaMaxDeg.toFixed(2)}°`);
142
+ // --- Antimeridian Crossing Test ---
143
+ console.log("\n" + "=".repeat(30));
144
+ console.log("Antimeridian Crossing Test");
145
+ const lat1DegAm = -18, lon1DegAm = 178;
146
+ const lat2DegAm = -14, lon2DegAm = -172;
147
+ const phi1Am = degreesToRadians(lat1DegAm);
148
+ const lambda1Am = degreesToRadians(lon1DegAm);
149
+ const phi2Am = degreesToRadians(lat2DegAm);
150
+ const lambda2Am = degreesToRadians(lon2DegAm);
151
+ const [phiMinRadAm, phiMaxRadAm, lambdaMinRadAm, lambdaMaxRadAm] = getGreatCircleArcBBox(phi1Am, lambda1Am, phi2Am, lambda2Am);
152
+ const phiMinDegAm = radiansToDegrees(phiMinRadAm);
153
+ const phiMaxDegAm = radiansToDegrees(phiMaxRadAm);
154
+ const lambdaMinDegAm = radiansToDegrees(lambdaMinRadAm);
155
+ const lambdaMaxDegAm = radiansToDegrees(lambdaMaxRadAm);
156
+ console.log(`Input Points (Degrees): P1=(${lat1DegAm}, ${lon1DegAm}), P2=(${lat2DegAm}, ${lon2DegAm})`);
157
+ console.log("Bounding Box (Radians):");
158
+ console.log(` phi_min=${phiMinRadAm.toFixed(4)}, phi_max=${phiMaxRadAm.toFixed(4)}`);
159
+ console.log(` lambda_min=${lambdaMinRadAm.toFixed(4)}, lambda_max=${lambdaMaxRadAm.toFixed(4)}`);
160
+ console.log("Bounding Box (Degrees):");
161
+ console.log(` Min Latitude: ${phiMinDegAm.toFixed(2)}°`);
162
+ console.log(` Max Latitude: ${phiMaxDegAm.toFixed(2)}°`);
163
+ console.log(` Min Longitude: ${lambdaMinDegAm.toFixed(2)}° (178° expected)`);
164
+ console.log(` Max Longitude: ${lambdaMaxDegAm.toFixed(2)}° (188° expected, which is -172° + 360°)`);
165
+ // --- Polar Crossing Test ---
166
+ console.log("\n" + "=".repeat(30));
167
+ console.log("Polar Crossing Test");
168
+ const lat1DegP = 80, lon1DegP = 20;
169
+ const lat2DegP = 80, lon2DegP = -100;
170
+ const phi1P = degreesToRadians(lat1DegP);
171
+ const lambda1P = degreesToRadians(lon1DegP);
172
+ const phi2P = degreesToRadians(lat2DegP);
173
+ const lambda2P = degreesToRadians(lon2DegP);
174
+ const [phiMinRadP, phiMaxRadP, lambdaMinRadP, lambdaMaxRadP] = getGreatCircleArcBBox(phi1P, lambda1P, phi2P, lambda2P);
175
+ const phiMinDegP = radiansToDegrees(phiMinRadP);
176
+ const phiMaxDegP = radiansToDegrees(phiMaxRadP);
177
+ const lambdaMinDegP = radiansToDegrees(lambdaMinRadP);
178
+ const lambdaMaxDegP = radiansToDegrees(lambdaMaxRadP);
179
+ console.log(`Input Points (Degrees): P1=(${lat1DegP}, ${lon1DegP}), P2=(${lat2DegP}, ${lon2DegP})`);
180
+ console.log("Bounding Box (Radians):");
181
+ console.log(` phi_min=${phiMinRadP.toFixed(4)}, phi_max=${phiMaxRadP.toFixed(4)}`);
182
+ console.log(` lambda_min=${lambdaMinRadP.toFixed(4)}, lambda_max=${lambdaMaxRadP.toFixed(4)}`);
183
+ console.log("Bounding Box (Degrees):");
184
+ console.log(` Min Latitude: ${phiMinDegP.toFixed(2)}°`);
185
+ console.log(` Max Latitude: ${phiMaxDegP.toFixed(2)}° (Should be close to North Pole > 80°)`);
186
+ console.log(` Min Longitude: ${lambdaMinDegP.toFixed(2)}°`);
187
+ console.log(` Max Longitude: ${lambdaMaxDegP.toFixed(2)}°`);
188
+ // --- line points intersection with bbox ---
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EPSILON = exports.WORLD_RADIUS_MERCATOR = exports.WORLD_RADIUS_3D = void 0;
4
+ const WORLD_RADIUS_3D = 6378.137;
5
+ exports.WORLD_RADIUS_3D = WORLD_RADIUS_3D;
6
+ const WORLD_RADIUS_MERCATOR = 6378136.99911;
7
+ exports.WORLD_RADIUS_MERCATOR = WORLD_RADIUS_MERCATOR;
8
+ const EPSILON = 1e-10; // Used for floating point comparisons
9
+ exports.EPSILON = EPSILON;
@@ -1,32 +1,24 @@
1
- // import { WORLD_RADIUS_3D } from '../constants';
2
- // import { Plane } from '../plane';
3
- // import { Vector3D } from '../vector3d';
4
- // import { Quaternion } from '../quaternion';
5
-
6
-
7
- // function cameraFrustum(
8
-
9
- // globe: any,
10
- // out: {
11
- // near: Plane,
12
- // far: Plane,
13
- // left: Plane,
14
- // right: Plane,
15
- // top: Plane,
16
- // bottom: Plane
17
- // },
18
- // fieldOfView: number = 50 // in degrees
19
-
20
- // ): void {
21
-
22
- // const lookinfo = globe.api_GetCurrentLookInfo();
23
-
24
- // lookinfo.CenterLong *= Math.PI / 180; // convert degrees to radians
25
- // lookinfo.CenterLat *= Math.PI / 180; // convert degrees to radians
26
-
27
- // const lookAtPosition = Vector3D.fromLongLatRadians(lookinfo.CenterLong, lookinfo.CenterLat);
28
-
29
- // const cameraPosition = new Vector3D(globe.Fp.x, globe.Fp.y, globe.Fp.z).divideByScaler(WORLD_RADIUS_3D);
30
-
31
- // return
32
- // }
1
+ "use strict";
2
+ // import { WORLD_RADIUS_3D } from '../constants';
3
+ // import { Plane } from '../plane';
4
+ // import { Vector3D } from '../vector3d';
5
+ // import { Quaternion } from '../quaternion';
6
+ // function cameraFrustum(
7
+ // globe: any,
8
+ // out: {
9
+ // near: Plane,
10
+ // far: Plane,
11
+ // left: Plane,
12
+ // right: Plane,
13
+ // top: Plane,
14
+ // bottom: Plane
15
+ // },
16
+ // fieldOfView: number = 50 // in degrees
17
+ // ): void {
18
+ // const lookinfo = globe.api_GetCurrentLookInfo();
19
+ // lookinfo.CenterLong *= Math.PI / 180; // convert degrees to radians
20
+ // lookinfo.CenterLat *= Math.PI / 180; // convert degrees to radians
21
+ // const lookAtPosition = Vector3D.fromLongLatRadians(lookinfo.CenterLong, lookinfo.CenterLat);
22
+ // const cameraPosition = new Vector3D(globe.Fp.x, globe.Fp.y, globe.Fp.z).divideByScaler(WORLD_RADIUS_3D);
23
+ // return
24
+ // }