@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,120 +0,0 @@
1
- import { Vec3, Quaternion } from './types';
2
- import { vec3 } from './vec3';
3
- import { EPSILON } from './constants';
4
-
5
- export const quaternion = Object.freeze({
6
- create(x = 0, y = 0, z = 0, w = 1): Quaternion {
7
- return [x, y, z, w];
8
- },
9
-
10
- set(out: Quaternion, x: number, y: number, z: number, w: number) {
11
- out[0] = x;
12
- out[1] = y;
13
- out[2] = z;
14
- out[3] = w;
15
- },
16
-
17
- copy(out: Quaternion, a: Quaternion) {
18
- out[0] = a[0];
19
- out[1] = a[1];
20
- out[2] = a[2];
21
- out[3] = a[3];
22
- },
23
-
24
- clone(a: Quaternion): Quaternion {
25
- return [a[0], a[1], a[2], a[3]];
26
- },
27
-
28
-
29
- multiply(out: Quaternion, a: Quaternion, b: Quaternion): Quaternion {
30
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
31
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
32
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
33
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
34
- this.set(out, x, y, z, w);
35
- return out;
36
- },
37
-
38
- randomUnit(out: Quaternion): Quaternion {
39
- const u1 = Math.random();
40
- const u2 = Math.random();
41
- const u3 = Math.random();
42
- const sqrt1MinusU1 = Math.sqrt(1 - u1);
43
- const sqrtU1 = Math.sqrt(u1);
44
- const x = sqrt1MinusU1 * Math.sin(2 * Math.PI * u2);
45
- const y = sqrt1MinusU1 * Math.cos(2 * Math.PI * u2);
46
- const z = sqrtU1 * Math.sin(2 * Math.PI * u3);
47
- const w = sqrtU1 * Math.cos(2 * Math.PI * u3);
48
- this.set(out, x, y, z, w);
49
- this.normalize(out, out);
50
- return out;
51
- },
52
-
53
- rotateQuaternion(out: Quaternion, a: Quaternion, b: Quaternion) {
54
- const x = a[0] * b[3] + a[3] * b[0] + a[1] * b[2] - a[2] * b[1];
55
- const y = a[1] * b[3] + a[3] * b[1] + a[2] * b[0] - a[0] * b[2];
56
- const z = a[2] * b[3] + a[3] * b[2] + a[0] * b[1] - a[1] * b[0];
57
- const w = a[3] * b[3] - a[0] * b[0] - a[1] * b[1] - a[2] * b[2];
58
- this.set(out, x, y, z, w);
59
- this.normalize(out, out);
60
- },
61
-
62
- lengthSquared(a: Quaternion): number {
63
- return a[0] * a[0] + a[1] * a[1] + a[2] * a[2] + a[3] * a[3];
64
- },
65
-
66
- length(a: Quaternion): number {
67
- return Math.sqrt(this.lengthSquared(a));
68
- },
69
-
70
- normalize(out: Quaternion, input: Quaternion) {
71
- const len = Math.sqrt(this.lengthSquared(input));
72
- if (len < EPSILON) {
73
- this.set(out, 0, 0, 0, 1);
74
- }
75
- else {
76
- const invLen = 1 / len;
77
- this.set(out, input[0] * invLen, input[1] * invLen, input[2] * invLen, input[3] * invLen);
78
- }
79
- },
80
-
81
- fromUnitVectors(out: Quaternion, from: Vec3, to: Vec3) {
82
-
83
- const d = vec3.dot(from, to) + 1;
84
- if (d < EPSILON) {
85
- if (Math.abs(from[0]) > Math.abs(from[2])) {
86
- this.set(out, -from[1], from[0], 0, 0);
87
- } else {
88
- this.set(out, 0, -from[2], from[1], 0);
89
- }
90
- } else {
91
- const x = from[1] * to[2] - from[2] * to[1];
92
- const y = from[2] * to[0] - from[0] * to[2];
93
- const z = from[0] * to[1] - from[1] * to[0];
94
- this.set(out, x, y, z, d);
95
- }
96
- },
97
-
98
-
99
- fromTwoQuaternions(out: Quaternion, from: Quaternion, to: Quaternion) {
100
- const x = from[0] * to[3] + from[3] * to[0] + from[1] * to[2] - from[2] * to[1];
101
- const y = from[1] * to[3] + from[3] * to[1] + from[2] * to[0] - from[0] * to[2];
102
- const z = from[2] * to[3] + from[3] * to[2] + from[0] * to[1] - from[1] * to[0];
103
- const w = from[3] * to[3] - from[0] * to[0] - from[1] * to[1] - from[2] * to[2];
104
- this.set(out, x, y, z, w);
105
- this.normalize(out, out);
106
- },
107
-
108
- conjugate(out: Quaternion, a: Quaternion) {
109
- this.set(out, -a[0], -a[1], -a[2], a[3]);
110
- },
111
-
112
- fromAxisAngle(out: Quaternion, axis: Vec3, angle: number) {
113
- const halfAngle = angle / 2;
114
- const s = Math.sin(halfAngle);
115
- this.set(out, axis[0] * s, axis[1] * s, axis[2] * s, Math.cos(halfAngle));
116
- },
117
-
118
-
119
- });
120
-
package/Math/roadmap.md DELETED
@@ -1,10 +0,0 @@
1
-
2
- There is an arc on a unit sphere. The sphere center is at the origin. The arc is represented with start and points.
3
-
4
- And there is a plane the intersects with the same sphere. Represented with vector and distance from origin.
5
-
6
- I want to know the relative position of points to the plane. If they are at the same direction with the plane vector or not.
7
-
8
- If two points are on the same side of the plane. If so, do they closer to origin then plane or not.
9
-
10
- If two points are on different side of the plane, I want to know the intersection point of arc and plane.
package/Math/types.ts DELETED
@@ -1,45 +0,0 @@
1
- type Radians = number;
2
- type Degrees = number;
3
- type Meter = number;
4
-
5
-
6
- type Vec3 = [number, number, number];
7
-
8
- type Line = {
9
- origin: Vec3;
10
- direction: Vec3;
11
- }
12
-
13
- type Plane = {
14
- normal: Vec3;
15
- distance: number;
16
- };
17
-
18
- type LongLat = [number, number]; // [longitude, latitude]
19
-
20
- type Quaternion = [number, number, number, number];
21
-
22
- type Arc = {
23
- p0: Vec3;
24
- p1: Vec3;
25
- normal: Vec3;
26
- coverPlane: Plane;
27
- }
28
-
29
- type Sphere = {
30
- center: Vec3;
31
- radius: number;
32
- }
33
-
34
- export {
35
- Vec3,
36
- Line,
37
- Plane,
38
- Quaternion,
39
- Arc,
40
- Sphere,
41
- Radians,
42
- Degrees,
43
- Meter,
44
- LongLat,
45
- }
package/Math/utils.js DELETED
@@ -1,3 +0,0 @@
1
- import { Vector3D } from "./vector3d";
2
- import { Quaternion } from "./quaternion";
3
-
package/Math/vec3.ts DELETED
@@ -1,155 +0,0 @@
1
- import { Vec3, LongLat, Quaternion } from './types';
2
- import { EPSILON } from './constants';
3
-
4
- export const vec3 = Object.freeze({
5
- create(x = 0, y = 0, z = 1): Vec3 {
6
- return [x, y, z];
7
- },
8
-
9
- set(out: Vec3, x: number, y: number, z: number) {
10
- out[0] = x;
11
- out[1] = y;
12
- out[2] = z;
13
- },
14
-
15
- clone(a: Vec3): Vec3 {
16
- return [a[0], a[1], a[2]];
17
- },
18
-
19
- copy(out: Vec3, a: Vec3): Vec3 {
20
- out[0] = a[0];
21
- out[1] = a[1];
22
- out[2] = a[2];
23
- return out;
24
- },
25
-
26
- add(out: Vec3, a: Vec3, b: Vec3): Vec3 {
27
- out[0] = a[0] + b[0];
28
- out[1] = a[1] + b[1];
29
- out[2] = a[2] + b[2];
30
- return out;
31
- },
32
-
33
- subtract(out: Vec3, a: Vec3, b: Vec3) {
34
- out[0] = a[0] - b[0];
35
- out[1] = a[1] - b[1];
36
- out[2] = a[2] - b[2];
37
- },
38
-
39
- dot(a: Vec3, b: Vec3): number {
40
- return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
41
- },
42
-
43
- cross(out: Vec3, a: Vec3, b: Vec3) {
44
- const x = a[1] * b[2] - a[2] * b[1];
45
- const y = a[2] * b[0] - a[0] * b[2];
46
- const z = a[0] * b[1] - a[1] * b[0];
47
- out[0] = x;
48
- out[1] = y;
49
- out[2] = z;
50
- },
51
-
52
-
53
- multiplyScalar(out: Vec3, a: Vec3, b: number) {
54
- out[0] = a[0] * b;
55
- out[1] = a[1] * b;
56
- out[2] = a[2] * b;
57
- },
58
-
59
- divideScalar(out: Vec3, a: Vec3, b: number) {
60
- if (b === 0) {
61
- throw new Error('Division by zero');
62
- }
63
- out[0] = a[0] / b;
64
- out[1] = a[1] / b;
65
- out[2] = a[2] / b;
66
- },
67
-
68
- lengthSquared(a: Vec3): number {
69
- return a[0] * a[0] + a[1] * a[1] + a[2] * a[2];
70
- },
71
-
72
- length(a: Vec3): number {
73
- return Math.sqrt(this.lengthSquared(a));
74
- },
75
-
76
- normalize(outVec: Vec3, inVec: Vec3) {
77
- const len = this.length(inVec);
78
- if (len === 0) {
79
- throw new Error('Cannot normalize a zero vector');
80
- }
81
- outVec[0] = inVec[0] / len;
82
- outVec[1] = inVec[1] / len;
83
- outVec[2] = inVec[2] / len;
84
- },
85
-
86
-
87
- distanceSquared(a: Vec3, b: Vec3): number {
88
- const dx = a[0] - b[0];
89
- const dy = a[1] - b[1];
90
- const dz = a[2] - b[2];
91
- return dx * dx + dy * dy + dz * dz;
92
- },
93
-
94
-
95
- distance(a: Vec3, b: Vec3): number {
96
- return Math.sqrt(this.distanceSquared(a, b));
97
- },
98
-
99
- equals(a: Vec3, b: Vec3): boolean {
100
- return (
101
- Math.abs(a[0] - b[0]) < EPSILON &&
102
- Math.abs(a[1] - b[1]) < EPSILON &&
103
- Math.abs(a[2] - b[2]) < EPSILON
104
- );
105
- },
106
-
107
-
108
- toUnitVectorLongLat(out: LongLat, a: Vec3) {
109
- const len = this.length(a); // TODO Might drop length check
110
- if (len === 0) {
111
- throw new Error('Cannot convert a zero vector to unit vector');
112
- }
113
- out[0] = Math.atan2(a[1], a[0]); // Longitude
114
- out[1] = Math.asin(a[2] / len); // Latitude
115
- },
116
-
117
- fromUnitVectorLongLat(out: Vec3, longLat: LongLat) {
118
- const longitude = longLat[0];
119
- const latitude = longLat[1];
120
- const cosLat = Math.cos(latitude);
121
- out[0] = cosLat * Math.cos(longitude);
122
- out[1] = cosLat * Math.sin(longitude);
123
- out[2] = Math.sin(latitude);
124
- },
125
-
126
- applyQuaternion(out: Vec3, a: Vec3, q: Quaternion) {
127
- const x = a[0], y = a[1], z = a[2];
128
- const qx = q[0], qy = q[1], qz = q[2], qw = q[3];
129
- // Calculate the quaternion multiplication
130
- const ix = qw * x + qy * z - qz * y;
131
- const iy = qw * y + qz * x - qx * z;
132
- const iz = qw * z + qx * y - qy * x;
133
- const iw = -qx * x - qy * y - qz * z;
134
- // Apply the quaternion to the vector
135
- out[0] = ix * qw + iw * -qx + iy * -qz - iz * -qy;
136
- out[1] = iy * qw + iw * -qy + iz * -qx - ix * -qz;
137
- out[2] = iz * qw + iw * -qz + ix * -qy - iy * -qx;
138
- },
139
-
140
-
141
- randomUnit(out: Vec3) {
142
- const theta = Math.random() * 2 * Math.PI;
143
- const phi = Math.acos(2 * Math.random() - 1);
144
- out[0] = Math.sin(phi) * Math.cos(theta);
145
- out[1] = Math.sin(phi) * Math.sin(theta);
146
- out[2] = Math.cos(phi);
147
- },
148
-
149
-
150
- str(a: Vec3): string {
151
- return `Vec3(${a[0].toFixed(2)}, ${a[1].toFixed(2)}, ${a[2].toFixed(2)})`;
152
- }
153
-
154
-
155
- });
@@ -1,14 +0,0 @@
1
- const findFirstIndexInRange = (container, value) => {
2
- let start = 0;
3
- let end = container.length - 1;
4
- let mid = 0;
5
- while (start <= end) {
6
- mid = Math.floor((start + end) / 2);
7
- if (container[mid] <= value && value <= container[mid + 1]) return mid;
8
- if (container[mid] < value) start = mid + 1;
9
- else end = mid - 1;
10
- }
11
- return null;
12
- }
13
-
14
- export { findFirstIndexInRange };
File without changes
@@ -1,27 +0,0 @@
1
- import "./types";
2
-
3
- /**
4
- * @param {DrawSubsetOptions} drawSubsetOptions
5
- */
6
-
7
- // TODO: Draw all is an optional property for the target plugin, with this approach.
8
-
9
-
10
- class DrawSubsetOptionRegistry {
11
- constructor() {
12
- this._drawSubsetOptions = new Map();
13
- }
14
-
15
- register(key, drawSubsetOptions) {
16
- this._drawSubsetOptions.set(key, drawSubsetOptions);
17
- }
18
-
19
- unregister(key) {
20
- this._drawSubsetOptions.delete(key);
21
- }
22
-
23
-
24
-
25
-
26
-
27
- }
File without changes