@knowvah/dot-engine 2.1.0 → 2.3.0
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/dist/common/libm-hypot.d.ts +3 -0
- package/dist/common/libm-hypot.d.ts.map +1 -0
- package/dist/common/poly-sizing.d.ts.map +1 -1
- package/dist/index.js +72 -49
- package/dist/index.js.map +4 -4
- package/dist/layout/fdp/derive.d.ts.map +1 -1
- package/dist/layout/fdp/fdp-model.d.ts +4 -4
- package/dist/layout/fdp/tlayout-init.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout-parms.d.ts +4 -1
- package/dist/layout/fdp/tlayout-parms.d.ts.map +1 -1
- package/dist/layout/fdp/tlayout.d.ts +3 -4
- package/dist/layout/fdp/tlayout.d.ts.map +1 -1
- package/dist/layout/fdp/xlayout.d.ts.map +1 -1
- package/dist/render.js +70 -47
- package/dist/render.js.map +4 -4
- package/package.json +5 -3
- package/src/common/libm-hypot.ts +40 -0
- package/src/common/poly-sizing.ts +10 -10
- package/src/layout/fdp/derive.ts +5 -2
- package/src/layout/fdp/fdp-model.ts +4 -4
- package/src/layout/fdp/tlayout-init.ts +8 -6
- package/src/layout/fdp/tlayout-parms.ts +5 -2
- package/src/layout/fdp/tlayout.ts +18 -17
- package/src/layout/fdp/xlayout.ts +26 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/derive.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"derive.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/derive.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAyB3C,oEAAoE;AACpE,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,KAAK,CAAC;IACb,kEAAkE;IAClE,SAAS,EAAE,OAAO,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,IAAI,EAAE,OAAO,kBAAkB,EAAE,QAAQ,CAAC;CAC3C;AAMD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAM1D;AAwLD;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,GAAG,KAAK,GAAG,IAAI,CAiBrE"}
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* fdp engine data model — gdata, dndata, bport_t, xparams, and the
|
|
3
3
|
* accessor macros of the C private interface.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Matches Graphviz after 15.0.0 (fdpParms.Mlimit lives in
|
|
6
|
+
* tlayout-parms.ts).
|
|
7
7
|
*
|
|
8
|
-
* @see lib/fdpgen/fdp.h
|
|
9
|
-
* @see lib/fdpgen/xlayout.h
|
|
8
|
+
* @see lib/fdpgen/fdp.h
|
|
9
|
+
* @see lib/fdpgen/xlayout.h
|
|
10
10
|
*/
|
|
11
11
|
import type { Graph } from '../../model/graph.js';
|
|
12
12
|
import type { Node } from '../../model/node.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout-init.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-init.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"tlayout-init.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-init.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAGjD,OAAO,EACL,KAAK,KAAK,EAMX,MAAM,gBAAgB,CAAC;AA6KxB;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,IAAI,GAAG,KAAK,CA0BjE"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @see lib/fdpgen/tlayout.c (15.0.0) — parms_t, fdp_initParams,
|
|
9
9
|
* init_params, cool, reset_params
|
|
10
|
-
* @see lib/common/globals.c
|
|
10
|
+
* @see lib/common/globals.c — fdpParms defaults
|
|
11
11
|
*/
|
|
12
12
|
import type { Graph } from '../../model/graph.js';
|
|
13
13
|
import { type XParams } from './fdp-model.js';
|
|
@@ -36,6 +36,9 @@ export declare const fdpParms: {
|
|
|
36
36
|
Tfact: number;
|
|
37
37
|
K: number;
|
|
38
38
|
T0: number;
|
|
39
|
+
/** Distance beyond which repulsion is 0; HUGE_VAL unless `dot -Lm` (no library
|
|
40
|
+
* equivalent). @see lib/fdpgen/fdp.h:fdpParms_s.Mlimit */
|
|
41
|
+
Mlimit: number;
|
|
39
42
|
};
|
|
40
43
|
/** @see lib/fdpgen/tlayout.c:parms_t */
|
|
41
44
|
export interface TParms {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout-parms.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-parms.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAM1D,0CAA0C;AAC1C,eAAO,MAAM,SAAS,MAAM,CAAC;AAU7B,0CAA0C;AAC1C,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,6CAA6C;AAC7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,4CAA4C;AAC5C,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"tlayout-parms.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout-parms.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,KAAK,OAAO,EAAc,MAAM,gBAAgB,CAAC;AAM1D,0CAA0C;AAC1C,eAAO,MAAM,SAAS,MAAM,CAAC;AAU7B,0CAA0C;AAC1C,eAAO,MAAM,SAAS,IAAI,CAAC;AAC3B,6CAA6C;AAC7C,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,4CAA4C;AAC5C,eAAO,MAAM,WAAW,IAAI,CAAC;AAQ7B;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;IASnB;+DAC2D;;CAE5D,CAAC;AAMF,wCAAwC;AACxC,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,CAAC;IACV,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,+EAA+E;AAC/E,eAAO,MAAM,KAAK,EAAE,MAInB,CAAC;AAEF,8DAA8D;AAC9D,wBAAgB,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAEtC;AAED,6CAA6C;AAC7C,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAMD;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,KAAK,EACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GACzB,MAAM,CAaR;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,GACX;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAOhC;AAMD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI,CAsB5C;AAeD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CA2B3D"}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* fdp initial layout — grid-accelerated Fruchterman–Reingold on point
|
|
3
3
|
* nodes with boundary ports.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
* (
|
|
7
|
-
* 15.0.0 output, so neither is ported.
|
|
5
|
+
* Repulsion follows Graphviz after 15.0.0: doRep takes the hypot distance
|
|
6
|
+
* (the host libm's, see libm-hypot.ts) and honours the Mlimit cutoff.
|
|
8
7
|
*
|
|
9
8
|
* All math is double precision (unlike neato's float32 stress kernel).
|
|
10
9
|
* Force-accumulation order is load-bearing: node iteration is the
|
|
@@ -14,7 +13,7 @@
|
|
|
14
13
|
* Parameter state lives in tlayout-parms.ts; initial placement in
|
|
15
14
|
* tlayout-init.ts.
|
|
16
15
|
*
|
|
17
|
-
* @see lib/fdpgen/tlayout.c
|
|
16
|
+
* @see lib/fdpgen/tlayout.c
|
|
18
17
|
*/
|
|
19
18
|
import type { Graph } from '../../model/graph.js';
|
|
20
19
|
import { type XParams } from './fdp-model.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"tlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/tlayout.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAMlD,OAAO,EAEL,KAAK,OAAO,EAMb,MAAM,gBAAgB,CAAC;AAKxB,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/G;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,IAAI;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQpE;AA+ND;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAyBxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"xlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/xlayout.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAKlD,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"xlayout.d.ts","sourceRoot":"","sources":["../../../src/layout/fdp/xlayout.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAKlD,OAAO,EACL,KAAK,OAAO,EAKb,MAAM,gBAAgB,CAAC;AA2QxB;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,GAAG,IAAI,CAMxD"}
|
package/dist/render.js
CHANGED
|
@@ -10513,6 +10513,24 @@ function RADIANS(deg) {
|
|
|
10513
10513
|
return deg / 180 * Math.PI;
|
|
10514
10514
|
}
|
|
10515
10515
|
|
|
10516
|
+
// src/common/libm-hypot.ts
|
|
10517
|
+
var BIG = 2 ** 500;
|
|
10518
|
+
var SMALL2 = 2 ** -500;
|
|
10519
|
+
var SCALE_UP = 2 ** 600;
|
|
10520
|
+
var SCALE_DOWN = 2 ** -600;
|
|
10521
|
+
function libmHypot(a, b) {
|
|
10522
|
+
if (a === Infinity || a === -Infinity || b === Infinity || b === -Infinity) return Infinity;
|
|
10523
|
+
let x = Math.abs(a);
|
|
10524
|
+
let y = Math.abs(b);
|
|
10525
|
+
if (x < y) [x, y] = [y, x];
|
|
10526
|
+
if (x > BIG) return core(x * SCALE_DOWN, y * SCALE_DOWN) * SCALE_UP;
|
|
10527
|
+
if (x < SMALL2) return core(x * SCALE_UP, y * SCALE_UP) * SCALE_DOWN;
|
|
10528
|
+
return core(x, y);
|
|
10529
|
+
}
|
|
10530
|
+
function core(x, y) {
|
|
10531
|
+
return Math.sqrt(fma(y, y, x * x));
|
|
10532
|
+
}
|
|
10533
|
+
|
|
10516
10534
|
// src/common/poly-sizing.ts
|
|
10517
10535
|
var GAP = 4;
|
|
10518
10536
|
var XPAD = 4 * GAP;
|
|
@@ -10600,16 +10618,16 @@ function ellipsePeripheryBB(bb, peripheries, penwidth, hasOutline) {
|
|
|
10600
10618
|
return { bb: b, outline };
|
|
10601
10619
|
}
|
|
10602
10620
|
function transformUnitVertex(R2, g, c, bb) {
|
|
10603
|
-
const D = { x: R2.x
|
|
10621
|
+
const D = { x: fma(R2.x, fma(R2.y, c.gdistortion, c.skewdist), R2.y * c.gskew), y: R2.y };
|
|
10604
10622
|
const alpha = RADIANS(g.orientation) + Math.atan2(D.y, D.x);
|
|
10605
|
-
const r =
|
|
10623
|
+
const r = libmHypot(D.x, D.y);
|
|
10606
10624
|
return { x: r * Math.cos(alpha) * bb.x, y: r * Math.sin(alpha) * bb.y };
|
|
10607
10625
|
}
|
|
10608
10626
|
function polygonVertices(bb, g, isBox3) {
|
|
10609
10627
|
const sectorangle = 2 * Math.PI / g.sides;
|
|
10610
10628
|
const sidelength = Math.sin(sectorangle / 2);
|
|
10611
10629
|
const c = {
|
|
10612
|
-
skewdist:
|
|
10630
|
+
skewdist: libmHypot(Math.abs(g.distortion) + Math.abs(g.skew), 1),
|
|
10613
10631
|
gdistortion: g.distortion * SQRT2 / Math.cos(sectorangle / 2),
|
|
10614
10632
|
gskew: g.skew / 2
|
|
10615
10633
|
};
|
|
@@ -21484,7 +21502,7 @@ function feasibleTree(ctx) {
|
|
|
21484
21502
|
|
|
21485
21503
|
// src/util/bsd-qsort.ts
|
|
21486
21504
|
var THRESH = 7;
|
|
21487
|
-
var
|
|
21505
|
+
var BIG2 = 40;
|
|
21488
21506
|
function swap(arr, i, j) {
|
|
21489
21507
|
const t = arr[i];
|
|
21490
21508
|
arr[i] = arr[j];
|
|
@@ -21510,7 +21528,7 @@ function choosePivot(arr, lo, n, cmp) {
|
|
|
21510
21528
|
let pm = lo + (n >> 1);
|
|
21511
21529
|
let pl = lo;
|
|
21512
21530
|
let pn = lo + (n - 1);
|
|
21513
|
-
if (n >
|
|
21531
|
+
if (n > BIG2) {
|
|
21514
21532
|
const d = n >> 3;
|
|
21515
21533
|
pl = med3(arr, pl, pl + d, pl + 2 * d, cmp);
|
|
21516
21534
|
pm = med3(arr, pm - d, pm, pm + d, cmp);
|
|
@@ -31834,7 +31852,7 @@ function addLoop(sg, cp, dp, sp) {
|
|
|
31834
31852
|
var MARGIN = 36;
|
|
31835
31853
|
var delta = 1;
|
|
31836
31854
|
var mu = 500;
|
|
31837
|
-
var
|
|
31855
|
+
var BIG3 = 16384;
|
|
31838
31856
|
function chanSz(w) {
|
|
31839
31857
|
return (w - 3) / 2;
|
|
31840
31858
|
}
|
|
@@ -31854,7 +31872,7 @@ function updateWt(ep, sz) {
|
|
|
31854
31872
|
ep.cnt++;
|
|
31855
31873
|
if (ep.cnt > sz) {
|
|
31856
31874
|
ep.cnt = 0;
|
|
31857
|
-
ep.weight +=
|
|
31875
|
+
ep.weight += BIG3;
|
|
31858
31876
|
}
|
|
31859
31877
|
}
|
|
31860
31878
|
function updateWts(g, cp, ep) {
|
|
@@ -31912,12 +31930,12 @@ function createSEdges(cp, g) {
|
|
|
31912
31930
|
let vwt = delta * (bb.UR.y - bb.LL.y);
|
|
31913
31931
|
let wt = (hwt + vwt) / 2 + mu;
|
|
31914
31932
|
if (isSmall(bb.UR.y - bb.LL.y) && !(cp.flags & MZ_SMALLV)) {
|
|
31915
|
-
hwt =
|
|
31916
|
-
wt =
|
|
31933
|
+
hwt = BIG3;
|
|
31934
|
+
wt = BIG3;
|
|
31917
31935
|
}
|
|
31918
31936
|
if (isSmall(bb.UR.x - bb.LL.x) && !(cp.flags & MZ_SMALLH)) {
|
|
31919
|
-
vwt =
|
|
31920
|
-
wt =
|
|
31937
|
+
vwt = BIG3;
|
|
31938
|
+
wt = BIG3;
|
|
31921
31939
|
}
|
|
31922
31940
|
const L2 = cp.sides[M_LEFT];
|
|
31923
31941
|
const T2 = cp.sides[M_TOP];
|
|
@@ -37522,7 +37540,7 @@ function raySeg2(v, w, a, b) {
|
|
|
37522
37540
|
}
|
|
37523
37541
|
return wind(v, a, w) * wind(v, a, b) >= 0;
|
|
37524
37542
|
}
|
|
37525
|
-
var
|
|
37543
|
+
var SMALL3 = 1e-10;
|
|
37526
37544
|
function raySegIntersect(v, w, a, b) {
|
|
37527
37545
|
if (!raySeg2(v, w, a, b)) return null;
|
|
37528
37546
|
const mv = { x: w.x - v.x, y: w.y - v.y };
|
|
@@ -37530,7 +37548,7 @@ function raySegIntersect(v, w, a, b) {
|
|
|
37530
37548
|
const ln = { x: -lv.y, y: lv.x };
|
|
37531
37549
|
const lc = -(ln.x * a.x + ln.y * a.y);
|
|
37532
37550
|
const dt = ln.x * mv.x + ln.y * mv.y;
|
|
37533
|
-
if (Math.abs(dt) <
|
|
37551
|
+
if (Math.abs(dt) < SMALL3) return null;
|
|
37534
37552
|
const s = (ln.x * v.x + ln.y * v.y + lc) / dt;
|
|
37535
37553
|
return { x: v.x - s * mv.x, y: v.y - s * mv.y };
|
|
37536
37554
|
}
|
|
@@ -44246,7 +44264,10 @@ var fdpParms = {
|
|
|
44246
44264
|
C: 0,
|
|
44247
44265
|
Tfact: 1,
|
|
44248
44266
|
K: -1,
|
|
44249
|
-
T0: -1
|
|
44267
|
+
T0: -1,
|
|
44268
|
+
/** Distance beyond which repulsion is 0; HUGE_VAL unless `dot -Lm` (no library
|
|
44269
|
+
* equivalent). @see lib/fdpgen/fdp.h:fdpParms_s.Mlimit */
|
|
44270
|
+
Mlimit: Infinity
|
|
44250
44271
|
};
|
|
44251
44272
|
var parms = {
|
|
44252
44273
|
useGrid: 0,
|
|
@@ -44574,8 +44595,8 @@ function placeByNeighbors(g, np, ctr) {
|
|
|
44574
44595
|
np.info.pos[0] = p.x;
|
|
44575
44596
|
np.info.pos[1] = p.y;
|
|
44576
44597
|
} else if (cnt === 1) {
|
|
44577
|
-
np.info.pos[0] = 0.98
|
|
44578
|
-
np.info.pos[1] = 0.9
|
|
44598
|
+
np.info.pos[0] = fma(0.98, p.x, 0.1 * ctr.x);
|
|
44599
|
+
np.info.pos[1] = fma(0.9, p.y, 0.1 * ctr.y);
|
|
44579
44600
|
} else {
|
|
44580
44601
|
const angle = Math.PI * 2 * drand48();
|
|
44581
44602
|
const radius = 0.9 * drand48();
|
|
@@ -44591,8 +44612,8 @@ function averagePlacedNeighbors(g, np, p) {
|
|
|
44591
44612
|
const op = ep.head === np ? ep.tail : ep.head;
|
|
44592
44613
|
if (!hasPos3(op)) continue;
|
|
44593
44614
|
if (cnt) {
|
|
44594
|
-
p.x = (p.x
|
|
44595
|
-
p.y = (p.y
|
|
44615
|
+
p.x = fma(p.x, cnt, op.info.pos[0]) / (cnt + 1);
|
|
44616
|
+
p.y = fma(p.y, cnt, op.info.pos[1]) / (cnt + 1);
|
|
44596
44617
|
} else {
|
|
44597
44618
|
p.x = op.info.pos[0];
|
|
44598
44619
|
p.y = op.info.pos[1];
|
|
@@ -44654,8 +44675,8 @@ function sizeBoundary(width, height) {
|
|
|
44654
44675
|
function placeWithPorts(g, pp, ctr) {
|
|
44655
44676
|
for (const port of pp) {
|
|
44656
44677
|
const np = port.n;
|
|
44657
|
-
np.info.pos[0] = parms.Wd
|
|
44658
|
-
np.info.pos[1] = parms.Ht
|
|
44678
|
+
np.info.pos[0] = fma(parms.Wd, Math.cos(port.alpha), ctr.x);
|
|
44679
|
+
np.info.pos[1] = fma(parms.Ht, Math.sin(port.alpha), ctr.y);
|
|
44659
44680
|
dndata(np).pinned = P_SET;
|
|
44660
44681
|
}
|
|
44661
44682
|
for (const np of g.nodes.values()) {
|
|
@@ -44717,19 +44738,20 @@ function coincidentDelta() {
|
|
|
44717
44738
|
} while (xdelta === 0 && ydelta === 0);
|
|
44718
44739
|
return { xdelta, ydelta };
|
|
44719
44740
|
}
|
|
44720
|
-
function doRep(p, q, xdelta, ydelta,
|
|
44741
|
+
function doRep(p, q, xdelta, ydelta, dist4) {
|
|
44721
44742
|
let force;
|
|
44722
|
-
if (
|
|
44743
|
+
if (!(dist4 > 0)) {
|
|
44723
44744
|
const d = coincidentDelta();
|
|
44724
44745
|
xdelta = d.xdelta;
|
|
44725
44746
|
ydelta = d.ydelta;
|
|
44726
|
-
|
|
44747
|
+
dist4 = libmHypot(xdelta, ydelta);
|
|
44727
44748
|
}
|
|
44728
|
-
if (
|
|
44729
|
-
|
|
44730
|
-
|
|
44749
|
+
if (dist4 > fdpParms.Mlimit) {
|
|
44750
|
+
force = 0;
|
|
44751
|
+
} else if (parms.useNew) {
|
|
44752
|
+
force = parms.K * parms.K / (dist4 * dist4 * dist4);
|
|
44731
44753
|
} else {
|
|
44732
|
-
force = parms.K * parms.K /
|
|
44754
|
+
force = parms.K * parms.K / (dist4 * dist4);
|
|
44733
44755
|
}
|
|
44734
44756
|
if (isPort(p) && isPort(q)) force *= 10;
|
|
44735
44757
|
const dq = disp(q);
|
|
@@ -44742,7 +44764,7 @@ function doRep(p, q, xdelta, ydelta, dist22) {
|
|
|
44742
44764
|
function applyRep(p, q) {
|
|
44743
44765
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44744
44766
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44745
|
-
doRep(p, q, xdelta, ydelta,
|
|
44767
|
+
doRep(p, q, xdelta, ydelta, libmHypot(xdelta, ydelta));
|
|
44746
44768
|
}
|
|
44747
44769
|
function doNeighbor(grid2, i, j, nodes) {
|
|
44748
44770
|
const cellp = grid2.find(i, j);
|
|
@@ -44751,8 +44773,8 @@ function doNeighbor(grid2, i, j, nodes) {
|
|
|
44751
44773
|
for (const q of cellp.nodes) {
|
|
44752
44774
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44753
44775
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44754
|
-
const
|
|
44755
|
-
if (
|
|
44776
|
+
const dist4 = libmHypot(xdelta, ydelta);
|
|
44777
|
+
if (dist4 < parms.Cell) doRep(p, q, xdelta, ydelta, dist4);
|
|
44756
44778
|
}
|
|
44757
44779
|
}
|
|
44758
44780
|
}
|
|
@@ -44924,7 +44946,7 @@ function ht2(n) {
|
|
|
44924
44946
|
return xMarg.doAdd ? n.info.height / 2 + xMarg.y : n.info.height * xMarg.y / 2;
|
|
44925
44947
|
}
|
|
44926
44948
|
function rad(n) {
|
|
44927
|
-
return
|
|
44949
|
+
return libmHypot(wd2(n), ht2(n));
|
|
44928
44950
|
}
|
|
44929
44951
|
function xinitParams(n, xpms) {
|
|
44930
44952
|
xParams.K = xpms.K;
|
|
@@ -44959,37 +44981,38 @@ function cntOverlaps(g) {
|
|
|
44959
44981
|
function applyRep2(p, q, rs) {
|
|
44960
44982
|
let xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44961
44983
|
let ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44962
|
-
let
|
|
44963
|
-
if (
|
|
44984
|
+
let dist4 = libmHypot(xdelta, ydelta);
|
|
44985
|
+
if (!(dist4 > 0)) {
|
|
44964
44986
|
const d = coincidentDelta();
|
|
44965
44987
|
xdelta = d.xdelta;
|
|
44966
44988
|
ydelta = d.ydelta;
|
|
44967
|
-
|
|
44989
|
+
dist4 = libmHypot(xdelta, ydelta);
|
|
44968
44990
|
}
|
|
44969
44991
|
const ov = overlap4(p, q) ? 1 : 0;
|
|
44970
|
-
|
|
44992
|
+
let force = ov ? rs.ov / (dist4 * dist4) : rs.nonov / (dist4 * dist4);
|
|
44993
|
+
if (dist4 > fdpParms.Mlimit) force = 0;
|
|
44971
44994
|
const dq = disp(q);
|
|
44972
44995
|
const dp = disp(p);
|
|
44973
|
-
dq[0]
|
|
44974
|
-
dq[1]
|
|
44975
|
-
dp[0]
|
|
44976
|
-
dp[1]
|
|
44996
|
+
dq[0] = fma(xdelta, force, dq[0]);
|
|
44997
|
+
dq[1] = fma(ydelta, force, dq[1]);
|
|
44998
|
+
dp[0] = fms(xdelta, force, dp[0]);
|
|
44999
|
+
dp[1] = fms(ydelta, force, dp[1]);
|
|
44977
45000
|
return ov;
|
|
44978
45001
|
}
|
|
44979
45002
|
function applyAttr2(p, q) {
|
|
44980
45003
|
if (overlap4(p, q)) return;
|
|
44981
45004
|
const xdelta = q.info.pos[0] - p.info.pos[0];
|
|
44982
45005
|
const ydelta = q.info.pos[1] - p.info.pos[1];
|
|
44983
|
-
const dist4 =
|
|
45006
|
+
const dist4 = libmHypot(xdelta, ydelta);
|
|
44984
45007
|
const din = rad(p) + rad(q);
|
|
44985
45008
|
const dout = dist4 - din;
|
|
44986
45009
|
const force = dout * dout / ((xParams.K + din) * dist4);
|
|
44987
45010
|
const dq = disp(q);
|
|
44988
45011
|
const dp = disp(p);
|
|
44989
|
-
dq[0]
|
|
44990
|
-
dq[1]
|
|
44991
|
-
dp[0]
|
|
44992
|
-
dp[1]
|
|
45012
|
+
dq[0] = fms(xdelta, force, dq[0]);
|
|
45013
|
+
dq[1] = fms(ydelta, force, dq[1]);
|
|
45014
|
+
dp[0] = fma(xdelta, force, dp[0]);
|
|
45015
|
+
dp[1] = fma(ydelta, force, dp[1]);
|
|
44993
45016
|
}
|
|
44994
45017
|
function accumForces(g, rs) {
|
|
44995
45018
|
let overlaps2 = 0;
|
|
@@ -45011,7 +45034,7 @@ function moveNodes(g, temp) {
|
|
|
45011
45034
|
if (dndata(n).pinned === P_PIN) continue;
|
|
45012
45035
|
const dx = disp(n)[0];
|
|
45013
45036
|
const dy = disp(n)[1];
|
|
45014
|
-
const len2 = dx
|
|
45037
|
+
const len2 = fma(dx, dx, dy * dy);
|
|
45015
45038
|
if (len2 < temp2) {
|
|
45016
45039
|
n.info.pos[0] += dx;
|
|
45017
45040
|
n.info.pos[1] += dy;
|
|
@@ -45265,7 +45288,7 @@ function deriveClusterNodes(g, dg, infop) {
|
|
|
45265
45288
|
}
|
|
45266
45289
|
}
|
|
45267
45290
|
function deriveRealNodes(g, dg) {
|
|
45268
|
-
for (const n of g
|
|
45291
|
+
for (const n of nodesInSeq(g)) {
|
|
45269
45292
|
if (getDnode(n) !== null) continue;
|
|
45270
45293
|
const par = getParent(n);
|
|
45271
45294
|
if (par !== null && par !== gdata(g).parent) {
|
|
@@ -45307,7 +45330,7 @@ function deriveEdge(dg, byPair, tl, hd) {
|
|
|
45307
45330
|
return de;
|
|
45308
45331
|
}
|
|
45309
45332
|
function deriveEdges(g, dg, byPair) {
|
|
45310
|
-
for (const n of g
|
|
45333
|
+
for (const n of nodesInSeq(g)) {
|
|
45311
45334
|
const tl = getDnode(n);
|
|
45312
45335
|
for (const e of n.outEdges(g)) {
|
|
45313
45336
|
const hd = getDnode(e.head);
|