-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimConstants.js
More file actions
54 lines (45 loc) · 1.94 KB
/
simConstants.js
File metadata and controls
54 lines (45 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* Force simulation tuning (ported subset from osint-gr graphVisualization/constants.js).
*/
export const STABILITY_THRESHOLD = 0.08;
export const STABLE_ITERATIONS = 60;
export const MAX_VELOCITY = 10;
export const MAX_VELOCITY_SCALED = 30;
export const CANVAS_MARGIN = 50;
export const COOLING_INITIAL_TEMPERATURE = 1.0;
export const COOLING_MIN_TEMPERATURE = 0.1;
export const COOLING_DECAY_RATE = 0.95;
export const COOLING_UPDATE_INTERVAL = 10;
/**
* Barnes–Hut opening angle for quadtree repulsion (see QuadTree.calculateRepulsion).
* Lower = more accurate (more tree visits), higher = faster coarser approximation. Typical range 0.5–0.9.
*/
export const BARNES_HUT_THETA = 0.5;
/**
* Integrator substeps committed per React setNodes call (1 = one physics tick per frame, legacy behavior).
* Values 2–4 reduce React reconciliation frequency; cooling/stability advance once per substep.
*/
export const PHYSICS_REACT_COMMIT_INTERVAL = 1;
export const USE_COMMUNITY_DETECTION = true;
/**
* Above these counts, skip expensive hybrid community detection in the force integrator and in
* {@link detectCommunitiesForUi} (main-thread budget for very dense workspaces).
*/
export const COMMUNITY_DETECTION_MAX_NODES = 6000;
export const COMMUNITY_DETECTION_MAX_LINKS = 14000;
/**
* Centroid community pull (see communityCentroidAttraction.js): magnitude = dist * this * cooling.
* Tuned for the O(n) centroid model (replaces legacy pairwise same-cluster springs).
*/
export const CLUSTER_ATTRACTION_STRENGTH = 0.0003;
export const REPULSION_MIN = 2000;
export const REPULSION_MAX = 50000;
export const REPULSION_DEFAULT_PERCENT = 25;
/** @param {number} percent 0–100 */
export function percentToRepulsion(percent) {
return REPULSION_MIN + (percent / 100) * (REPULSION_MAX - REPULSION_MIN);
}
/** @param {number} repulsion */
export function repulsionToPercent(repulsion) {
return ((repulsion - REPULSION_MIN) / (REPULSION_MAX - REPULSION_MIN)) * 100;
}