@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
package/package.json CHANGED
@@ -1,10 +1,13 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.9.6",
3
+ "version": "0.9.7",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
7
7
  "scripts": {
8
8
  "build": "tsc"
9
- }
9
+ },
10
+ "files": [
11
+ "dist"
12
+ ]
10
13
  }
@@ -1,14 +0,0 @@
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 };
package/Math/arc.ts DELETED
@@ -1,76 +0,0 @@
1
- import { Vec3, Plane, Arc } from "./types";
2
-
3
- import { vec3 } from "./vec3";
4
- import { EPSILON } from "./constants";
5
-
6
- const _0vector = /*@__PURE__*/ vec3.create(0, 0, 0);
7
- const _1vector = /*@__PURE__*/ vec3.create(1, 1, 1);
8
-
9
- export const arc = Object.freeze({
10
- create(p0: Vec3, p1: Vec3): Arc {
11
- const normal = vec3.create(0, 0, 0);
12
- vec3.cross(normal, p0, p1);
13
- const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]] as Vec3;
14
- vec3.normalize(coverPlaneNormal, coverPlaneNormal);
15
- const dot = vec3.dot(coverPlaneNormal, p0);
16
- return {
17
- p0: vec3.clone(p0),
18
- p1: vec3.clone(p1),
19
- normal: vec3.clone(normal),
20
- coverPlane: {
21
- normal: coverPlaneNormal,
22
- distance: dot
23
- } as Plane
24
- }
25
- },
26
-
27
- set(out: Arc, p0: Vec3, p1: Vec3) {
28
- vec3.copy(out.p0, p0);
29
- vec3.copy(out.p1, p1);
30
- vec3.cross(out.normal, p0, p1);
31
- const coverPlaneNormal = [p0[0] + p1[0], p0[1] + p1[1], p0[2] + p1[2]] as Vec3;
32
- vec3.normalize(coverPlaneNormal, coverPlaneNormal);
33
- out.coverPlane.normal = coverPlaneNormal;
34
- out.coverPlane.distance = vec3.dot(coverPlaneNormal, p0);
35
- },
36
-
37
-
38
- copy(out: Arc, a: Arc) {
39
- vec3.copy(out.p0, a.p0);
40
- vec3.copy(out.p1, a.p1);
41
- vec3.copy(out.normal, a.normal);
42
- out.coverPlane.normal = vec3.clone(a.coverPlane.normal);
43
- out.coverPlane.distance = a.coverPlane.distance;
44
- },
45
-
46
- clone(a: Arc): Arc {
47
- return {
48
- p0: vec3.clone(a.p0),
49
- p1: vec3.clone(a.p1),
50
- normal: vec3.clone(a.normal),
51
- coverPlane: {
52
- normal: vec3.clone(a.coverPlane.normal),
53
- distance: a.coverPlane.distance
54
- } as Plane
55
- };
56
- },
57
-
58
-
59
-
60
- isPointOn(arc: Arc, point: Vec3): boolean {
61
- const alignment = Math.abs(vec3.dot(point, arc.normal)) < EPSILON;
62
- const distance = Math.abs(vec3.lengthSquared(point) - 1) < EPSILON;
63
- const cover = vec3.dot(arc.coverPlane.normal, point) >= arc.coverPlane.distance;
64
- return alignment || distance || cover;
65
- },
66
-
67
-
68
- equals(a: Arc, b: Arc): boolean {
69
- return vec3.equals(a.p0, b.p0) && vec3.equals(a.p1, b.p1)
70
- },
71
-
72
- populatePoints(out: Float32Array, arc: Arc, count: number) {
73
- // rotate p0 around normal vector with a quaternion
74
- // calculate angle
75
- }
76
- });
@@ -1,225 +0,0 @@
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
-
package/Math/constants.ts DELETED
@@ -1,11 +0,0 @@
1
- const WORLD_RADIUS_3D = 6378.137;
2
- const WORLD_RADIUS_MERCATOR = 6378136.99911;
3
-
4
- const EPSILON = 1e-10; // Used for floating point comparisons
5
-
6
- export {
7
- WORLD_RADIUS_3D,
8
- WORLD_RADIUS_MERCATOR,
9
- EPSILON
10
- }
11
-
@@ -1,32 +0,0 @@
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,63 +0,0 @@
1
- // import { Plane } from "../plane";
2
- // import { Vector3D } from "../vector3d";
3
- // import { WORLD_RADIUS_3D } from "../constants";
4
- // import { Quaternion } from "../quaternion";
5
-
6
- // import { FrustumPlanes } from "./types";
7
-
8
- // const _quaternion = new Quaternion();
9
-
10
- // export function getFrustum(globe: any, fieldOfView: number = 50 * Math.PI / 180,
11
- // out: FrustumPlanes): void {
12
-
13
- // const lookinfo = globe.api_GetCurrentLookInfo();
14
- // lookinfo.CenterLong *= Math.PI / 180; // convert degrees to radians
15
- // lookinfo.CenterLat *= Math.PI / 180; // convert degrees to radians
16
- // lookinfo.NorthAng *= Math.PI / 180; // convert degrees to radians
17
-
18
- // const lookAtPosition = Vector3D.fromLongLatRadians(lookinfo.CenterLong, lookinfo.CenterLat);
19
- // const cameraPosition = new Vector3D(globe.Fp.x, globe.Fp.y, globe.Fp.z).divideByScaler(WORLD_RADIUS_3D);
20
- // const lookFromCamera = lookAtPosition.clone().subtract(cameraPosition).normalize();
21
-
22
-
23
- // const cameraZ = new Vector3D(globe.Fu.x, globe.Fu.y, globe.Fu.z);
24
- // const cameraY = cameraZ.clone().cross(lookFromCamera).normalize();
25
-
26
- // const bottomNormal = cameraZ.clone().applyQuaternion(
27
- // _quaternion.setFromAxisAngle(cameraY, -fieldOfView)
28
- // ).normalize();
29
-
30
- // const topNormal = cameraZ.clone().applyQuaternion(
31
- // _quaternion.setFromAxisAngle(cameraY, fieldOfView)
32
- // ).negate().normalize();
33
- // const leftNormal = cameraY.clone().applyQuaternion(
34
- // _quaternion.setFromAxisAngle(cameraZ, fieldOfView)
35
- // ).negate().normalize();
36
-
37
- // const rightNormal = cameraY.clone().applyQuaternion(
38
- // _quaternion.setFromAxisAngle(cameraZ, -fieldOfView)
39
- // ).normalize();
40
-
41
-
42
- // out.top.set(topNormal, topNormal.dot(cameraPosition));
43
- // out.bottom.set(bottomNormal, bottomNormal.dot(cameraPosition));
44
- // out.left.set(leftNormal, leftNormal.dot(cameraPosition));
45
- // out.right.set(rightNormal, rightNormal.dot(cameraPosition));
46
- // out.far.set(cameraPosition.normalize(), 0.01);
47
- // out.near = null; // Near plane is not calculated in this function, set to null
48
- // vectorInfo(globe, [out]);
49
-
50
- // }
51
-
52
- // let interval = 0;
53
-
54
- // const vectorInfo = (globe, args: null | Array<any>) => {
55
- // interval++;
56
- // if (interval % 100 === 0) {
57
- // console.log("Fp:", globe.Fp.x / WORLD_RADIUS_3D, globe.Fp.y / WORLD_RADIUS_3D, globe.Fp.z / WORLD_RADIUS_3D);
58
- // console.log("Fu:", globe.Fu.x, globe.Fu.y, globe.Fu.z);
59
-
60
- // if (args) console.log(...args)
61
- // interval = 0;
62
- // }
63
- // }
@@ -1,11 +0,0 @@
1
- import { Plane } from "../types";
2
-
3
- export type FrustumPlanes =
4
- {
5
- top: Plane,
6
- bottom: Plane,
7
- left: Plane,
8
- right: Plane,
9
- near: Plane | null,
10
- far: Plane
11
- };
@@ -1,137 +0,0 @@
1
- // TODO: REMOVE
2
-
3
- // // import { Vector3D, Quaternion, Plane, Ray, Matrix4 } from 'your-3d-math-library'; // <-- ADAPT THIS IMPORT
4
-
5
- // import { Vector3D } from '../vector3d';
6
- // import { Plane } from '../plane';
7
- // import { Line } from '../line';
8
- // import { Matrix4 } from '../matrix4';
9
- // import { Quaternion } from '../quaternion';
10
-
11
- // // --- Assume these static helper variables exist within your class ---
12
- // const _lookFromOrigin = new Vector3D();
13
- // const _cameraPosition = new Vector3D();
14
- // const _finalForward = new Vector3D();
15
- // const _approxUp = new Vector3D();
16
- // const _finalRight = new Vector3D();
17
- // const _finalUp = new Vector3D();
18
- // const _tempVec = new Vector3D(); // General purpose helper
19
- // const _initialBottomRayDir = new Vector3D();
20
- // const _qOrient = new Quaternion();
21
- // const _rollQuaternion = new Quaternion();
22
- // const _rotationMatrix = new Matrix4();
23
- // const _fieldOfViewBottomRay = new Line(new Vector3D(), new Vector3D());
24
- // const _origin3d = new Vector3D(0, 0, 0); // Globe Center
25
-
26
- // // --- Assume these constants exist ---
27
- // const WORLD_RADIUS_3D = 6371000; // Example: Earth radius
28
- // const FIELD_OF_VIEW = (25 * Math.PI) / 180; // Example: 25 degrees half-FOV in radians
29
-
30
- // // // --- Assume Plane class has these methods ---
31
- // // interface Plane {
32
- // // setFromNormalAndPoint(normal: Vector3D, point: Vector3D): this;
33
- // // set(normal: Vector3D, constant: number): this;
34
- // // // ... other plane methods
35
- // // }
36
-
37
- // // // --- Assume Ray class has these methods ---
38
- // // interface Ray {
39
- // // origin: Vector3D;
40
- // // direction: Vector3D;
41
- // // intersectionSphere(center: Vector3D, radius: number): Vector3D[] | null; // Or similar
42
- // // // ... other ray methods
43
- // // }
44
-
45
- // // // --- Assume Vector3D has setFromLongLat ---
46
- // // interface Vector3D {
47
- // // setFromLongLat(lon: number, lat: number): this;
48
- // // // ... other vector methods
49
- // // }
50
- // // // --- END OF ASSUMPTIONS ---
51
-
52
-
53
- // /**
54
- // * Calculates a culling plane representing the bottom edge of the camera's field of view.
55
- // * @param globe - The globe object, expected to have api_GetCurrentLookInfo and Fp properties.
56
- // * @param out - The Plane object to store the result.
57
- // * @param fieldOfView - The vertical half-angle of the field of view in radians.
58
- // * @returns The calculated Plane.
59
- // */
60
- // function calculateHorizonPlane(globe: any, out: Plane, fieldOfView: number = FIELD_OF_VIEW): Plane {
61
-
62
- // const cameraLookInfo = globe.api_GetCurrentLookInfo();
63
- // cameraLookInfo.CenterLong *= Math.PI / 180;
64
- // cameraLookInfo.CenterLat *= Math.PI / 180;
65
- // // cameraLookInfo.Tilt *= Math.PI / 180; // Tilt is now implicitly handled
66
- // cameraLookInfo.NorthAng *= Math.PI / 180;
67
-
68
- // // Set _lookFromOrigin based on camera target (Lon/Lat)
69
- // (_lookFromOrigin as any).setFromLongLat(cameraLookInfo.CenterLong, cameraLookInfo.CenterLat); // Cast to any if setFromLongLat is custom
70
-
71
- // // 1. Calculate _cameraPosition and _finalForward (_lookFromCamera)
72
- // _cameraPosition.set(globe.Fp.x, globe.Fp.y, globe.Fp.z); // Using your X negation
73
- // _cameraPosition.divideScalar(WORLD_RADIUS_3D); // Scale to unit sphere
74
-
75
- // Vector3D.subVectors(_lookFromOrigin, _cameraPosition, _finalForward).normalize();
76
-
77
- // // 2. Calculate Q_orient (Final Camera Orientation Quaternion)
78
-
79
- // // Use the vector from origin to camera as an initial 'up' reference
80
- // _approxUp.copy(_cameraPosition).normalize();
81
-
82
- // // Calculate Right vector using cross product
83
- // Vector3D.crossVectors(_finalForward, _approxUp, _finalRight).normalize();
84
-
85
- // // Handle edge case: If looking straight along (or opposite to) _approxUp
86
- // if (_finalRight.lengthSq() < 0.0001) {
87
- // // If vectors are parallel, _approxUp is not good.
88
- // // Choose a different 'up', e.g., if _approxUp is near Z, use Y.
89
- // if (Math.abs(_approxUp.z) > 0.9) {
90
- // _approxUp.set(0, 1, 0);
91
- // } else {
92
- // _approxUp.set(0, 0, 1);
93
- // }
94
- // Vector3D.crossVectors(_finalForward, _approxUp, _finalRight).normalize();
95
- // }
96
-
97
- // // Calculate the 'true' Up vector, orthogonal to Right and Forward
98
- // Vector3D.crossVectors(_finalRight, _finalForward, _finalUp).normalize();
99
-
100
- // // Apply NorthAng (Roll) around the Forward axis
101
- // _rollQuaternion.setFromAxisAngle(_finalForward, cameraLookInfo.NorthAng);
102
- // _finalUp.applyQuaternion(_rollQuaternion);
103
- // _finalRight.applyQuaternion(_rollQuaternion); // Must rotate Right as well!
104
-
105
- // // Create Q_orient from the final basis vectors (Right, Up, -Forward)
106
- // // This assumes a Matrix4.makeBasis(x, y, z) exists and builds a rotation matrix.
107
- // // It also assumes local camera looks down -Z, hence negating _finalForward for the Z basis.
108
- // _tempVec.copy(_finalForward).negate();
109
- // _rotationMatrix.makeBasis(_finalRight, _finalUp, _tempVec); // <-- ADAPT: Ensure your library has makeBasis or equivalent
110
- // _qOrient.setFromRotationMatrix(_rotationMatrix); // <-- ADAPT: Ensure this function exists
111
-
112
- // // 3. Calculate Initial Bottom Ray (Local: -Z forward, Y up, X right)
113
- // // Rotates (0, 0, -1) around (1, 0, 0) by fieldOfView
114
- // _initialBottomRayDir.set(0, -Math.sin(fieldOfView), -Math.cos(fieldOfView));
115
-
116
- // // 4. Calculate Final Bottom Ray (World)
117
- // _fieldOfViewBottomRay.direction.copy(_initialBottomRayDir).applyQuaternion(_qOrient).normalize();
118
- // _fieldOfViewBottomRay.origin.copy(_cameraPosition);
119
-
120
- // // 5. Intersection and Plane
121
- // const intersection = (_fieldOfViewBottomRay as any).intersectionSphere(_origin3d, 1); // Cast to any if method isn't standard
122
-
123
- // if (intersection && intersection.length > 0) {
124
- // // If ray intersects, use the closest point for the plane
125
- // out.setFromNormalAndPoint(_lookFromOrigin, intersection[0]);
126
- // } else {
127
- // // If ray does not intersect (FOV covers globe or misses)
128
- // // WARNING: This sets a plane through the globe's center.
129
- // // This might not be the desired behavior for culling.
130
- // // Consider what should happen if the whole globe *is* visible.
131
- // out.set(_lookFromOrigin, 0.0);
132
- // }
133
-
134
- // return out;
135
- // }
136
-
137
- // export { calculateHorizonPlane };
package/Math/index.js DELETED
File without changes