@pirireis/webglobeplugins 0.8.14 → 0.8.17
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 -15
- 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/{point-glow-line-to-earth → altitude-locator}/plugin.js +1 -1
- package/jest.config.js +6 -0
- package/package.json +1 -1
- package/point-heat-map/plugin-webworker.js +5 -3
- package/programs/line-on-globe/circle-accurate-flat.js +18 -3
- package/shape-on-terrain/goal.md +12 -0
- package/shape-on-terrain/intersection.js +0 -0
- package/shape-on-terrain/tree-search.js +0 -0
- 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/cut-arc.js +0 -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 +1 -1
- /package/{point-glow-line-to-earth → altitude-locator}/adaptors.js +0 -0
- /package/{point-glow-line-to-earth → altitude-locator}/draw-subset-obj.js +0 -0
- /package/{point-glow-line-to-earth → altitude-locator}/keymethod.js +0 -0
- /package/{point-glow-line-to-earth → altitude-locator}/types.js +0 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class ArcsToCutsManager {
|
|
6
|
+
|
|
7
|
+
constructor(rbush, { dotDistanceOfArcCuts = 0.01 }) {
|
|
8
|
+
|
|
9
|
+
this._map = new Map();
|
|
10
|
+
this._dotDistanceOfArcCuts = dotDistanceOfArcCuts;
|
|
11
|
+
this._rbush = rbush;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
insertArcs(arc) {
|
|
17
|
+
|
|
18
|
+
if (this._map.has(arc.id)) {
|
|
19
|
+
this._deleteCuts(arc.id);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_deleteCuts(id) {
|
|
26
|
+
const cuts = this._map.get(id);
|
|
27
|
+
if (cuts) {
|
|
28
|
+
cuts.forEach(cut => cut.remove());
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
_cutArcAndAddToRBush(arc) {
|
|
34
|
+
const cuts = this._cutArcToBBoxs(arc);
|
|
35
|
+
cuts.forEach(cut => {
|
|
36
|
+
this._rbush.insert(cut);
|
|
37
|
+
});
|
|
38
|
+
this._map.set(arc.id, cuts);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
_cutArcToBBoxs(arc) {
|
|
43
|
+
const cuts = [];
|
|
44
|
+
|
|
45
|
+
// Calculate the bounding box of the arc
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
// Create a cut object and add it to the cuts array
|
|
49
|
+
const cut = {
|
|
50
|
+
minX: bbox.minX,
|
|
51
|
+
minY: bbox.minY,
|
|
52
|
+
maxX: bbox.maxX,
|
|
53
|
+
maxY: bbox.maxY,
|
|
54
|
+
arcId: arc.id,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
cuts.push(cut);
|
|
58
|
+
return cuts;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
function sphericalLinearInterpolation(phi1, lambda1, phi2, lambda2, t) {
|
|
65
|
+
// Spherical linear interpolation between two points on a sphere
|
|
66
|
+
// Args: phi1, lambda1: starting point (in radians)
|
|
67
|
+
// phi2, lambda2: ending point (in radians)
|
|
68
|
+
// t: interpolation parameter (0 <= t <= 1)
|
|
69
|
+
// Returns: [phi, lambda] in radians
|
|
70
|
+
|
|
71
|
+
const phi = phi1 + t * (phi2 - phi1);
|
|
72
|
+
const lambda = lambda1 + t * (lambda2 - lambda1);
|
|
73
|
+
return [phi, lambda];
|
|
74
|
+
}
|
|
File without changes
|
|
@@ -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
|
@@ -253,7 +253,7 @@ export default class Plugin {
|
|
|
253
253
|
|
|
254
254
|
setParticleDimensions(tail, wing) {
|
|
255
255
|
if (0 < tail || 0 < wing) {
|
|
256
|
-
this.waveUbo.update({
|
|
256
|
+
this.waveUbo.update({ tail_wing_base_limp: [tail, wing] });
|
|
257
257
|
} else {
|
|
258
258
|
console.error("tail and wing must be greater than 0");
|
|
259
259
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|