@pirireis/webglobeplugins 0.8.15-alpha → 0.8.18
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/arc.ts +239 -0
- package/Math/bounds/line-bbox.js +225 -0
- package/Math/constants.ts +8 -0
- package/Math/methodology/arc-part-on-screen.ts +47 -0
- package/Math/methods.js +1 -3
- package/Math/plane.ts +167 -0
- package/Math/quaternion.ts +159 -0
- package/Math/ray.ts +101 -0
- package/Math/roadmap.md +10 -0
- package/Math/types.ts +36 -0
- package/Math/utils.js +3 -0
- package/Math/vector3d.ts +230 -0
- package/jest.config.js +6 -0
- package/package.json +1 -1
- package/point-heat-map/plugin-webworker.js +1 -1
- package/programs/line-on-globe/circle-accurate-flat.js +18 -3
- package/rangerings/rangeringangletext.js +2 -1
- package/tests/Math/arc.test.ts +52 -0
- package/tests/Math/plane.test.ts +45 -0
- package/tests/Math/quaternion.test.ts +98 -0
- package/tests/Math/ray-plane.test.ts +176 -0
- package/tests/Math/vector3d.test.ts +71 -0
- package/util/geometry/index.js +8 -5
- package/util/surface-line-data/arc-bboxes.ts +42 -0
- package/util/surface-line-data/arcs-to-cuts.js +74 -0
- package/util/surface-line-data/flow.ts +52 -0
- package/util/surface-line-data/rbush-manager.js +0 -0
- package/util/surface-line-data/types.ts +27 -0
- package/util/surface-line-data/web-worker.js +0 -0
- package/waveparticles/plugin.js +9 -6
- package/webworker-test/index.js +0 -10
- package/webworker-test/module.js +0 -10
- package/webworker-test/worker.js +0 -8
- /package/{webpack.config.js → util/surface-line-data/cut-arc.js} +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class FlowManager {
|
|
6
|
+
_populateCount: number;
|
|
7
|
+
_rbush: RBush<any>;
|
|
8
|
+
_arcToCutsManager: ArcToCutsManager;
|
|
9
|
+
consturctor({ populateCount = 36, dotDistanceOfArcCuts = 1 / Math.pow(2, 10 - 1) }) {
|
|
10
|
+
this._populateCount = populateCount;
|
|
11
|
+
|
|
12
|
+
// does the cutting and id mapping(one to many)
|
|
13
|
+
// cuts have their bbox ready for rbush
|
|
14
|
+
this._rbush = new RBush(1000);
|
|
15
|
+
this._arcToCutsManager = new ArcToCutsManager({ dotDistanceOfArcCuts, rbush: this._rbush }); // 10km
|
|
16
|
+
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* adds or updates an arc in the rbush and the cuts manager
|
|
25
|
+
*/
|
|
26
|
+
insertArc(arc: Arc) {
|
|
27
|
+
this._arcToCutsManager.insertArc(arc);
|
|
28
|
+
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
deleteArc(id: Arc['id']) {
|
|
34
|
+
this._arcToCutsManager.deleteArc(id);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
queryBBox(bbox: BBox) {
|
|
39
|
+
|
|
40
|
+
const arcIDSet = new Set(this._rbush.query(bbox).map(x => x.id)); // sets Of ids of arcs
|
|
41
|
+
|
|
42
|
+
// arcs U bbox => arcs
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
// populate points
|
|
46
|
+
// return typed array of points belonging to all the arcs of cuts
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
type BBox = {
|
|
2
|
+
minX: number;
|
|
3
|
+
minY: number;
|
|
4
|
+
maxX: number;
|
|
5
|
+
maxY: number;
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
type Point = { lon: number, lat: number };
|
|
10
|
+
type Vector = [number, number, number]; // x y z
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
type Arc = {
|
|
14
|
+
id: string;
|
|
15
|
+
start: number[];
|
|
16
|
+
end: number[];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
interface RBUSH {
|
|
21
|
+
insert: (item: BBox) => void;
|
|
22
|
+
remove: (item: BBox) => void;
|
|
23
|
+
search: (bbox: BBox) => BBox[];
|
|
24
|
+
clear: () => void;
|
|
25
|
+
all: () => BBox[];
|
|
26
|
+
|
|
27
|
+
}
|
|
File without changes
|
package/waveparticles/plugin.js
CHANGED
|
@@ -20,7 +20,7 @@ const MAX_PIXELS_ON_DIMENSION = 2200;
|
|
|
20
20
|
|
|
21
21
|
|
|
22
22
|
export default class Plugin {
|
|
23
|
-
constructor(id, { fadeOpacity = 0.83, opacity = 0.75, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, patricleCount = 8000,
|
|
23
|
+
constructor(id, { dataWidth, dataHeight, fadeOpacity = 0.83, opacity = 0.75, minLon = -180, minLat = -90, maxLon = 180, maxLat = 90, patricleCount = 8000, flipX = false, flipY = true, drawTextureMaxPixelOnDimension = MAX_PIXELS_ON_DIMENSION } = {}) {
|
|
24
24
|
|
|
25
25
|
this.id = id;
|
|
26
26
|
this.globe = null;
|
|
@@ -31,6 +31,8 @@ export default class Plugin {
|
|
|
31
31
|
this._rgVectorFieldTexture = null;
|
|
32
32
|
this.globeShellWiggle = null;
|
|
33
33
|
this.waveUbo = null;
|
|
34
|
+
this._flipX = flipX;
|
|
35
|
+
this._flipY = flipY;
|
|
34
36
|
this._drawTextureResolution = {};
|
|
35
37
|
this._frameBuffer = null;
|
|
36
38
|
this._fadeOpacity = fadeOpacity;
|
|
@@ -145,7 +147,7 @@ export default class Plugin {
|
|
|
145
147
|
}
|
|
146
148
|
|
|
147
149
|
_createRGTexture() {
|
|
148
|
-
const { gl, _dataWidth, _dataHeight } = this;
|
|
150
|
+
const { gl, _dataWidth, _dataHeight, flipX, flipY } = this;
|
|
149
151
|
const texture = gl.createTexture();
|
|
150
152
|
// R32F
|
|
151
153
|
gl.bindTexture(gl.TEXTURE_2D, texture);
|
|
@@ -154,8 +156,8 @@ export default class Plugin {
|
|
|
154
156
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
|
155
157
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
|
156
158
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
|
157
|
-
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL,
|
|
158
|
-
|
|
159
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipX);
|
|
160
|
+
gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, flipY);
|
|
159
161
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
160
162
|
return texture;
|
|
161
163
|
}
|
|
@@ -186,11 +188,12 @@ export default class Plugin {
|
|
|
186
188
|
}
|
|
187
189
|
|
|
188
190
|
|
|
189
|
-
setVectorFieldData(data, dataWidth = null, dataHeight = null) {
|
|
191
|
+
setVectorFieldData(data, { dataWidth = null, dataHeight = null } = {}) {
|
|
190
192
|
if (dataWidth !== null && dataHeight !== null) {
|
|
191
193
|
this._dataWidth = dataWidth;
|
|
192
194
|
this._dataHeight = dataHeight;
|
|
193
195
|
}
|
|
196
|
+
|
|
194
197
|
const { gl, _dataWidth, _dataHeight } = this;
|
|
195
198
|
gl.bindTexture(gl.TEXTURE_2D, this._rgVectorFieldTexture);
|
|
196
199
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RG32F, _dataWidth, _dataHeight, 0, gl.RG, gl.FLOAT, data);
|
|
@@ -253,7 +256,7 @@ export default class Plugin {
|
|
|
253
256
|
|
|
254
257
|
setParticleDimensions(tail, wing) {
|
|
255
258
|
if (0 < tail || 0 < wing) {
|
|
256
|
-
this.waveUbo.update({
|
|
259
|
+
this.waveUbo.update({ tail_wing_base_limp: [tail, wing] });
|
|
257
260
|
} else {
|
|
258
261
|
console.error("tail and wing must be greater than 0");
|
|
259
262
|
}
|
package/webworker-test/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
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
|
-
}
|
package/webworker-test/module.js
DELETED
package/webworker-test/worker.js
DELETED
|
File without changes
|