@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 +4 -2
- package/altitude-locator/plugin.js +1 -1
- package/package.json +1 -1
- package/point-tracks/plugin.js +5 -1
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
|
-
|
|
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 [
|
package/package.json
CHANGED
package/point-tracks/plugin.js
CHANGED
|
@@ -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) =>
|
|
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 }),
|