plebeiangraphlibrary 2.0.0 → 2.0.1
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/Build/pgl.d.ts +20 -11
- package/Build/pgl.d.ts.map +1 -1
- package/Build/pgl.js +122 -65
- package/Build/pgl.js.map +1 -1
- package/Build/pgl_module.js +122 -65
- package/Build/pgl_module.js.map +1 -1
- package/Examples/1_ZKC_simple.html +1 -1
- package/Examples/2_ZKC_edge_bundling.html +1 -1
- package/Examples/3_LargePointCloud.html +1 -1
- package/Examples/4_ToggleActivation.html +1 -1
- package/Examples/5_Hierarchy_simple.html +1 -1
- package/Examples/6_Flowmap_style.html +1 -1
- package/Examples/7_Graph_algorithms.html +79 -19
- package/Examples/8_ThreeWrapper_variants.html +1 -1
- package/Examples/{index.html → examples.html} +3 -3
- package/package.json +4 -1
package/Build/pgl.d.ts
CHANGED
|
@@ -466,6 +466,17 @@ declare function DrawThickEdgesFromEdgeMap(EdgeMap: Map<number, Line>, bounds: n
|
|
|
466
466
|
* @returns
|
|
467
467
|
*/
|
|
468
468
|
declare function DrawTHREEGraphEdgesThin(Graph: Graph, bounds?: number, color?: number): THREE.Group<THREE.Object3DEventMap>;
|
|
469
|
+
/**
|
|
470
|
+
* Draw a single thick line through an ordered list of node IDs (e.g. a path).
|
|
471
|
+
* Uses graph positions; line width in pixels (pass thickness >= 1 for pixel width).
|
|
472
|
+
*
|
|
473
|
+
* @param Graph - Graph with position map
|
|
474
|
+
* @param bounds - Scale factor for positions
|
|
475
|
+
* @param pathNodeIds - Ordered node IDs (start to end)
|
|
476
|
+
* @param color - Hex color for the path line
|
|
477
|
+
* @param thickness - Line width in pixels (e.g. 5 for a thick path)
|
|
478
|
+
*/
|
|
479
|
+
declare function DrawThickPathFromNodeIds(Graph: Graph, bounds: number, pathNodeIds: number[], color?: number, thickness?: number): THREE.Group<THREE.Object3DEventMap>;
|
|
469
480
|
/**
|
|
470
481
|
*
|
|
471
482
|
* Draw Line map as lines given the edge map assocaited with the graph
|
|
@@ -532,25 +543,23 @@ declare function AddInModularityBasedPointGroups(Graph: Graph, propertyName: str
|
|
|
532
543
|
*/
|
|
533
544
|
declare function DrawSimplifiedEdges(Graph: Graph, amount: number, color?: number): THREE.Group<THREE.Object3DEventMap>;
|
|
534
545
|
/**
|
|
546
|
+
* Set vertex colors by node ID. Uses the geometry's "label" attribute (node ID per vertex) to map node IDs to vertex indices; if "label" is missing, indexArray is treated as vertex indices.
|
|
535
547
|
*
|
|
536
|
-
*
|
|
537
|
-
*
|
|
538
|
-
* @param
|
|
539
|
-
* @param indexArray - The array of the indices of all the nodes whose values that have to be changed
|
|
540
|
-
* @param color - The color that they have to be changed too
|
|
548
|
+
* @param vertices - THREE.Points with customColor (and optionally label) attribute, or a Group whose first child is that Points object
|
|
549
|
+
* @param indexArray - Node IDs to color, or vertex indices if geometry has no label attribute
|
|
550
|
+
* @param color - Hex color to apply
|
|
541
551
|
*/
|
|
542
|
-
declare function ChangeTheVertexColours(vertices: THREE.Points, indexArray: number[], color: number): void;
|
|
552
|
+
declare function ChangeTheVertexColours(vertices: THREE.Points | THREE.Group, indexArray: number[], color: number): void;
|
|
543
553
|
/**
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
* @param vertices - ThreeJS Points object, be sure to pass in the points object and not the group that the points belong too
|
|
554
|
+
* Reset all vertex colors to white.
|
|
555
|
+
* @param vertices - THREE.Points with customColor attribute, or a Group whose first child is that Points object
|
|
548
556
|
*/
|
|
549
|
-
declare function ResetVertexColors(vertices: THREE.Points): void;
|
|
557
|
+
declare function ResetVertexColors(vertices: THREE.Points | THREE.Group): void;
|
|
550
558
|
export const ThreeWrapper: {
|
|
551
559
|
DrawTHREEGraphVertices: typeof DrawTHREEGraphVertices;
|
|
552
560
|
DrawTHREEGraphEdgesThick: typeof DrawTHREEGraphEdgesThick;
|
|
553
561
|
DrawTHREEGraphEdgesThin: typeof DrawTHREEGraphEdgesThin;
|
|
562
|
+
DrawThickPathFromNodeIds: typeof DrawThickPathFromNodeIds;
|
|
554
563
|
AddBoxBasedImaging: typeof AddBoxBasedImaging;
|
|
555
564
|
AddInModularityBasedPointGroups: typeof AddInModularityBasedPointGroups;
|
|
556
565
|
DrawThinEdgesFromEdgeMap: typeof DrawThinEdgesFromEdgeMap;
|
package/Build/pgl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;IACE,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;IACE;;;;;OAKG;gBACS,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,MAAM;IASxC;;;OAGG;IACH,SAAS,CAAC,OAAM,KAAK;CAKtB;AC7BD;IACE,MAAM,EAAE,KAAK,EAAE,CAAC;CACjB;AAED;IACE;;;OAGG;gBACS,MAAM,EAAE,KAAK,EAAE;CAO5B;ACdD;IACE,IAAI,EAAE,GAAG,CAAC;IACV,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;;GAGG;AACH;IACE;;;OAGG;gBACS,IAAI,EAAC,GAAG;CAMrB;ACxBD;IACE,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,GAAG,CAAC;CACX;AAED;;GAEG;AACH;IACE;;;;;;;OAOG;gBACS,KAAK,EAAC,MAAM,EAAE,GAAG,EAAC,MAAM,EAAE,IAAI,EAAC,GAAG;CAK/C;AClBD;IACE,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC1B,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;CAC1B;AAED;;;GAGG;AACH;IACE;;;;;;OAMG;gBACS,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,GAAG,CA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M,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC;CACxE;AIzBD;;;;;;;GAOG;AACH,mCACE,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAAC,KAAK,CAAC,CAIhB;AAED;;;;;;;GAOG;AACH,mCACE,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,eAAe,EACzB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,KAAK,CAAC,CAGhB","sources":["Src/Src/HelperClasses/Point.ts","Src/Src/HelperClasses/Line.ts","Src/Src/Core/_Node.ts","Src/Src/Core/Edge.ts","Src/Src/Core/Graph.ts","Src/Src/Core/index.ts","Src/Src/GraphAlgorithms/GraphMethods.ts","Src/Src/GraphAlgorithms/index.ts","Src/Src/SampleData/ZKC.ts","Src/Src/SampleData/ZKC_simulated.ts","Src/Src/HelperClasses/GraphConstructors.ts","Src/Src/HelperClasses/Utilities.ts","Src/Src/HelperClasses/GeometryHelpers.ts","Src/Src/Drawing/Drawing.ts","Src/Src/SampleData/DataLoader.ts","Src/Src/SampleData/index.ts","Src/Src/HelperClasses/ColorHelper.ts","Src/Src/Drawing/MeshLineGeometry.ts","Src/Src/Drawing/MeshLineMaterial.ts","Src/Src/Drawing/ThickLine.ts","Src/Src/Shaders/vertexShader.glsl.ts","Src/Src/Shaders/fragmentShader.glsl.ts","Src/Src/Drawing/ThreeJSDrawer.ts","Src/Src/Drawing/GraphDrawer.ts","Src/Src/Models/ErdosRenyiModel.ts","Src/Src/Models/index.ts","Src/Src/Hierarchy/types.ts","Src/Src/Hierarchy/KDTree.ts","Src/Src/Hierarchy/KDDistanceStrategy.ts","Src/Src/Hierarchy/buildSimplifiedGraph.ts","Src/Src/Hierarchy/index.ts","Src/Src/index.ts","Src/index.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,"export { Graph } from \"./Core\";\nexport { GraphMethods } from \"./GraphAlgorithms\";\nexport { SampleData } from \"./SampleData\";\nexport { default as Constructors } from \"./HelperClasses/GraphConstructors\";\nexport { default as Drawing } from \"./Drawing/Drawing\";\nexport { default as Geometry } from \"./HelperClasses/GeometryHelpers\";\nexport { default as Utilities } from \"./HelperClasses/Utilities\";\nexport { default as ThreeWrapper } from \"./Drawing/ThreeJSDrawer\";\nexport { default as GraphDrawer } from \"./Drawing/GraphDrawer\";\nexport { Models } from \"./Models\";\nexport { default as Hierarchy } from \"./Hierarchy\";\n"],"names":[],"version":3,"file":"pgl.d.ts.map"}
|
package/Build/pgl.js
CHANGED
|
@@ -833,21 +833,21 @@ var $96b4f4dcd8ff333f$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
833
833
|
return $96b4f4dcd8ff333f$var$__awaiter(this, void 0, void 0, function*() {
|
|
834
834
|
const adj = Graph.get_adjacency();
|
|
835
835
|
const exploredFromMap = new Map();
|
|
836
|
-
const explored = [
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
836
|
+
const explored = new Set([
|
|
837
|
+
node
|
|
838
|
+
]);
|
|
839
|
+
const queue = [
|
|
840
|
+
node
|
|
841
|
+
];
|
|
840
842
|
exploredFromMap.set(node, -1);
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
const currentNode = stack.pop();
|
|
844
|
-
// add this current node to the explored list
|
|
845
|
-
explored.push(currentNode);
|
|
843
|
+
while(queue.length > 0){
|
|
844
|
+
const currentNode = queue.shift();
|
|
846
845
|
const neighbours = adj.get(currentNode);
|
|
847
846
|
for(let i = 0; i < neighbours.length; i++){
|
|
848
847
|
const neighbour = neighbours[i];
|
|
849
|
-
if (!explored.
|
|
850
|
-
|
|
848
|
+
if (!explored.has(neighbour)) {
|
|
849
|
+
explored.add(neighbour);
|
|
850
|
+
queue.push(neighbour);
|
|
851
851
|
exploredFromMap.set(neighbour, currentNode);
|
|
852
852
|
}
|
|
853
853
|
}
|
|
@@ -868,20 +868,17 @@ var $96b4f4dcd8ff333f$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
868
868
|
return $96b4f4dcd8ff333f$var$__awaiter(this, void 0, void 0, function*() {
|
|
869
869
|
const adj = Graph.get_adjacency();
|
|
870
870
|
const Dmap = new Map();
|
|
871
|
-
// get the explored from map
|
|
872
871
|
const exploredFromMap = yield $96b4f4dcd8ff333f$var$BFSSearch(Graph, Node);
|
|
873
|
-
// then for each element in the map go through
|
|
874
|
-
// contact trace where that element came from
|
|
875
872
|
for (const n of adj.keys()){
|
|
873
|
+
if (!exploredFromMap.has(n)) continue; // unreachable (disconnected)
|
|
876
874
|
let i = 0;
|
|
877
875
|
let exploredFrom = exploredFromMap.get(n);
|
|
878
|
-
while(exploredFrom
|
|
876
|
+
while(exploredFrom !== undefined && exploredFrom !== -1){
|
|
879
877
|
exploredFrom = exploredFromMap.get(exploredFrom);
|
|
880
878
|
i += 1;
|
|
881
879
|
}
|
|
882
880
|
Dmap.set(n, i);
|
|
883
881
|
}
|
|
884
|
-
// now return this map
|
|
885
882
|
return Dmap;
|
|
886
883
|
});
|
|
887
884
|
}
|
|
@@ -897,12 +894,27 @@ var $96b4f4dcd8ff333f$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
897
894
|
* @returns returns an object with a start, end - the two points of a graph and the diameter of the graph
|
|
898
895
|
*/ function $96b4f4dcd8ff333f$var$GraphDiameter(Graph) {
|
|
899
896
|
return $96b4f4dcd8ff333f$var$__awaiter(this, void 0, void 0, function*() {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
897
|
+
const nodeIds = [
|
|
898
|
+
...Graph.nodes.keys()
|
|
899
|
+
];
|
|
900
|
+
if (nodeIds.length === 0) return {
|
|
901
|
+
start: 0,
|
|
902
|
+
end: 0,
|
|
903
|
+
distance: 0
|
|
904
|
+
};
|
|
905
|
+
if (nodeIds.length === 1) return {
|
|
906
|
+
start: nodeIds[0],
|
|
907
|
+
end: nodeIds[0],
|
|
908
|
+
distance: 0
|
|
909
|
+
};
|
|
910
|
+
const adj = Graph.get_adjacency();
|
|
911
|
+
const withNeighbors = nodeIds.filter((id)=>{
|
|
912
|
+
var _a, _b;
|
|
913
|
+
return ((_b = (_a = adj.get(id)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
914
|
+
});
|
|
915
|
+
const pickFrom = withNeighbors.length > 0 ? withNeighbors : nodeIds;
|
|
916
|
+
let seed = pickFrom[Math.floor(Math.random() * pickFrom.length)];
|
|
903
917
|
let Dstart = yield $96b4f4dcd8ff333f$var$Dijkstra(Graph, seed);
|
|
904
|
-
// iterate through all the values and then get
|
|
905
|
-
// the value that is the highest amongst the others
|
|
906
918
|
let currentDistance = -1;
|
|
907
919
|
for (const n of Dstart.keys()){
|
|
908
920
|
const dval = Dstart.get(n);
|
|
@@ -911,10 +923,8 @@ var $96b4f4dcd8ff333f$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
911
923
|
currentDistance = dval;
|
|
912
924
|
}
|
|
913
925
|
}
|
|
914
|
-
// then search from there to the furthest point again
|
|
915
926
|
const newStart = seed;
|
|
916
927
|
Dstart = yield $96b4f4dcd8ff333f$var$Dijkstra(Graph, seed);
|
|
917
|
-
// repeat the thing
|
|
918
928
|
currentDistance = -1;
|
|
919
929
|
for (const n of Dstart.keys()){
|
|
920
930
|
const dval = Dstart.get(n);
|
|
@@ -923,12 +933,11 @@ var $96b4f4dcd8ff333f$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
923
933
|
currentDistance = dval;
|
|
924
934
|
}
|
|
925
935
|
}
|
|
926
|
-
|
|
936
|
+
return {
|
|
927
937
|
start: newStart,
|
|
928
938
|
end: seed,
|
|
929
939
|
distance: currentDistance
|
|
930
940
|
};
|
|
931
|
-
return returnObj;
|
|
932
941
|
});
|
|
933
942
|
}
|
|
934
943
|
// Select a subrgaph
|
|
@@ -1060,17 +1069,10 @@ var $734dcf9f6d72d709$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
1060
1069
|
return $734dcf9f6d72d709$var$__awaiter(this, void 0, void 0, function*() {
|
|
1061
1070
|
// I'm constructing a Graph here so some of the stuff doesnt matter
|
|
1062
1071
|
this.edges.forEach((edge)=>{
|
|
1063
|
-
// get the start point
|
|
1064
1072
|
const start = edge.start;
|
|
1065
1073
|
const end = edge.end;
|
|
1066
|
-
|
|
1067
|
-
if (this.nodes.get(
|
|
1068
|
-
const relevantSNode = this.nodes.get(start);
|
|
1069
|
-
relevantSNode.neighbours.push(end);
|
|
1070
|
-
} else if (this.nodes.get(end)) {
|
|
1071
|
-
const relevantENode = this.nodes.get(end);
|
|
1072
|
-
relevantENode.neighbours.push(start);
|
|
1073
|
-
}
|
|
1074
|
+
if (this.nodes.get(start)) this.nodes.get(start).neighbours.push(end);
|
|
1075
|
+
if (this.nodes.get(end)) this.nodes.get(end).neighbours.push(start);
|
|
1074
1076
|
});
|
|
1075
1077
|
// then for each node then get the unique neighbours
|
|
1076
1078
|
for (const key of this.nodes.keys()){
|
|
@@ -1100,11 +1102,12 @@ var $734dcf9f6d72d709$var$__awaiter = undefined && undefined.__awaiter || functi
|
|
|
1100
1102
|
* @param data - data associated with the edge
|
|
1101
1103
|
*/ add_edge(start, end, data) {
|
|
1102
1104
|
const newEdge = new (0, $i8obY.default)(start, end, data);
|
|
1103
|
-
// this is a new edge that we add to the edges
|
|
1104
1105
|
this.edges.set(this.edges.size, newEdge);
|
|
1105
|
-
//
|
|
1106
|
-
const
|
|
1107
|
-
|
|
1106
|
+
// keep adjacency consistent for undirected graph (both directions)
|
|
1107
|
+
const startNode = this.nodes.get(start);
|
|
1108
|
+
const endNode = this.nodes.get(end);
|
|
1109
|
+
if (startNode) startNode.neighbours.push(end);
|
|
1110
|
+
if (endNode) endNode.neighbours.push(start);
|
|
1108
1111
|
}
|
|
1109
1112
|
// get an adjacency list reprentation of the graph
|
|
1110
1113
|
// this onlu has the indices and not the actual data
|
|
@@ -1213,6 +1216,8 @@ parcelRequire.register("eqUI8", function(module, exports) {
|
|
|
1213
1216
|
$parcel$export(module.exports, "default", () => $a81f7bf7ba151678$export$2e2bcd8739ae039);
|
|
1214
1217
|
|
|
1215
1218
|
|
|
1219
|
+
var $3WMe9 = parcelRequire("3WMe9");
|
|
1220
|
+
|
|
1216
1221
|
var $2vhjw = parcelRequire("2vhjw");
|
|
1217
1222
|
|
|
1218
1223
|
var $bWT2q = parcelRequire("bWT2q");
|
|
@@ -1354,6 +1359,27 @@ var __awaiter = undefined && undefined.__awaiter || function(thisArg11, _argumen
|
|
|
1354
1359
|
const emap11 = Graph11.get_edge_map();
|
|
1355
1360
|
return DrawThinEdgesFromEdgeMap(emap11, bounds11, color11);
|
|
1356
1361
|
}
|
|
1362
|
+
/**
|
|
1363
|
+
* Draw a single thick line through an ordered list of node IDs (e.g. a path).
|
|
1364
|
+
* Uses graph positions; line width in pixels (pass thickness >= 1 for pixel width).
|
|
1365
|
+
*
|
|
1366
|
+
* @param Graph - Graph with position map
|
|
1367
|
+
* @param bounds - Scale factor for positions
|
|
1368
|
+
* @param pathNodeIds - Ordered node IDs (start to end)
|
|
1369
|
+
* @param color - Hex color for the path line
|
|
1370
|
+
* @param thickness - Line width in pixels (e.g. 5 for a thick path)
|
|
1371
|
+
*/ function DrawThickPathFromNodeIds(Graph11, bounds11, pathNodeIds11, color11 = 0xffffff, thickness11 = 5) {
|
|
1372
|
+
const pmap11 = Graph11.get_position_map();
|
|
1373
|
+
const pathPoints11 = pathNodeIds11.map((id11)=>pmap11.get(id11)).filter((p11)=>p11 != null);
|
|
1374
|
+
if (pathPoints11.length < 2) return new $h9nKb$three.Group();
|
|
1375
|
+
const pathLine11 = new (0, $3WMe9.default)(pathPoints11);
|
|
1376
|
+
return (0, $2vhjw.createThickEdgesGroup)(new Map([
|
|
1377
|
+
[
|
|
1378
|
+
0,
|
|
1379
|
+
pathLine11
|
|
1380
|
+
]
|
|
1381
|
+
]), bounds11, color11, thickness11);
|
|
1382
|
+
}
|
|
1357
1383
|
// function to draw edges from edge map
|
|
1358
1384
|
/**
|
|
1359
1385
|
*
|
|
@@ -1541,44 +1567,75 @@ var __awaiter = undefined && undefined.__awaiter || function(thisArg11, _argumen
|
|
|
1541
1567
|
return lineGroup11;
|
|
1542
1568
|
}
|
|
1543
1569
|
/**
|
|
1570
|
+
* Set vertex colors by node ID. Uses the geometry's "label" attribute (node ID per vertex) to map node IDs to vertex indices; if "label" is missing, indexArray is treated as vertex indices.
|
|
1544
1571
|
*
|
|
1545
|
-
*
|
|
1546
|
-
*
|
|
1547
|
-
* @param
|
|
1548
|
-
* @param indexArray - The array of the indices of all the nodes whose values that have to be changed
|
|
1549
|
-
* @param color - The color that they have to be changed too
|
|
1572
|
+
* @param vertices - THREE.Points with customColor (and optionally label) attribute, or a Group whose first child is that Points object
|
|
1573
|
+
* @param indexArray - Node IDs to color, or vertex indices if geometry has no label attribute
|
|
1574
|
+
* @param color - Hex color to apply
|
|
1550
1575
|
*/ function ChangeTheVertexColours(vertices11, indexArray11, color11) {
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1576
|
+
try {
|
|
1577
|
+
const points11 = vertices11 instanceof $h9nKb$three.Group ? vertices11.children[0] : vertices11;
|
|
1578
|
+
const geom11 = points11 === null || points11 === void 0 ? void 0 : points11.geometry;
|
|
1579
|
+
if (!(geom11 === null || geom11 === void 0 ? void 0 : geom11.attributes)) return;
|
|
1580
|
+
const customColor11 = geom11.attributes.customColor;
|
|
1581
|
+
const arr11 = customColor11 === null || customColor11 === void 0 ? void 0 : customColor11.array;
|
|
1582
|
+
if (!arr11 || arr11.length === 0) return;
|
|
1583
|
+
const col11 = new $h9nKb$three.Color(color11);
|
|
1584
|
+
const labelAttr11 = geom11.attributes.label;
|
|
1585
|
+
const labels11 = labelAttr11 === null || labelAttr11 === void 0 ? void 0 : labelAttr11.array;
|
|
1586
|
+
if (labels11 && labels11.length > 0) // Map node IDs to vertex indices via label attribute
|
|
1587
|
+
indexArray11.forEach((nodeId11)=>{
|
|
1588
|
+
for(let i11 = 0; i11 < labels11.length; i11++)if (labels11[i11] === nodeId11) {
|
|
1589
|
+
const k11 = i11 * 3;
|
|
1590
|
+
if (k11 + 2 < arr11.length) {
|
|
1591
|
+
arr11[k11] = col11.r;
|
|
1592
|
+
arr11[k11 + 1] = col11.g;
|
|
1593
|
+
arr11[k11 + 2] = col11.b;
|
|
1594
|
+
}
|
|
1595
|
+
break;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
else // No label: treat indexArray as vertex indices
|
|
1599
|
+
indexArray11.forEach((node11)=>{
|
|
1600
|
+
const k11 = node11 * 3;
|
|
1601
|
+
if (k11 + 2 < arr11.length) {
|
|
1602
|
+
arr11[k11] = col11.r;
|
|
1603
|
+
arr11[k11 + 1] = col11.g;
|
|
1604
|
+
arr11[k11 + 2] = col11.b;
|
|
1605
|
+
}
|
|
1606
|
+
});
|
|
1607
|
+
if (customColor11) customColor11.needsUpdate = true;
|
|
1608
|
+
} catch (_a11) {
|
|
1609
|
+
// Points object or customColor may be missing; skip coloring
|
|
1610
|
+
}
|
|
1561
1611
|
}
|
|
1562
1612
|
/**
|
|
1563
|
-
*
|
|
1564
|
-
*
|
|
1565
|
-
*
|
|
1566
|
-
* @param vertices - ThreeJS Points object, be sure to pass in the points object and not the group that the points belong too
|
|
1613
|
+
* Reset all vertex colors to white.
|
|
1614
|
+
* @param vertices - THREE.Points with customColor attribute, or a Group whose first child is that Points object
|
|
1567
1615
|
*/ function ResetVertexColors(vertices11) {
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1616
|
+
var _a11, _b11, _c11;
|
|
1617
|
+
try {
|
|
1618
|
+
const points11 = vertices11 instanceof $h9nKb$three.Group ? vertices11.children[0] : vertices11;
|
|
1619
|
+
const customColor11 = (_b11 = (_a11 = points11 === null || points11 === void 0 ? void 0 : points11.geometry) === null || _a11 === void 0 ? void 0 : _a11.attributes) === null || _b11 === void 0 ? void 0 : _b11.customColor;
|
|
1620
|
+
const arr11 = customColor11 === null || customColor11 === void 0 ? void 0 : customColor11.array;
|
|
1621
|
+
if (!arr11 || arr11.length === 0) return;
|
|
1622
|
+
const count11 = (_c11 = customColor11 === null || customColor11 === void 0 ? void 0 : customColor11.count) !== null && _c11 !== void 0 ? _c11 : Math.floor(arr11.length / 3);
|
|
1623
|
+
for(let i11 = 0; i11 < count11; i11++){
|
|
1624
|
+
const k11 = i11 * 3;
|
|
1625
|
+
arr11[k11] = 1;
|
|
1626
|
+
arr11[k11 + 1] = 1;
|
|
1627
|
+
arr11[k11 + 2] = 1;
|
|
1628
|
+
}
|
|
1629
|
+
if (customColor11) customColor11.needsUpdate = true;
|
|
1630
|
+
} catch (_d11) {
|
|
1631
|
+
// skip if wrong object or missing attribute
|
|
1575
1632
|
}
|
|
1576
|
-
Attrib11.customColor.needsUpdate = true;
|
|
1577
1633
|
}
|
|
1578
1634
|
var $a81f7bf7ba151678$export$2e2bcd8739ae039 = {
|
|
1579
1635
|
DrawTHREEGraphVertices: DrawTHREEGraphVertices,
|
|
1580
1636
|
DrawTHREEGraphEdgesThick: DrawTHREEGraphEdgesThick,
|
|
1581
1637
|
DrawTHREEGraphEdgesThin: DrawTHREEGraphEdgesThin,
|
|
1638
|
+
DrawThickPathFromNodeIds: DrawThickPathFromNodeIds,
|
|
1582
1639
|
AddBoxBasedImaging: AddBoxBasedImaging,
|
|
1583
1640
|
AddInModularityBasedPointGroups: AddInModularityBasedPointGroups,
|
|
1584
1641
|
DrawThinEdgesFromEdgeMap: DrawThinEdgesFromEdgeMap,
|