@pirireis/webglobeplugins 0.10.12-alpha → 0.10.13-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
@@ -46,14 +46,16 @@ export const sphericalLinearInterpolation_Cartesian3d = (output, a, b, ratio) =>
46
46
  output[1] = _0vec3[1] * height;
47
47
  output[2] = _0vec3[2] * height;
48
48
  };
49
- export const wgs84ToCartesian3d = (long, lat, height) => {
49
+ export const wgs84ToCartesian3d = (output, long, lat, height) => {
50
50
  const longRad = long * RADIANS;
51
51
  const latRad = lat * RADIANS;
52
52
  const x = Math.cos(latRad) * Math.cos(longRad);
53
53
  const y = Math.cos(latRad) * Math.sin(longRad);
54
54
  const z = Math.sin(latRad);
55
55
  const radius = WORLD_RADIUS_3D + height;
56
- return [x * radius, y * radius, z * radius];
56
+ output[0] = x * radius;
57
+ output[1] = y * radius;
58
+ output[2] = z * radius;
57
59
  };
58
60
  export const wgs84ToMercator = (long, lat) => {
59
61
  return [
@@ -59,7 +59,7 @@ class PointGlowLineToEarthPlugin {
59
59
  _0vec6[3] = _0vec3[0];
60
60
  _0vec6[4] = _0vec3[1];
61
61
  _0vec6[5] = _0vec3[2];
62
- new Float32Array(_0vec6);
62
+ return new Float32Array(_0vec6);
63
63
  }
64
64
  }],
65
65
  ['pos2D', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pirireis/webglobeplugins",
3
- "version": "0.10.12-alpha",
3
+ "version": "0.10.13-alpha",
4
4
  "main": "index.js",
5
5
  "author": "Toprak Nihat Deniz Ozturk",
6
6
  "license": "MIT",
@@ -2,6 +2,7 @@ import { BufferOrchestrator, BufferManager, ObjectStore } from "../util/account"
2
2
  import { PickerDisplayer } from "../util/picking/picker-displayer";
3
3
  import { PointOnGlobeProgramCache } from "../programs/point-on-globe/square-pixel-point";
4
4
  import { wgs84ToCartesian3d, wgs84ToMercator } from "../Math/methods";
5
+ const _0vec3 = /* @__PURE__ */ [0, 0, 0];
5
6
  /**
6
7
  * @typedef {number} long
7
8
  * @typedef {number} lat
@@ -50,7 +51,10 @@ class PointTracksPlugin {
50
51
  this._bufferManagersMap = new Map([
51
52
  ["pos3D", {
52
53
  bufferManager: new BufferManager(gl, 3, { bufferType, initialCapacity }),
53
- adaptor: (item) => new Float32Array(wgs84ToCartesian3d(item.long, item.lat, item.height / 1000)) // height is in meters
54
+ adaptor: (item) => {
55
+ wgs84ToCartesian3d(_0vec3, item.long, item.lat, item.height / 1000); // height is in meters
56
+ return new Float32Array(_0vec3); // height is in meters
57
+ }
54
58
  }],
55
59
  ["pos2D", {
56
60
  bufferManager: new BufferManager(gl, 2, { bufferType, initialCapacity }),