@pirireis/webglobeplugins 0.8.13 → 0.8.15-alpha

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.
package/Math/methods.js CHANGED
@@ -173,17 +173,6 @@ const wgs84ToMercator = (long, lat) => {
173
173
  }
174
174
 
175
175
 
176
- /**
177
- * @param {vec3} cartesian
178
- * @returns {vec4} unit vector and length
179
- */
180
- const cartesian3dToUnitVectorWithHeight = (cartesian) => {
181
- const x = cartesian[0];
182
- const y = cartesian[1];
183
- const z = cartesian[2];
184
- const height = Math.sqrt(x * x + y * y + z * z);
185
- return [x / height, y / height, z / height, height];
186
- }
187
176
 
188
177
  /**
189
178
  * @param {vec2} pixelXY
@@ -217,7 +206,6 @@ export {
217
206
  wgs84ToUnitVector,
218
207
  wgs84ToCartesian3d,
219
208
  wgs84ToMercator,
220
- cartesian3dToUnitVectorWithHeight,
221
209
  pixelXYLenghtToUnitVectorWithHeight
222
210
  }
223
211
 
@@ -62,7 +62,7 @@ class PointGlowLineToEarthPlugin {
62
62
  [
63
63
  ['pos3D', {
64
64
  bufferManager: new BufferManager(gl, 6, { bufferType, initialCapacity }),
65
- adaptor: (item) => new Float32Array([...wgs84ToCartesian3d(item.long, item.lat, item.height / 1000), ...wgs84ToCartesian3d(item.long, item.lat, 0 / 1000)])
65
+ adaptor: (item) => new Float32Array([...wgs84ToCartesian3d(item.long, item.lat, item.altitude / 1000), ...wgs84ToCartesian3d(item.long, item.lat, 0 / 1000)])
66
66
  }],
67
67
  ['pos2D', {
68
68
  bufferManager: new BufferManager(gl, 2, { bufferType, initialCapacity }),
@@ -266,7 +266,7 @@ export default class BearingLinePlugin {
266
266
  const endLat = radian(item.endLat)
267
267
  const endLong = radian(item.endLong)
268
268
  const altitude = (item.altitude ?? 0) / 1000;
269
- const bigRadius = item.bigRadius ?? globe.Math.GetDist3D(item.long, item.lat, item.endLong, item.endLat);
269
+ const bigRadius = item.bigRadius ?? globe.Math.GetDist2D(item.long, item.lat, item.endLong, item.endLat);
270
270
  const radius = item.radius !== undefined ? item.radius : bigRadius * 0.2;
271
271
  const { long: bearingLong, lat: bearingLat } = globe.Math.FindPointByPolar(item.long, item.lat, bigRadius, item.bearingAngle)
272
272
  const startAngle2d = calculateStartAngle(long, lat, endLong, endLat);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.8.13",
3
+ "version": "0.8.15-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT"
@@ -1,5 +1,6 @@
1
1
  import { PointHeatmapFlow } from "./point-to-heat-map-flow";
2
- import { webworkerStr } from "../util/interpolation/timetrack/web-worker-str";
2
+ // import { webworkerStr } from "../util/interpolation/timetrack/web-worker-str";
3
+ import { createWorker } from "../util/interpolation/timetrack/index";
3
4
  import { createTexture, getColorRampModed } from "../util";
4
5
  import { opacityCheck, constraintFloat } from "../util/check/typecheck";
5
6
 
@@ -18,8 +19,9 @@ class PointHeatmapPlugin {
18
19
 
19
20
  this._throttleListener = null;
20
21
  this._timeTracksAreSet = false;
21
- const blob = new Blob([webworkerStr], { type: 'application/javascript' });
22
- this.timeTrackInterpolationWorker = new Worker(URL.createObjectURL(blob), { type: 'module' });
22
+ // const blob = new Blob([webworkerStr], { type: 'application/javascript' });
23
+ // this.timeTrackInterpolationWorker = new Worker(URL.createObjectURL(blob), { type: 'module' });
24
+ this.timeTrackInterpolationWorker = createWorker();
23
25
  this.timeTrackInterpolationWorker.onmessage = (e) => {
24
26
  if (e.data.error) {
25
27
  throw new Error(e.data.error);
@@ -0,0 +1,12 @@
1
+ The fact that a straight line have two points, lacks the ability to cover elevation data on higher zoom levels.
2
+
3
+ The purpose of this subplugin is to adapt the straight line to the terrain.
4
+
5
+
6
+ ### Steps
7
+
8
+ - filter by bbox with tree -> indexes
9
+ - find intersaction. Also filters in a more precise way then bbox. -> index and 2 points. 3d carteasian so it can be used on slerp.
10
+ - Populate the line points -> Array<lat long>
11
+ - 3d cartesian coords with globe api
12
+
File without changes
File without changes
File without changes
@@ -0,0 +1,10 @@
1
+ export function testWebWorker() {
2
+
3
+ const worker = new Worker(new URL('./worker.js', import.meta.url), { type: 'module' });
4
+ worker.onmessage = (event) => {
5
+ console.log(event.data);
6
+ worker.terminate();
7
+ };
8
+ worker.postMessage("sumBigNumber");
9
+ return worker;
10
+ }
@@ -0,0 +1,10 @@
1
+ export function sumBigNumber() {
2
+ let sum = 0n;
3
+ let length = 1000000n;
4
+ let i = 0n;
5
+ while (i < length) {
6
+ sum += i;
7
+ i++;
8
+ }
9
+ return sum;
10
+ }
@@ -0,0 +1,8 @@
1
+ import { sumBigNumber } from "./module";
2
+
3
+ /* eslint-disable-next-line no-restricted-globals */
4
+ self.onmessage = (event) => {
5
+ const result = sumBigNumber();
6
+ /* eslint-disable-next-line no-restricted-globals */
7
+ self.postMessage(result);
8
+ }