@knowvah/dot-engine 2.8.1 → 2.9.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/graph-init.d.ts.map +1 -1
- package/dist/common/poly-gencode.d.ts.map +1 -1
- package/dist/common/poly-init.d.ts +3 -2
- package/dist/common/poly-init.d.ts.map +1 -1
- package/dist/common/safefile.d.ts +23 -0
- package/dist/common/safefile.d.ts.map +1 -0
- package/dist/common/shapes.d.ts +6 -6
- package/dist/common/shapes.d.ts.map +1 -1
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/image-type.d.ts +41 -0
- package/dist/gvc/image-type.d.ts.map +1 -0
- package/dist/gvc/render-usershape.d.ts +8 -0
- package/dist/gvc/render-usershape.d.ts.map +1 -1
- package/dist/gvc/usershape.d.ts +23 -1
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/index.js +8328 -6979
- package/dist/index.js.map +4 -4
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts +118 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts +39 -0
- package/dist/layout/neato/__fixtures__/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/circuit.d.ts +10 -0
- package/dist/layout/neato/circuit.d.ts.map +1 -0
- package/dist/layout/neato/init.d.ts +3 -2
- package/dist/layout/neato/init.d.ts.map +1 -1
- package/dist/layout/neato/ipsep-opts.d.ts +19 -0
- package/dist/layout/neato/ipsep-opts.d.ts.map +1 -0
- package/dist/layout/neato/lu.d.ts +35 -0
- package/dist/layout/neato/lu.d.ts.map +1 -0
- package/dist/layout/neato/matinv.d.ts +8 -0
- package/dist/layout/neato/matinv.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts +35 -0
- package/dist/layout/neato/quad-prog-vpsc-overlap.d.ts.map +1 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts +110 -0
- package/dist/layout/neato/quad-prog-vpsc.d.ts.map +1 -0
- package/dist/layout/neato/start.d.ts +5 -4
- package/dist/layout/neato/start.d.ts.map +1 -1
- package/dist/layout/neato/stress-cola.d.ts +65 -0
- package/dist/layout/neato/stress-cola.d.ts.map +1 -0
- package/dist/layout/neato/stress-kernel.d.ts +0 -2
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -1
- package/dist/layout/neato/stress-models.d.ts +48 -0
- package/dist/layout/neato/stress-models.d.ts.map +1 -0
- package/dist/layout/neato/vpsc-adjust.d.ts +7 -8
- package/dist/layout/neato/vpsc-adjust.d.ts.map +1 -1
- package/dist/render/color-resolve.d.ts +14 -0
- package/dist/render/color-resolve.d.ts.map +1 -1
- package/dist/render/dot/edge-draw.d.ts.map +1 -1
- package/dist/render/svg-arrow-ops.d.ts +21 -4
- package/dist/render/svg-arrow-ops.d.ts.map +1 -1
- package/dist/render/svg-edge-arrows.d.ts +3 -3
- package/dist/render/svg-edge-arrows.d.ts.map +1 -1
- package/dist/render/svg-helpers.d.ts +1 -1
- package/dist/render/svg-helpers.d.ts.map +1 -1
- package/dist/render/svg.d.ts.map +1 -1
- package/dist/render.js +8318 -6969
- package/dist/render.js.map +4 -4
- package/package.json +1 -1
- package/src/common/graph-init.ts +4 -2
- package/src/common/poly-gencode.ts +2 -1
- package/src/common/poly-init.ts +21 -12
- package/src/common/safefile.ts +74 -0
- package/src/common/shapes.ts +43 -22
- package/src/gvc/__fixtures__/p7/colors/98-point.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json +54 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg +17 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot +13 -0
- package/src/gvc/__fixtures__/p7/colors/98-point.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json +150 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot +22 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-color.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.json.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge-red-colon.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.gv +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json +149 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg +30 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot +21 -0
- package/src/gvc/__fixtures__/p7/colors/99-edge.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/100-rotate.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-bad.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-gif.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-jpg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-png.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-png.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-png.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-png.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-png.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-png.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.cmapx.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.dot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json +70 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.json.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.plain.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svg.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.cmapx.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot +8 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.dot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json +68 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.json.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain +3 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.plain.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/101-svgbare.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-abs.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-found.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-missing.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.svg.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot +15 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-shapefile.xdot.stderr +2 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.svg.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/102-ip-two.xdot.stderr +0 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg +18 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot +13 -0
- package/src/gvc/__fixtures__/p7/images/97-custom.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.gv +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg +19 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.svg.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot +14 -0
- package/src/gvc/__fixtures__/p7/images/97-nosuch-image.xdot.stderr +1 -0
- package/src/gvc/__fixtures__/p7/images/bad.png +1 -0
- package/src/gvc/__fixtures__/p7/images/d/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/d2/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/g.gif +0 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.gv +10 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg +25 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.svg.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot +30 -0
- package/src/gvc/__fixtures__/p7/images/graphs-val_val.xdot.stderr +3 -0
- package/src/gvc/__fixtures__/p7/images/j.jpg +0 -0
- package/src/gvc/__fixtures__/p7/images/r.png +0 -0
- package/src/gvc/__fixtures__/p7/images/s.svg +2 -0
- package/src/gvc/__fixtures__/p7/images/sb.svg +1 -0
- package/src/gvc/__fixtures__/p7/images/t.png +0 -0
- package/src/gvc/__fixtures__/p7/regen.sh +23 -0
- package/src/gvc/device.ts +11 -4
- package/src/gvc/image-type.ts +122 -0
- package/src/gvc/render-usershape.ts +52 -1
- package/src/gvc/usershape.ts +40 -1
- package/src/layout/neato/__fixtures__/ipsep/big-dired.gv +243 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.trace +55 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot +1832 -0
- package/src/layout/neato/__fixtures__/ipsep/big-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.trace +95 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot +58 -0
- package/src/layout/neato/__fixtures__/ipsep/cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.trace +40 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-levelsgap.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier-sep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-hier.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot +71 -0
- package/src/layout/neato/__fixtures__/ipsep/dired-true.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot +77 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-grid.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.trace +41 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot +68 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-k6.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.trace +42 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot +110 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot +108 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-rand.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/ipsep-tree.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot +48 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.trace +45 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot +47 -0
- package/src/layout/neato/__fixtures__/ipsep/kd-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.trace +44 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot +66 -0
- package/src/layout/neato/__fixtures__/ipsep/len-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.trace +46 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-circuit.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds-len.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.trace +52 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-mds.xdot.stderr +2 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.trace +49 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot +83 -0
- package/src/layout/neato/__fixtures__/ipsep/model-subset.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.trace +211 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-ipsep.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.trace +50 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot +60 -0
- package/src/layout/neato/__fixtures__/ipsep/overlap-vpsc.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.trace +51 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot +72 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self-dired.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.gv +1 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.trace +43 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot +84 -0
- package/src/layout/neato/__fixtures__/ipsep/start-self.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc.ts +109 -0
- package/src/layout/neato/__fixtures__/stress-models.ts +64 -0
- package/src/layout/neato/circuit.ts +31 -0
- package/src/layout/neato/index.ts +2 -2
- package/src/layout/neato/init.ts +25 -34
- package/src/layout/neato/ipsep-opts.ts +158 -0
- package/src/layout/neato/lu.ts +189 -0
- package/src/layout/neato/matinv.ts +37 -0
- package/src/layout/neato/quad-prog-vpsc-overlap.ts +365 -0
- package/src/layout/neato/quad-prog-vpsc.ts +416 -0
- package/src/layout/neato/start.ts +9 -24
- package/src/layout/neato/stress-cola.ts +497 -0
- package/src/layout/neato/stress-kernel.ts +1 -17
- package/src/layout/neato/stress-models.ts +212 -0
- package/src/layout/neato/vpsc-adjust.ts +35 -66
- package/src/render/color-resolve.ts +25 -2
- package/src/render/dot/edge-draw.ts +7 -4
- package/src/render/svg-arrow-ops.ts +35 -19
- package/src/render/svg-edge-arrows.ts +7 -6
- package/src/render/svg-helpers.ts +19 -11
- package/src/render/svg.ts +15 -3
|
@@ -0,0 +1,365 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Non-overlap constraints, static overlap removal and DiG-CoLa level helpers
|
|
5
|
+
* of `lib/neatogen/quad_prog_vpsc.c`. The C file is split across this file
|
|
6
|
+
* and `quad-prog-vpsc.ts` only because of the file-length limit.
|
|
7
|
+
*
|
|
8
|
+
* `generateNonoverlapConstraints` is one 200-line C function; it is split here
|
|
9
|
+
* at its own phase boundaries (node boxes, per-cluster constraints, top-level
|
|
10
|
+
* constraints and their remap, removal of the previous pass, merge with the
|
|
11
|
+
* global constraints), keeping statement order. Its six C parameters travel as
|
|
12
|
+
* {@link NonoverlapArgs} (five-parameter limit). The bounding-box arithmetic
|
|
13
|
+
* is plain double (no fused operations in the 16.1 build).
|
|
14
|
+
*
|
|
15
|
+
* `remapInConstraints` / `remapOutConstraints` (`csolve_VPSC.cpp`) have no
|
|
16
|
+
* port under `src/vpsc/`; their only caller is here, so they are ported here.
|
|
17
|
+
*
|
|
18
|
+
* @see lib/neatogen/quad_prog_vpsc.c
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
import type { Box } from '../../model/geom.js';
|
|
22
|
+
import {
|
|
23
|
+
Rectangle,
|
|
24
|
+
newVariable,
|
|
25
|
+
newIncVPSC,
|
|
26
|
+
deleteVPSC,
|
|
27
|
+
deleteConstraint,
|
|
28
|
+
deleteVariable,
|
|
29
|
+
solveVPSC,
|
|
30
|
+
getVariablePos,
|
|
31
|
+
genXConstraints,
|
|
32
|
+
genYConstraints,
|
|
33
|
+
type Constraint,
|
|
34
|
+
type Variable,
|
|
35
|
+
} from '../../vpsc/index.js';
|
|
36
|
+
import { fmaxf, fminf } from './quad-prog-solve.js';
|
|
37
|
+
import {
|
|
38
|
+
deleteCMajEnvVPSC,
|
|
39
|
+
initCMajVPSC,
|
|
40
|
+
type CMajEnvVPSC,
|
|
41
|
+
type DigColaLevel,
|
|
42
|
+
type IpsepOptions,
|
|
43
|
+
} from './quad-prog-vpsc.js';
|
|
44
|
+
|
|
45
|
+
const fr = Math.fround;
|
|
46
|
+
|
|
47
|
+
/** Grow nodes in x so a horizontally resolved overlap is not also vertical (a C `float`). */
|
|
48
|
+
const X_GROWTH = fr(1.0001);
|
|
49
|
+
/** Width of a cluster's boundary-variable box. */
|
|
50
|
+
const BOUNDARY_WIDTH = 0.0001;
|
|
51
|
+
/** First id of the temporary top-level cluster variables. */
|
|
52
|
+
const TMP_CLUSTER_VAR_ID = 123;
|
|
53
|
+
|
|
54
|
+
/** `generateNonoverlapConstraints`' parameters after `e`, in C order. */
|
|
55
|
+
export interface NonoverlapArgs {
|
|
56
|
+
nsizeScale: number;
|
|
57
|
+
coords: Float32Array[];
|
|
58
|
+
/** 0 = x, 1 = y. */
|
|
59
|
+
k: 0 | 1;
|
|
60
|
+
transitiveClosure: boolean;
|
|
61
|
+
opt: IpsepOptions;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/** C struct copy of a `boxf` (`B2BF`). @see lib/common/geom.h:B2BF */
|
|
65
|
+
function copyBox(b: Box): Box {
|
|
66
|
+
return { ll: { x: b.ll.x, y: b.ll.y }, ur: { x: b.ur.x, y: b.ur.y } };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/** @see lib/common/geomprocs.h:expandbbf */
|
|
70
|
+
function expandBox(b0: Box, b1: Box): void {
|
|
71
|
+
b0.ll.x = fminf(b0.ll.x, b1.ll.x);
|
|
72
|
+
b0.ll.y = fminf(b0.ll.y, b1.ll.y);
|
|
73
|
+
b0.ur.x = fmaxf(b0.ur.x, b1.ur.x);
|
|
74
|
+
b0.ur.y = fmaxf(b0.ur.y, b1.ur.y);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @see lib/vpsc/csolve_VPSC.cpp:genXConstraints */
|
|
78
|
+
function genX(n: number, bb: Box[], vs: Variable[], transitiveClosure: boolean): Constraint[] {
|
|
79
|
+
const rs: Rectangle[] = [];
|
|
80
|
+
for (let i = 0; i < n; i++) {
|
|
81
|
+
rs.push(new Rectangle(bb[i]!.ll.x, bb[i]!.ur.x, bb[i]!.ll.y, bb[i]!.ur.y));
|
|
82
|
+
}
|
|
83
|
+
return genXConstraints(rs, vs, transitiveClosure);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** @see lib/vpsc/csolve_VPSC.cpp:genYConstraints */
|
|
87
|
+
function genY(n: number, bb: Box[], vs: Variable[]): Constraint[] {
|
|
88
|
+
const rs: Rectangle[] = [];
|
|
89
|
+
for (let i = 0; i < n; i++) {
|
|
90
|
+
rs.push(new Rectangle(bb[i]!.ll.x, bb[i]!.ur.x, bb[i]!.ll.y, bb[i]!.ur.y));
|
|
91
|
+
}
|
|
92
|
+
return genYConstraints(rs, vs);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** @see lib/vpsc/csolve_VPSC.cpp:remapInConstraints */
|
|
96
|
+
function remapInConstraints(u: Variable, v: Variable, dgap: number): void {
|
|
97
|
+
for (const c of u.in) {
|
|
98
|
+
c.right = v;
|
|
99
|
+
c.gap += dgap;
|
|
100
|
+
v.in.push(c);
|
|
101
|
+
}
|
|
102
|
+
u.in.length = 0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** @see lib/vpsc/csolve_VPSC.cpp:remapOutConstraints */
|
|
106
|
+
function remapOutConstraints(u: Variable, v: Variable, dgap: number): void {
|
|
107
|
+
for (const c of u.out) {
|
|
108
|
+
c.left = v;
|
|
109
|
+
c.gap += dgap;
|
|
110
|
+
v.out.push(c);
|
|
111
|
+
}
|
|
112
|
+
u.out.length = 0;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Each real node's box: its size scaled by `nsizeScale`, plus half the gap.
|
|
117
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (382-398)
|
|
118
|
+
*/
|
|
119
|
+
function nodeBoxes(n: number, nsizeScale: number, a: NonoverlapArgs): Box[] {
|
|
120
|
+
const { coords, opt } = a;
|
|
121
|
+
const bb: Box[] = [];
|
|
122
|
+
for (let i = 0; i < n; i++) {
|
|
123
|
+
const s = opt.nsize[i]!;
|
|
124
|
+
bb.push({
|
|
125
|
+
ll: {
|
|
126
|
+
x: coords[0]![i]! - nsizeScale * s.x / 2.0 - opt.gap.x / 2.0,
|
|
127
|
+
y: coords[1]![i]! - nsizeScale * s.y / 2.0 - opt.gap.y / 2.0,
|
|
128
|
+
},
|
|
129
|
+
ur: {
|
|
130
|
+
x: coords[0]![i]! + nsizeScale * s.x / 2.0 + opt.gap.x / 2.0,
|
|
131
|
+
y: coords[1]![i]! + nsizeScale * s.y / 2.0 + opt.gap.y / 2.0,
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
return bb;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Non-overlap constraints inside cluster `i`, including its two boundary
|
|
140
|
+
* variables; records the cluster's bounding box in `opt.clusters.bb[i]`.
|
|
141
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (402-433)
|
|
142
|
+
*/
|
|
143
|
+
function clusterConstraints(e: CMajEnvVPSC, n: number, bb: Box[], a: NonoverlapArgs, i: number): Constraint[] {
|
|
144
|
+
const cl = a.opt.clusters;
|
|
145
|
+
const cn = cl.clustersizes[i]!;
|
|
146
|
+
const cvs: Variable[] = [];
|
|
147
|
+
const cbb: Box[] = [];
|
|
148
|
+
/* compute cluster bounding bb */
|
|
149
|
+
const container: Box = {
|
|
150
|
+
ll: { x: Number.MAX_VALUE, y: Number.MAX_VALUE }, ur: { x: -Number.MAX_VALUE, y: -Number.MAX_VALUE },
|
|
151
|
+
};
|
|
152
|
+
for (let j = 0; j < cn; j++) {
|
|
153
|
+
const iv = cl.clusters[i]![j]!;
|
|
154
|
+
cvs[j] = e.vs[iv]!;
|
|
155
|
+
cbb[j] = copyBox(bb[iv]!);
|
|
156
|
+
expandBox(container, bb[iv]!);
|
|
157
|
+
}
|
|
158
|
+
cl.bb[i] = copyBox(container);
|
|
159
|
+
cvs[cn] = e.vs[n + 2 * i]!;
|
|
160
|
+
cvs[cn + 1] = e.vs[n + 2 * i + 1]!;
|
|
161
|
+
cbb[cn] = copyBox(container);
|
|
162
|
+
cbb[cn + 1] = copyBox(container);
|
|
163
|
+
if (a.k === 0) {
|
|
164
|
+
cbb[cn]!.ur.x = container.ll.x + BOUNDARY_WIDTH;
|
|
165
|
+
cbb[cn + 1]!.ll.x = container.ur.x - BOUNDARY_WIDTH;
|
|
166
|
+
return genX(cn + 2, cbb, cvs, a.transitiveClosure);
|
|
167
|
+
}
|
|
168
|
+
cbb[cn]!.ur.y = container.ll.y + BOUNDARY_WIDTH;
|
|
169
|
+
cbb[cn + 1]!.ll.y = container.ur.y - BOUNDARY_WIDTH;
|
|
170
|
+
return genY(cn + 2, cbb, cvs);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Remap the constraints of each temporary cluster variable to the cluster's
|
|
175
|
+
* left (in-constraints) and right (out-constraints) boundary variables.
|
|
176
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (458-497)
|
|
177
|
+
*/
|
|
178
|
+
function remapClusterVars(e: CMajEnvVPSC, n: number, cvs: Variable[], cbb: Box[], a: NonoverlapArgs): void {
|
|
179
|
+
const ntop = a.opt.clusters.ntoplevel;
|
|
180
|
+
for (let i = ntop; i < cvs.length; i++) {
|
|
181
|
+
const j = i - ntop;
|
|
182
|
+
/* dgap is the change in required constraint gap.
|
|
183
|
+
* since we are going from a source rectangle the size
|
|
184
|
+
* of the cluster bounding box to a zero width (in x dim,
|
|
185
|
+
* zero height in y dim) rectangle, the change will be
|
|
186
|
+
* half the bb width.
|
|
187
|
+
*/
|
|
188
|
+
const dgap = a.k === 0
|
|
189
|
+
? -(cbb[i]!.ur.x - cbb[i]!.ll.x) / 2.0
|
|
190
|
+
: -(cbb[i]!.ur.y - cbb[i]!.ll.y) / 2.0;
|
|
191
|
+
remapInConstraints(cvs[i]!, e.vs[n + 2 * j]!, dgap);
|
|
192
|
+
remapOutConstraints(cvs[i]!, e.vs[n + 2 * j + 1]!, dgap);
|
|
193
|
+
deleteVariable(cvs[i]!);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Top-level non-overlap constraints between nodes in no cluster and the
|
|
199
|
+
* clusters as rectangles, mapped back to the boundary variables.
|
|
200
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (435-500)
|
|
201
|
+
*/
|
|
202
|
+
function topLevelConstraints(e: CMajEnvVPSC, n: number, bb: Box[], a: NonoverlapArgs): Constraint[] {
|
|
203
|
+
const cl = a.opt.clusters;
|
|
204
|
+
const cn = cl.ntoplevel + cl.nclusters;
|
|
205
|
+
const cvs: Variable[] = [];
|
|
206
|
+
const cbb: Box[] = [];
|
|
207
|
+
for (let i = 0; i < cl.ntoplevel; i++) {
|
|
208
|
+
const iv = cl.toplevel[i]!;
|
|
209
|
+
cvs[i] = e.vs[iv]!;
|
|
210
|
+
cbb[i] = copyBox(bb[iv]!);
|
|
211
|
+
}
|
|
212
|
+
/* make dummy variables for clusters */
|
|
213
|
+
for (let i = cl.ntoplevel; i < cn; i++) {
|
|
214
|
+
cvs[i] = newVariable(TMP_CLUSTER_VAR_ID + i, 1, 1);
|
|
215
|
+
const j = i - cl.ntoplevel;
|
|
216
|
+
cbb[i] = copyBox(cl.bb[j]!);
|
|
217
|
+
}
|
|
218
|
+
const cs = a.k === 0 ? genX(cn, cbb, cvs, a.transitiveClosure) : genY(cn, cbb, cvs);
|
|
219
|
+
/* remap constraints from tmp dummy vars to cluster l and r vars */
|
|
220
|
+
remapClusterVars(e, n, cvs, cbb, a);
|
|
221
|
+
return cs;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Constraints of every cluster, then the top-level ones, as one array.
|
|
226
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (399-511)
|
|
227
|
+
*/
|
|
228
|
+
function clusteredConstraints(e: CMajEnvVPSC, n: number, bb: Box[], a: NonoverlapArgs): Constraint[] {
|
|
229
|
+
const cscl: Constraint[][] = [];
|
|
230
|
+
for (let i = 0; i < a.opt.clusters.nclusters; i++) {
|
|
231
|
+
cscl[i] = clusterConstraints(e, n, bb, a, i);
|
|
232
|
+
}
|
|
233
|
+
/* generate top level constraints */
|
|
234
|
+
cscl[a.opt.clusters.nclusters] = topLevelConstraints(e, n, bb, a);
|
|
235
|
+
const csol: Constraint[] = [];
|
|
236
|
+
for (const cs of cscl) {
|
|
237
|
+
/* copy constraints into csol */
|
|
238
|
+
for (const c of cs) csol.push(c);
|
|
239
|
+
}
|
|
240
|
+
return csol;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Remove the overlap constraints of the previous pass (global ones stay).
|
|
245
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints (518-529)
|
|
246
|
+
*/
|
|
247
|
+
function removePrevious(e: CMajEnvVPSC): void {
|
|
248
|
+
if (e.m > 0) {
|
|
249
|
+
/* can't reuse instance of VPSC when constraints change! */
|
|
250
|
+
deleteVPSC(e.vpsc!);
|
|
251
|
+
for (let i = e.gm; i < e.m; i++) {
|
|
252
|
+
/* delete previous overlap constraints */
|
|
253
|
+
deleteConstraint(e.cs![i]!);
|
|
254
|
+
}
|
|
255
|
+
/* just delete the array, not the elements (C deleteConstraints(0, e->cs)) */
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Generate non-overlap constraints for the nodes (and, with clusters, inside
|
|
261
|
+
* each cluster including its boundary variables, then between top-level
|
|
262
|
+
* nodes and clusters treated as rectangles), replacing the previous pass's
|
|
263
|
+
* and keeping the global constraints first.
|
|
264
|
+
* @see lib/neatogen/quad_prog_vpsc.c:generateNonoverlapConstraints
|
|
265
|
+
*/
|
|
266
|
+
export function generateNonoverlapConstraints(e: CMajEnvVPSC, a: NonoverlapArgs): void {
|
|
267
|
+
let n = e.nv + e.nldv;
|
|
268
|
+
let nsizeScale = a.nsizeScale;
|
|
269
|
+
const genclusters = a.opt.clusters.nclusters > 0;
|
|
270
|
+
if (genclusters) {
|
|
271
|
+
/* n is the number of real variables, not dummy cluster vars */
|
|
272
|
+
n -= 2 * a.opt.clusters.nclusters;
|
|
273
|
+
}
|
|
274
|
+
if (a.k === 0) {
|
|
275
|
+
/* grow a bit in the x dimension, so that if overlap is resolved
|
|
276
|
+
* horizontally then it won't be considered overlapping vertically
|
|
277
|
+
*/
|
|
278
|
+
nsizeScale = fr(nsizeScale * X_GROWTH);
|
|
279
|
+
}
|
|
280
|
+
const bb = nodeBoxes(n, nsizeScale, a);
|
|
281
|
+
let csol: Constraint[];
|
|
282
|
+
if (genclusters) {
|
|
283
|
+
csol = clusteredConstraints(e, n, bb, a);
|
|
284
|
+
} else if (a.k === 0) {
|
|
285
|
+
csol = genX(n, bb, e.vs, a.transitiveClosure);
|
|
286
|
+
} else {
|
|
287
|
+
csol = genY(n, bb, e.vs);
|
|
288
|
+
}
|
|
289
|
+
removePrevious(e);
|
|
290
|
+
/* if we have no global constraints then the overlap constraints
|
|
291
|
+
* are all we have to worry about.
|
|
292
|
+
* Otherwise, we have to copy the global and overlap constraints
|
|
293
|
+
* into the one array
|
|
294
|
+
*/
|
|
295
|
+
if (e.gm === 0) {
|
|
296
|
+
e.m = csol.length;
|
|
297
|
+
e.cs = csol;
|
|
298
|
+
} else {
|
|
299
|
+
e.m = csol.length + e.gm;
|
|
300
|
+
e.cs = [];
|
|
301
|
+
for (let i = 0; i < e.m; i++) {
|
|
302
|
+
e.cs[i] = i < e.gm ? e.gcs![i]! : csol[i - e.gm]!;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
e.vpsc = newIncVPSC(e.vs, e.cs);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Statically remove overlaps: move each node as little as possible.
|
|
310
|
+
* @see lib/neatogen/quad_prog_vpsc.c:removeoverlaps
|
|
311
|
+
*/
|
|
312
|
+
export function removeoverlaps(n: number, coords: Float32Array[], opt: IpsepOptions): void {
|
|
313
|
+
// diredges 0 never reaches compute_hierarchy, so this is never null.
|
|
314
|
+
const e = initCMajVPSC(n, null, null, opt, 0)!;
|
|
315
|
+
generateNonoverlapConstraints(e, { nsizeScale: 1.0, coords, k: 0, transitiveClosure: true, opt });
|
|
316
|
+
solveVPSC(e.vpsc!);
|
|
317
|
+
for (let i = 0; i < n; i++) {
|
|
318
|
+
coords[0]![i] = getVariablePos(e.vs[i]!);
|
|
319
|
+
}
|
|
320
|
+
generateNonoverlapConstraints(e, { nsizeScale: 1.0, coords, k: 1, transitiveClosure: false, opt });
|
|
321
|
+
solveVPSC(e.vpsc!);
|
|
322
|
+
for (let i = 0; i < n; i++) {
|
|
323
|
+
coords[1]![i] = getVariablePos(e.vs[i]!);
|
|
324
|
+
}
|
|
325
|
+
deleteCMajEnvVPSC(e);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Unpack `ordering` into one level per division (plus the last).
|
|
330
|
+
* @see lib/neatogen/quad_prog_vpsc.c:assign_digcola_levels
|
|
331
|
+
*/
|
|
332
|
+
export function assignDigcolaLevels(
|
|
333
|
+
ordering: Int32Array, n: number, levelInds: Int32Array, numDivisions: number,
|
|
334
|
+
): DigColaLevel[] {
|
|
335
|
+
const level = (numNodes: number, from: number): DigColaLevel => {
|
|
336
|
+
const nodes = new Int32Array(numNodes);
|
|
337
|
+
for (let j = 0; j < numNodes; j++) nodes[j] = ordering[from + j]!;
|
|
338
|
+
return { nodes, numNodes };
|
|
339
|
+
};
|
|
340
|
+
/* first level */
|
|
341
|
+
const l: DigColaLevel[] = [level(levelInds[0]!, 0)];
|
|
342
|
+
/* second through second last level */
|
|
343
|
+
for (let i = 1; i < numDivisions; i++) {
|
|
344
|
+
l[i] = level(levelInds[i]! - levelInds[i - 1]!, levelInds[i - 1]!);
|
|
345
|
+
}
|
|
346
|
+
/* last level */
|
|
347
|
+
if (numDivisions > 0) {
|
|
348
|
+
l[numDivisions] = level(n - levelInds[numDivisions - 1]!, levelInds[numDivisions - 1]!);
|
|
349
|
+
}
|
|
350
|
+
return l;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Number of separation constraints from the level sizes:
|
|
355
|
+
* `Σ_{i=1}^{num_levels-1} (|L[i]| + |L[i-1]|) + |L[0]| + |L[num_levels-1]|`.
|
|
356
|
+
* @see lib/neatogen/quad_prog_vpsc.c:get_num_digcola_constraints
|
|
357
|
+
*/
|
|
358
|
+
export function getNumDigcolaConstraints(levels: DigColaLevel[], numLevels: number): number {
|
|
359
|
+
let nc = 0;
|
|
360
|
+
for (let i = 1; i < numLevels; i++) {
|
|
361
|
+
nc += levels[i]!.numNodes + levels[i - 1]!.numNodes;
|
|
362
|
+
}
|
|
363
|
+
nc += levels[0]!.numNodes + levels[numLevels - 1]!.numNodes;
|
|
364
|
+
return nc;
|
|
365
|
+
}
|