@knowvah/dot-engine 0.1.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/LICENSE +277 -0
- package/README.md +292 -0
- package/dist/api/builder.d.ts +78 -0
- package/dist/api/builder.d.ts.map +1 -0
- package/dist/api/edge-ops.d.ts +45 -0
- package/dist/api/edge-ops.d.ts.map +1 -0
- package/dist/api/geometry.d.ts +159 -0
- package/dist/api/geometry.d.ts.map +1 -0
- package/dist/api/index.d.ts +24 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api.js +719 -0
- package/dist/api.js.map +7 -0
- package/dist/bundle.js +101 -0
- package/dist/cdt/bag.d.ts +58 -0
- package/dist/cdt/bag.d.ts.map +1 -0
- package/dist/cdt/hash-core.d.ts +40 -0
- package/dist/cdt/hash-core.d.ts.map +1 -0
- package/dist/cdt/hash.d.ts +74 -0
- package/dist/cdt/hash.d.ts.map +1 -0
- package/dist/cdt/index.d.ts +16 -0
- package/dist/cdt/index.d.ts.map +1 -0
- package/dist/cdt/splay-core.d.ts +78 -0
- package/dist/cdt/splay-core.d.ts.map +1 -0
- package/dist/cdt/splay.d.ts +63 -0
- package/dist/cdt/splay.d.ts.map +1 -0
- package/dist/cdt/strhash.d.ts +26 -0
- package/dist/cdt/strhash.d.ts.map +1 -0
- package/dist/cdt/types.d.ts +11 -0
- package/dist/cdt/types.d.ts.map +1 -0
- package/dist/common/arith.d.ts +35 -0
- package/dist/common/arith.d.ts.map +1 -0
- package/dist/common/arm-pow-data.d.ts +17 -0
- package/dist/common/arm-pow-data.d.ts.map +1 -0
- package/dist/common/arm-pow.d.ts +12 -0
- package/dist/common/arm-pow.d.ts.map +1 -0
- package/dist/common/arrows-constants.d.ts +97 -0
- package/dist/common/arrows-constants.d.ts.map +1 -0
- package/dist/common/arrows-geometry.d.ts +24 -0
- package/dist/common/arrows-geometry.d.ts.map +1 -0
- package/dist/common/arrows-miter.d.ts +24 -0
- package/dist/common/arrows-miter.d.ts.map +1 -0
- package/dist/common/arrows-shapes-poly.d.ts +24 -0
- package/dist/common/arrows-shapes-poly.d.ts.map +1 -0
- package/dist/common/arrows-shapes-util.d.ts +77 -0
- package/dist/common/arrows-shapes-util.d.ts.map +1 -0
- package/dist/common/arrows-shapes.d.ts +48 -0
- package/dist/common/arrows-shapes.d.ts.map +1 -0
- package/dist/common/arrows-types.d.ts +59 -0
- package/dist/common/arrows-types.d.ts.map +1 -0
- package/dist/common/arrows.d.ts +69 -0
- package/dist/common/arrows.d.ts.map +1 -0
- package/dist/common/color.d.ts +66 -0
- package/dist/common/color.d.ts.map +1 -0
- package/dist/common/colorData.d.ts +10 -0
- package/dist/common/colorData.d.ts.map +1 -0
- package/dist/common/compass-port.d.ts +39 -0
- package/dist/common/compass-port.d.ts.map +1 -0
- package/dist/common/crand.d.ts +42 -0
- package/dist/common/crand.d.ts.map +1 -0
- package/dist/common/edge-label-init.d.ts +51 -0
- package/dist/common/edge-label-init.d.ts.map +1 -0
- package/dist/common/edge-offset.d.ts +66 -0
- package/dist/common/edge-offset.d.ts.map +1 -0
- package/dist/common/ellipse-wedge.d.ts +10 -0
- package/dist/common/ellipse-wedge.d.ts.map +1 -0
- package/dist/common/emit-types.d.ts +255 -0
- package/dist/common/emit-types.d.ts.map +1 -0
- package/dist/common/fma.d.ts +10 -0
- package/dist/common/fma.d.ts.map +1 -0
- package/dist/common/graph-init.d.ts +61 -0
- package/dist/common/graph-init.d.ts.map +1 -0
- package/dist/common/html-entities.d.ts +17 -0
- package/dist/common/html-entities.d.ts.map +1 -0
- package/dist/common/html-string.d.ts +14 -0
- package/dist/common/html-string.d.ts.map +1 -0
- package/dist/common/htmltable-emit-fill.d.ts +84 -0
- package/dist/common/htmltable-emit-fill.d.ts.map +1 -0
- package/dist/common/htmltable-emit-rules.d.ts +79 -0
- package/dist/common/htmltable-emit-rules.d.ts.map +1 -0
- package/dist/common/htmltable-emit.d.ts +63 -0
- package/dist/common/htmltable-emit.d.ts.map +1 -0
- package/dist/common/htmltable-lex.d.ts +16 -0
- package/dist/common/htmltable-lex.d.ts.map +1 -0
- package/dist/common/htmltable-parse.d.ts +37 -0
- package/dist/common/htmltable-parse.d.ts.map +1 -0
- package/dist/common/htmltable-port.d.ts +15 -0
- package/dist/common/htmltable-port.d.ts.map +1 -0
- package/dist/common/htmltable-pos-runs.d.ts +88 -0
- package/dist/common/htmltable-pos-runs.d.ts.map +1 -0
- package/dist/common/htmltable-pos.d.ts +192 -0
- package/dist/common/htmltable-pos.d.ts.map +1 -0
- package/dist/common/htmltable-types.d.ts +237 -0
- package/dist/common/htmltable-types.d.ts.map +1 -0
- package/dist/common/htmltable.d.ts +74 -0
- package/dist/common/htmltable.d.ts.map +1 -0
- package/dist/common/layers.d.ts +20 -0
- package/dist/common/layers.d.ts.map +1 -0
- package/dist/common/make-label.d.ts +60 -0
- package/dist/common/make-label.d.ts.map +1 -0
- package/dist/common/multicolor.d.ts +46 -0
- package/dist/common/multicolor.d.ts.map +1 -0
- package/dist/common/nodeinit.d.ts +45 -0
- package/dist/common/nodeinit.d.ts.map +1 -0
- package/dist/common/poly-gencode.d.ts +40 -0
- package/dist/common/poly-gencode.d.ts.map +1 -0
- package/dist/common/poly-init.d.ts +51 -0
- package/dist/common/poly-init.d.ts.map +1 -0
- package/dist/common/poly-inside.d.ts +37 -0
- package/dist/common/poly-inside.d.ts.map +1 -0
- package/dist/common/poly-shapes-cases.d.ts +31 -0
- package/dist/common/poly-shapes-cases.d.ts.map +1 -0
- package/dist/common/poly-shapes-cases2.d.ts +25 -0
- package/dist/common/poly-shapes-cases2.d.ts.map +1 -0
- package/dist/common/poly-shapes-util.d.ts +42 -0
- package/dist/common/poly-shapes-util.d.ts.map +1 -0
- package/dist/common/poly-shapes.d.ts +39 -0
- package/dist/common/poly-shapes.d.ts.map +1 -0
- package/dist/common/poly-sizing.d.ts +189 -0
- package/dist/common/poly-sizing.d.ts.map +1 -0
- package/dist/common/poly-vertices.d.ts +42 -0
- package/dist/common/poly-vertices.d.ts.map +1 -0
- package/dist/common/postproc.d.ts +49 -0
- package/dist/common/postproc.d.ts.map +1 -0
- package/dist/common/ps-fontalias.d.ts +36 -0
- package/dist/common/ps-fontalias.d.ts.map +1 -0
- package/dist/common/random.d.ts +8 -0
- package/dist/common/random.d.ts.map +1 -0
- package/dist/common/record-port.d.ts +34 -0
- package/dist/common/record-port.d.ts.map +1 -0
- package/dist/common/record.d.ts +105 -0
- package/dist/common/record.d.ts.map +1 -0
- package/dist/common/shapeData.d.ts +186 -0
- package/dist/common/shapeData.d.ts.map +1 -0
- package/dist/common/shapes.d.ts +36 -0
- package/dist/common/shapes.d.ts.map +1 -0
- package/dist/common/spline-midpoint.d.ts +31 -0
- package/dist/common/spline-midpoint.d.ts.map +1 -0
- package/dist/common/splines-clip.d.ts +21 -0
- package/dist/common/splines-clip.d.ts.map +1 -0
- package/dist/common/splines-constants.d.ts +42 -0
- package/dist/common/splines-constants.d.ts.map +1 -0
- package/dist/common/splines-geom.d.ts +51 -0
- package/dist/common/splines-geom.d.ts.map +1 -0
- package/dist/common/splines-path-begin.d.ts +17 -0
- package/dist/common/splines-path-begin.d.ts.map +1 -0
- package/dist/common/splines-path-end.d.ts +17 -0
- package/dist/common/splines-path-end.d.ts.map +1 -0
- package/dist/common/splines-path-shared.d.ts +53 -0
- package/dist/common/splines-path-shared.d.ts.map +1 -0
- package/dist/common/splines-routespl.d.ts +40 -0
- package/dist/common/splines-routespl.d.ts.map +1 -0
- package/dist/common/splines-selfedge.d.ts +21 -0
- package/dist/common/splines-selfedge.d.ts.map +1 -0
- package/dist/common/splines.d.ts +18 -0
- package/dist/common/splines.d.ts.map +1 -0
- package/dist/common/style-resolve.d.ts +197 -0
- package/dist/common/style-resolve.d.ts.map +1 -0
- package/dist/common/subst.d.ts +31 -0
- package/dist/common/subst.d.ts.map +1 -0
- package/dist/common/taper.d.ts +23 -0
- package/dist/common/taper.d.ts.map +1 -0
- package/dist/common/textmeasure-factory.d.ts +33 -0
- package/dist/common/textmeasure-factory.d.ts.map +1 -0
- package/dist/common/textmeasure-lookup.d.ts +17 -0
- package/dist/common/textmeasure-lookup.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-a.d.ts +13 -0
- package/dist/common/textmeasure-lut-data-a.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-b.d.ts +12 -0
- package/dist/common/textmeasure-lut-data-b.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data-c.d.ts +13 -0
- package/dist/common/textmeasure-lut-data-c.d.ts.map +1 -0
- package/dist/common/textmeasure-lut-data.d.ts +27 -0
- package/dist/common/textmeasure-lut-data.d.ts.map +1 -0
- package/dist/common/textmeasure.d.ts +120 -0
- package/dist/common/textmeasure.d.ts.map +1 -0
- package/dist/common/types.d.ts +316 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/xlabels-place.d.ts +125 -0
- package/dist/common/xlabels-place.d.ts.map +1 -0
- package/dist/debug.d.ts +58 -0
- package/dist/debug.d.ts.map +1 -0
- package/dist/errors.d.ts +63 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/gvc/anchor.d.ts +86 -0
- package/dist/gvc/anchor.d.ts.map +1 -0
- package/dist/gvc/context.d.ts +177 -0
- package/dist/gvc/context.d.ts.map +1 -0
- package/dist/gvc/default-context.d.ts +20 -0
- package/dist/gvc/default-context.d.ts.map +1 -0
- package/dist/gvc/device-cluster.d.ts +25 -0
- package/dist/gvc/device-cluster.d.ts.map +1 -0
- package/dist/gvc/device.d.ts +99 -0
- package/dist/gvc/device.d.ts.map +1 -0
- package/dist/gvc/edge-labels.d.ts +10 -0
- package/dist/gvc/edge-labels.d.ts.map +1 -0
- package/dist/gvc/emit-walk.d.ts +22 -0
- package/dist/gvc/emit-walk.d.ts.map +1 -0
- package/dist/gvc/image-resolver.d.ts +44 -0
- package/dist/gvc/image-resolver.d.ts.map +1 -0
- package/dist/gvc/job.d.ts +234 -0
- package/dist/gvc/job.d.ts.map +1 -0
- package/dist/gvc/textlayout.d.ts +33 -0
- package/dist/gvc/textlayout.d.ts.map +1 -0
- package/dist/gvc/textspan-emit.d.ts +41 -0
- package/dist/gvc/textspan-emit.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +25 -0
- package/dist/gvc/usershape.d.ts.map +1 -0
- package/dist/gvc/viewport.d.ts +71 -0
- package/dist/gvc/viewport.d.ts.map +1 -0
- package/dist/index.d.ts +54 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52862 -0
- package/dist/index.js.map +7 -0
- package/dist/label/index.d.ts +74 -0
- package/dist/label/index.d.ts.map +1 -0
- package/dist/label/node.d.ts +108 -0
- package/dist/label/node.d.ts.map +1 -0
- package/dist/label/rectangle.d.ts +60 -0
- package/dist/label/rectangle.d.ts.map +1 -0
- package/dist/label/split-q.d.ts +13 -0
- package/dist/label/split-q.d.ts.map +1 -0
- package/dist/label/xlabels-geom.d.ts +46 -0
- package/dist/label/xlabels-geom.d.ts.map +1 -0
- package/dist/label/xlabels-intersect.d.ts +79 -0
- package/dist/label/xlabels-intersect.d.ts.map +1 -0
- package/dist/label/xlabels.d.ts +67 -0
- package/dist/label/xlabels.d.ts.map +1 -0
- package/dist/layout/circo/blockpath.d.ts +120 -0
- package/dist/layout/circo/blockpath.d.ts.map +1 -0
- package/dist/layout/circo/blocks.d.ts +135 -0
- package/dist/layout/circo/blocks.d.ts.map +1 -0
- package/dist/layout/circo/blocktree.d.ts +51 -0
- package/dist/layout/circo/blocktree.d.ts.map +1 -0
- package/dist/layout/circo/circular.d.ts +59 -0
- package/dist/layout/circo/circular.d.ts.map +1 -0
- package/dist/layout/circo/index.d.ts +35 -0
- package/dist/layout/circo/index.d.ts.map +1 -0
- package/dist/layout/circo/init.d.ts +50 -0
- package/dist/layout/circo/init.d.ts.map +1 -0
- package/dist/layout/circo/position-helpers.d.ts +33 -0
- package/dist/layout/circo/position-helpers.d.ts.map +1 -0
- package/dist/layout/circo/position.d.ts +66 -0
- package/dist/layout/circo/position.d.ts.map +1 -0
- package/dist/layout/dot/acyclic.d.ts +8 -0
- package/dist/layout/dot/acyclic.d.ts.map +1 -0
- package/dist/layout/dot/aspect.d.ts +17 -0
- package/dist/layout/dot/aspect.d.ts.map +1 -0
- package/dist/layout/dot/classify.d.ts +52 -0
- package/dist/layout/dot/classify.d.ts.map +1 -0
- package/dist/layout/dot/cluster-path.d.ts +38 -0
- package/dist/layout/dot/cluster-path.d.ts.map +1 -0
- package/dist/layout/dot/cluster.d.ts +102 -0
- package/dist/layout/dot/cluster.d.ts.map +1 -0
- package/dist/layout/dot/compound-clip.d.ts +69 -0
- package/dist/layout/dot/compound-clip.d.ts.map +1 -0
- package/dist/layout/dot/compound-geom.d.ts +115 -0
- package/dist/layout/dot/compound-geom.d.ts.map +1 -0
- package/dist/layout/dot/compound.d.ts +56 -0
- package/dist/layout/dot/compound.d.ts.map +1 -0
- package/dist/layout/dot/conc.d.ts +88 -0
- package/dist/layout/dot/conc.d.ts.map +1 -0
- package/dist/layout/dot/decomp.d.ts +66 -0
- package/dist/layout/dot/decomp.d.ts.map +1 -0
- package/dist/layout/dot/edge-order.d.ts +27 -0
- package/dist/layout/dot/edge-order.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-arrow.d.ts +46 -0
- package/dist/layout/dot/edge-route-arrow.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-boxes.d.ts +75 -0
- package/dist/layout/dot/edge-route-boxes.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-chain.d.ts +67 -0
- package/dist/layout/dot/edge-route-chain.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-clip.d.ts +88 -0
- package/dist/layout/dot/edge-route-clip.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-faithful.d.ts +94 -0
- package/dist/layout/dot/edge-route-faithful.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-geom.d.ts +43 -0
- package/dist/layout/dot/edge-route-geom.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-helpers.d.ts +50 -0
- package/dist/layout/dot/edge-route-helpers.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-poly.d.ts +48 -0
- package/dist/layout/dot/edge-route-poly.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-rank.d.ts +57 -0
- package/dist/layout/dot/edge-route-rank.d.ts.map +1 -0
- package/dist/layout/dot/edge-route-routing.d.ts +99 -0
- package/dist/layout/dot/edge-route-routing.d.ts.map +1 -0
- package/dist/layout/dot/edge-route.d.ts +57 -0
- package/dist/layout/dot/edge-route.d.ts.map +1 -0
- package/dist/layout/dot/fastgr.d.ts +147 -0
- package/dist/layout/dot/fastgr.d.ts.map +1 -0
- package/dist/layout/dot/flat-utils.d.ts +21 -0
- package/dist/layout/dot/flat-utils.d.ts.map +1 -0
- package/dist/layout/dot/flat.d.ts +152 -0
- package/dist/layout/dot/flat.d.ts.map +1 -0
- package/dist/layout/dot/graph-label.d.ts +18 -0
- package/dist/layout/dot/graph-label.d.ts.map +1 -0
- package/dist/layout/dot/index.d.ts +128 -0
- package/dist/layout/dot/index.d.ts.map +1 -0
- package/dist/layout/dot/init.d.ts +93 -0
- package/dist/layout/dot/init.d.ts.map +1 -0
- package/dist/layout/dot/label-order.d.ts +45 -0
- package/dist/layout/dot/label-order.d.ts.map +1 -0
- package/dist/layout/dot/mincross-build.d.ts +52 -0
- package/dist/layout/dot/mincross-build.d.ts.map +1 -0
- package/dist/layout/dot/mincross-cross.d.ts +80 -0
- package/dist/layout/dot/mincross-cross.d.ts.map +1 -0
- package/dist/layout/dot/mincross-flat.d.ts +27 -0
- package/dist/layout/dot/mincross-flat.d.ts.map +1 -0
- package/dist/layout/dot/mincross-order.d.ts +89 -0
- package/dist/layout/dot/mincross-order.d.ts.map +1 -0
- package/dist/layout/dot/mincross-utils.d.ts +60 -0
- package/dist/layout/dot/mincross-utils.d.ts.map +1 -0
- package/dist/layout/dot/mincross.d.ts +75 -0
- package/dist/layout/dot/mincross.d.ts.map +1 -0
- package/dist/layout/dot/ns-core.d.ts +37 -0
- package/dist/layout/dot/ns-core.d.ts.map +1 -0
- package/dist/layout/dot/ns-range.d.ts +17 -0
- package/dist/layout/dot/ns-range.d.ts.map +1 -0
- package/dist/layout/dot/ns-subtree.d.ts +78 -0
- package/dist/layout/dot/ns-subtree.d.ts.map +1 -0
- package/dist/layout/dot/ns.d.ts +86 -0
- package/dist/layout/dot/ns.d.ts.map +1 -0
- package/dist/layout/dot/ortho-adapter.d.ts +19 -0
- package/dist/layout/dot/ortho-adapter.d.ts.map +1 -0
- package/dist/layout/dot/pack-components.d.ts +100 -0
- package/dist/layout/dot/pack-components.d.ts.map +1 -0
- package/dist/layout/dot/position-aux.d.ts +110 -0
- package/dist/layout/dot/position-aux.d.ts.map +1 -0
- package/dist/layout/dot/position-bbox.d.ts +57 -0
- package/dist/layout/dot/position-bbox.d.ts.map +1 -0
- package/dist/layout/dot/position-cluster.d.ts +48 -0
- package/dist/layout/dot/position-cluster.d.ts.map +1 -0
- package/dist/layout/dot/position-ycoords.d.ts +42 -0
- package/dist/layout/dot/position-ycoords.d.ts.map +1 -0
- package/dist/layout/dot/position.d.ts +47 -0
- package/dist/layout/dot/position.d.ts.map +1 -0
- package/dist/layout/dot/rank-dot2.d.ts +114 -0
- package/dist/layout/dot/rank-dot2.d.ts.map +1 -0
- package/dist/layout/dot/rank.d.ts +119 -0
- package/dist/layout/dot/rank.d.ts.map +1 -0
- package/dist/layout/dot/sameport.d.ts +70 -0
- package/dist/layout/dot/sameport.d.ts.map +1 -0
- package/dist/layout/dot/self-loop.d.ts +54 -0
- package/dist/layout/dot/self-loop.d.ts.map +1 -0
- package/dist/layout/dot/splines-clone.d.ts +33 -0
- package/dist/layout/dot/splines-clone.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat-labeled.d.ts +101 -0
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat-multi.d.ts +35 -0
- package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -0
- package/dist/layout/dot/splines-flat.d.ts +116 -0
- package/dist/layout/dot/splines-flat.d.ts.map +1 -0
- package/dist/layout/dot/splines-groups.d.ts +38 -0
- package/dist/layout/dot/splines-groups.d.ts.map +1 -0
- package/dist/layout/dot/splines-label.d.ts +105 -0
- package/dist/layout/dot/splines-label.d.ts.map +1 -0
- package/dist/layout/dot/splines-route-type.d.ts +28 -0
- package/dist/layout/dot/splines-route-type.d.ts.map +1 -0
- package/dist/layout/dot/splines-route.d.ts +99 -0
- package/dist/layout/dot/splines-route.d.ts.map +1 -0
- package/dist/layout/dot/splines.d.ts +157 -0
- package/dist/layout/dot/splines.d.ts.map +1 -0
- package/dist/layout/dot/straight-edges.d.ts +39 -0
- package/dist/layout/dot/straight-edges.d.ts.map +1 -0
- package/dist/layout/fdp/cluster-edges.d.ts +31 -0
- package/dist/layout/fdp/cluster-edges.d.ts.map +1 -0
- package/dist/layout/fdp/comp.d.ts +29 -0
- package/dist/layout/fdp/comp.d.ts.map +1 -0
- package/dist/layout/fdp/derive.d.ts +39 -0
- package/dist/layout/fdp/derive.d.ts.map +1 -0
- package/dist/layout/fdp/fdp-model.d.ts +101 -0
- package/dist/layout/fdp/fdp-model.d.ts.map +1 -0
- package/dist/layout/fdp/grid.d.ts +49 -0
- package/dist/layout/fdp/grid.d.ts.map +1 -0
- package/dist/layout/fdp/index.d.ts +36 -0
- package/dist/layout/fdp/index.d.ts.map +1 -0
- package/dist/layout/fdp/init.d.ts +26 -0
- package/dist/layout/fdp/init.d.ts.map +1 -0
- package/dist/layout/fdp/layout.d.ts +57 -0
- package/dist/layout/fdp/layout.d.ts.map +1 -0
- package/dist/layout/fdp/normalize.d.ts +18 -0
- package/dist/layout/fdp/normalize.d.ts.map +1 -0
- package/dist/layout/fdp/ports.d.ts +41 -0
- package/dist/layout/fdp/ports.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout-init.d.ts +21 -0
- package/dist/layout/fdp/tlayout-init.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout-parms.d.ts +98 -0
- package/dist/layout/fdp/tlayout-parms.d.ts.map +1 -0
- package/dist/layout/fdp/tlayout.d.ts +43 -0
- package/dist/layout/fdp/tlayout.d.ts.map +1 -0
- package/dist/layout/fdp/xlayout.d.ts +26 -0
- package/dist/layout/fdp/xlayout.d.ts.map +1 -0
- package/dist/layout/neato/bfs.d.ts +43 -0
- package/dist/layout/neato/bfs.d.ts.map +1 -0
- package/dist/layout/neato/cdt-surface.d.ts +16 -0
- package/dist/layout/neato/cdt-surface.d.ts.map +1 -0
- package/dist/layout/neato/conjgrad.d.ts +61 -0
- package/dist/layout/neato/conjgrad.d.ts.map +1 -0
- package/dist/layout/neato/delaunay.d.ts +28 -0
- package/dist/layout/neato/delaunay.d.ts.map +1 -0
- package/dist/layout/neato/dijkstra.d.ts +80 -0
- package/dist/layout/neato/dijkstra.d.ts.map +1 -0
- package/dist/layout/neato/fdp-adjust.d.ts +31 -0
- package/dist/layout/neato/fdp-adjust.d.ts.map +1 -0
- package/dist/layout/neato/index.d.ts +58 -0
- package/dist/layout/neato/index.d.ts.map +1 -0
- package/dist/layout/neato/init.d.ts +207 -0
- package/dist/layout/neato/init.d.ts.map +1 -0
- package/dist/layout/neato/legal.d.ts +7 -0
- package/dist/layout/neato/legal.d.ts.map +1 -0
- package/dist/layout/neato/matrix-ops.d.ts +28 -0
- package/dist/layout/neato/matrix-ops.d.ts.map +1 -0
- package/dist/layout/neato/multispline-router.d.ts +80 -0
- package/dist/layout/neato/multispline-router.d.ts.map +1 -0
- package/dist/layout/neato/multispline.d.ts +24 -0
- package/dist/layout/neato/multispline.d.ts.map +1 -0
- package/dist/layout/neato/overlap-prism.d.ts +26 -0
- package/dist/layout/neato/overlap-prism.d.ts.map +1 -0
- package/dist/layout/neato/overlap.d.ts +85 -0
- package/dist/layout/neato/overlap.d.ts.map +1 -0
- package/dist/layout/neato/sc-adjust.d.ts +33 -0
- package/dist/layout/neato/sc-adjust.d.ts.map +1 -0
- package/dist/layout/neato/sep-factor.d.ts +41 -0
- package/dist/layout/neato/sep-factor.d.ts.map +1 -0
- package/dist/layout/neato/set-aspect.d.ts +33 -0
- package/dist/layout/neato/set-aspect.d.ts.map +1 -0
- package/dist/layout/neato/sgd.d.ts +166 -0
- package/dist/layout/neato/sgd.d.ts.map +1 -0
- package/dist/layout/neato/splines.d.ts +153 -0
- package/dist/layout/neato/splines.d.ts.map +1 -0
- package/dist/layout/neato/stress-kernel.d.ts +53 -0
- package/dist/layout/neato/stress-kernel.d.ts.map +1 -0
- package/dist/layout/neato/stress.d.ts +158 -0
- package/dist/layout/neato/stress.d.ts.map +1 -0
- package/dist/layout/osage/index.d.ts +158 -0
- package/dist/layout/osage/index.d.ts.map +1 -0
- package/dist/layout/osage/layout.d.ts +49 -0
- package/dist/layout/osage/layout.d.ts.map +1 -0
- package/dist/layout/osage/types.d.ts +28 -0
- package/dist/layout/osage/types.d.ts.map +1 -0
- package/dist/layout/pack/array-pack.d.ts +114 -0
- package/dist/layout/pack/array-pack.d.ts.map +1 -0
- package/dist/layout/pack/index.d.ts +157 -0
- package/dist/layout/pack/index.d.ts.map +1 -0
- package/dist/layout/pack/poly-pack.d.ts +126 -0
- package/dist/layout/pack/poly-pack.d.ts.map +1 -0
- package/dist/layout/pack/poly-place.d.ts +27 -0
- package/dist/layout/pack/poly-place.d.ts.map +1 -0
- package/dist/layout/pack/spiral-search.d.ts +18 -0
- package/dist/layout/pack/spiral-search.d.ts.map +1 -0
- package/dist/layout/pack/test-helpers.d.ts +7 -0
- package/dist/layout/pack/test-helpers.d.ts.map +1 -0
- package/dist/layout/pack/types.d.ts +74 -0
- package/dist/layout/pack/types.d.ts.map +1 -0
- package/dist/layout/patchwork/index.d.ts +136 -0
- package/dist/layout/patchwork/index.d.ts.map +1 -0
- package/dist/layout/patchwork/tree-map.d.ts +32 -0
- package/dist/layout/patchwork/tree-map.d.ts.map +1 -0
- package/dist/layout/patchwork/tree-node.d.ts +46 -0
- package/dist/layout/patchwork/tree-node.d.ts.map +1 -0
- package/dist/layout/sfdp/index.d.ts +39 -0
- package/dist/layout/sfdp/index.d.ts.map +1 -0
- package/dist/layout/sfdp/init.d.ts +61 -0
- package/dist/layout/sfdp/init.d.ts.map +1 -0
- package/dist/layout/sfdp/multilevel.d.ts +23 -0
- package/dist/layout/sfdp/multilevel.d.ts.map +1 -0
- package/dist/layout/sfdp/quadtree.d.ts +45 -0
- package/dist/layout/sfdp/quadtree.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-matrix-multiply.d.ts +34 -0
- package/dist/layout/sfdp/sparse-matrix-multiply.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-matrix.d.ts +101 -0
- package/dist/layout/sfdp/sparse-matrix.d.ts.map +1 -0
- package/dist/layout/sfdp/sparse-solve.d.ts +14 -0
- package/dist/layout/sfdp/sparse-solve.d.ts.map +1 -0
- package/dist/layout/sfdp/spring-driver.d.ts +18 -0
- package/dist/layout/sfdp/spring-driver.d.ts.map +1 -0
- package/dist/layout/sfdp/spring-electrical.d.ts +61 -0
- package/dist/layout/sfdp/spring-electrical.d.ts.map +1 -0
- package/dist/layout/twopi/circle.d.ts +83 -0
- package/dist/layout/twopi/circle.d.ts.map +1 -0
- package/dist/layout/twopi/index.d.ts +24 -0
- package/dist/layout/twopi/index.d.ts.map +1 -0
- package/dist/layout/twopi/init.d.ts +85 -0
- package/dist/layout/twopi/init.d.ts.map +1 -0
- package/dist/layout/twopi/pipeline.d.ts +37 -0
- package/dist/layout/twopi/pipeline.d.ts.map +1 -0
- package/dist/layout/twopi/twopi-test-helpers.d.ts +12 -0
- package/dist/layout/twopi/twopi-test-helpers.d.ts.map +1 -0
- package/dist/model/algData.d.ts +175 -0
- package/dist/model/algData.d.ts.map +1 -0
- package/dist/model/cgraph-ops.d.ts +86 -0
- package/dist/model/cgraph-ops.d.ts.map +1 -0
- package/dist/model/edge.d.ts +80 -0
- package/dist/model/edge.d.ts.map +1 -0
- package/dist/model/edgeInfo.d.ts +299 -0
- package/dist/model/edgeInfo.d.ts.map +1 -0
- package/dist/model/geom.d.ts +149 -0
- package/dist/model/geom.d.ts.map +1 -0
- package/dist/model/graph.d.ts +135 -0
- package/dist/model/graph.d.ts.map +1 -0
- package/dist/model/graphInfo.d.ts +418 -0
- package/dist/model/graphInfo.d.ts.map +1 -0
- package/dist/model/index.d.ts +10 -0
- package/dist/model/index.d.ts.map +1 -0
- package/dist/model/layoutParams.d.ts +85 -0
- package/dist/model/layoutParams.d.ts.map +1 -0
- package/dist/model/node.d.ts +101 -0
- package/dist/model/node.d.ts.map +1 -0
- package/dist/model/nodeInfo.d.ts +278 -0
- package/dist/model/nodeInfo.d.ts.map +1 -0
- package/dist/model/rankEntry.d.ts +80 -0
- package/dist/model/rankEntry.d.ts.map +1 -0
- package/dist/ortho/chan-dict.d.ts +82 -0
- package/dist/ortho/chan-dict.d.ts.map +1 -0
- package/dist/ortho/fpq.d.ts +54 -0
- package/dist/ortho/fpq.d.ts.map +1 -0
- package/dist/ortho/index.d.ts +35 -0
- package/dist/ortho/index.d.ts.map +1 -0
- package/dist/ortho/maze-channels.d.ts +47 -0
- package/dist/ortho/maze-channels.d.ts.map +1 -0
- package/dist/ortho/maze.d.ts +27 -0
- package/dist/ortho/maze.d.ts.map +1 -0
- package/dist/ortho/ortho-parallel.d.ts +26 -0
- package/dist/ortho/ortho-parallel.d.ts.map +1 -0
- package/dist/ortho/ortho-route.d.ts +31 -0
- package/dist/ortho/ortho-route.d.ts.map +1 -0
- package/dist/ortho/partition.d.ts +34 -0
- package/dist/ortho/partition.d.ts.map +1 -0
- package/dist/ortho/rawgraph.d.ts +41 -0
- package/dist/ortho/rawgraph.d.ts.map +1 -0
- package/dist/ortho/sgraph.d.ts +74 -0
- package/dist/ortho/sgraph.d.ts.map +1 -0
- package/dist/ortho/trap-query.d.ts +32 -0
- package/dist/ortho/trap-query.d.ts.map +1 -0
- package/dist/ortho/trap-segment.d.ts +23 -0
- package/dist/ortho/trap-segment.d.ts.map +1 -0
- package/dist/ortho/trap-types.d.ts +91 -0
- package/dist/ortho/trap-types.d.ts.map +1 -0
- package/dist/ortho/trap-update.d.ts +12 -0
- package/dist/ortho/trap-update.d.ts.map +1 -0
- package/dist/ortho/trapezoid.d.ts +18 -0
- package/dist/ortho/trapezoid.d.ts.map +1 -0
- package/dist/ortho/types.d.ts +241 -0
- package/dist/ortho/types.d.ts.map +1 -0
- package/dist/parser/ast.d.ts +49 -0
- package/dist/parser/ast.d.ts.map +1 -0
- package/dist/parser/builder.d.ts +75 -0
- package/dist/parser/builder.d.ts.map +1 -0
- package/dist/parser/index.d.ts +97 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/pathplan/index.d.ts +8 -0
- package/dist/pathplan/index.d.ts.map +1 -0
- package/dist/pathplan/route.d.ts +9 -0
- package/dist/pathplan/route.d.ts.map +1 -0
- package/dist/pathplan/shortest.d.ts +5 -0
- package/dist/pathplan/shortest.d.ts.map +1 -0
- package/dist/pathplan/solvers.d.ts +5 -0
- package/dist/pathplan/solvers.d.ts.map +1 -0
- package/dist/pathplan/triang.d.ts +25 -0
- package/dist/pathplan/triang.d.ts.map +1 -0
- package/dist/pathplan/types.d.ts +22 -0
- package/dist/pathplan/types.d.ts.map +1 -0
- package/dist/pathplan/visibility.d.ts +13 -0
- package/dist/pathplan/visibility.d.ts.map +1 -0
- package/dist/pathplan/vispath.d.ts +9 -0
- package/dist/pathplan/vispath.d.ts.map +1 -0
- package/dist/rbtree/index.d.ts +127 -0
- package/dist/rbtree/index.d.ts.map +1 -0
- package/dist/render/color-resolve.d.ts +38 -0
- package/dist/render/color-resolve.d.ts.map +1 -0
- package/dist/render/dot.d.ts +379 -0
- package/dist/render/dot.d.ts.map +1 -0
- package/dist/render/index.d.ts +24 -0
- package/dist/render/index.d.ts.map +1 -0
- package/dist/render/json.d.ts +89 -0
- package/dist/render/json.d.ts.map +1 -0
- package/dist/render/map-test-helpers.d.ts +13 -0
- package/dist/render/map-test-helpers.d.ts.map +1 -0
- package/dist/render/map.d.ts +197 -0
- package/dist/render/map.d.ts.map +1 -0
- package/dist/render/public.d.ts +64 -0
- package/dist/render/public.d.ts.map +1 -0
- package/dist/render/svg-arrow-ops.d.ts +10 -0
- package/dist/render/svg-arrow-ops.d.ts.map +1 -0
- package/dist/render/svg-cluster.d.ts +9 -0
- package/dist/render/svg-cluster.d.ts.map +1 -0
- package/dist/render/svg-edge-ortho-radius.d.ts +31 -0
- package/dist/render/svg-edge-ortho-radius.d.ts.map +1 -0
- package/dist/render/svg-edge-split.d.ts +48 -0
- package/dist/render/svg-edge-split.d.ts.map +1 -0
- package/dist/render/svg-gradient.d.ts +46 -0
- package/dist/render/svg-gradient.d.ts.map +1 -0
- package/dist/render/svg-graph.d.ts +97 -0
- package/dist/render/svg-graph.d.ts.map +1 -0
- package/dist/render/svg-helpers.d.ts +122 -0
- package/dist/render/svg-helpers.d.ts.map +1 -0
- package/dist/render/svg-id.d.ts +28 -0
- package/dist/render/svg-id.d.ts.map +1 -0
- package/dist/render/svg-multicolor.d.ts +60 -0
- package/dist/render/svg-multicolor.d.ts.map +1 -0
- package/dist/render/svg-parallel-edge.d.ts +28 -0
- package/dist/render/svg-parallel-edge.d.ts.map +1 -0
- package/dist/render/svg-tapered-edge.d.ts +18 -0
- package/dist/render/svg-tapered-edge.d.ts.map +1 -0
- package/dist/render/svg.d.ts +104 -0
- package/dist/render/svg.d.ts.map +1 -0
- package/dist/render/xdot-public.d.ts +95 -0
- package/dist/render/xdot-public.d.ts.map +1 -0
- package/dist/render/xml-escape.d.ts +21 -0
- package/dist/render/xml-escape.d.ts.map +1 -0
- package/dist/render.js +52556 -0
- package/dist/render.js.map +7 -0
- package/dist/util/agxbuf.d.ts +72 -0
- package/dist/util/agxbuf.d.ts.map +1 -0
- package/dist/util/bsd-qsort.d.ts +22 -0
- package/dist/util/bsd-qsort.d.ts.map +1 -0
- package/dist/util/index.d.ts +11 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/list.d.ts +47 -0
- package/dist/util/list.d.ts.map +1 -0
- package/dist/util/math.d.ts +54 -0
- package/dist/util/math.d.ts.map +1 -0
- package/dist/util/mt19937.d.ts +40 -0
- package/dist/util/mt19937.d.ts.map +1 -0
- package/dist/util/printf-round.d.ts +45 -0
- package/dist/util/printf-round.d.ts.map +1 -0
- package/dist/util/xml.d.ts +24 -0
- package/dist/util/xml.d.ts.map +1 -0
- package/dist/vpsc/Block.d.ts +116 -0
- package/dist/vpsc/Block.d.ts.map +1 -0
- package/dist/vpsc/Blocks.d.ts +66 -0
- package/dist/vpsc/Blocks.d.ts.map +1 -0
- package/dist/vpsc/Constraint.d.ts +51 -0
- package/dist/vpsc/Constraint.d.ts.map +1 -0
- package/dist/vpsc/HeapUtils.d.ts +37 -0
- package/dist/vpsc/HeapUtils.d.ts.map +1 -0
- package/dist/vpsc/Solver.d.ts +107 -0
- package/dist/vpsc/Solver.d.ts.map +1 -0
- package/dist/vpsc/SweepLine.d.ts +38 -0
- package/dist/vpsc/SweepLine.d.ts.map +1 -0
- package/dist/vpsc/Variable.d.ts +38 -0
- package/dist/vpsc/Variable.d.ts.map +1 -0
- package/dist/vpsc/index.d.ts +54 -0
- package/dist/vpsc/index.d.ts.map +1 -0
- package/dist/vpsc/sweepTypes.d.ts +29 -0
- package/dist/vpsc/sweepTypes.d.ts.map +1 -0
- package/dist/xdot/index.d.ts +6 -0
- package/dist/xdot/index.d.ts.map +1 -0
- package/dist/xdot/lex.d.ts +22 -0
- package/dist/xdot/lex.d.ts.map +1 -0
- package/dist/xdot/misc.d.ts +13 -0
- package/dist/xdot/misc.d.ts.map +1 -0
- package/dist/xdot/parse.d.ts +21 -0
- package/dist/xdot/parse.d.ts.map +1 -0
- package/dist/xdot/types.d.ts +152 -0
- package/dist/xdot/types.d.ts.map +1 -0
- package/package.json +113 -0
- package/src/api/builder.ts +277 -0
- package/src/api/edge-ops.ts +113 -0
- package/src/api/geometry.ts +307 -0
- package/src/api/index.ts +46 -0
- package/src/cdt/bag.ts +196 -0
- package/src/cdt/hash-core.ts +84 -0
- package/src/cdt/hash.ts +207 -0
- package/src/cdt/index.ts +17 -0
- package/src/cdt/splay-core.ts +301 -0
- package/src/cdt/splay.ts +191 -0
- package/src/cdt/strhash.ts +52 -0
- package/src/cdt/types.ts +13 -0
- package/src/common/arith.ts +39 -0
- package/src/common/arm-pow-data.ts +201 -0
- package/src/common/arm-pow.ts +296 -0
- package/src/common/arrows-constants.ts +175 -0
- package/src/common/arrows-geometry.ts +62 -0
- package/src/common/arrows-miter.ts +84 -0
- package/src/common/arrows-shapes-poly.ts +241 -0
- package/src/common/arrows-shapes-util.ts +162 -0
- package/src/common/arrows-shapes.ts +360 -0
- package/src/common/arrows-types.ts +59 -0
- package/src/common/arrows.ts +209 -0
- package/src/common/color.ts +340 -0
- package/src/common/colorData.ts +264 -0
- package/src/common/compass-port.ts +384 -0
- package/src/common/crand.ts +79 -0
- package/src/common/edge-label-init.ts +310 -0
- package/src/common/edge-offset.ts +140 -0
- package/src/common/ellipse-wedge.ts +189 -0
- package/src/common/emit-types.ts +332 -0
- package/src/common/fma.ts +52 -0
- package/src/common/graph-init.ts +359 -0
- package/src/common/html-entities.ts +299 -0
- package/src/common/html-string.ts +22 -0
- package/src/common/htmltable-emit-fill.ts +367 -0
- package/src/common/htmltable-emit-rules.ts +293 -0
- package/src/common/htmltable-emit.ts +345 -0
- package/src/common/htmltable-lex.ts +138 -0
- package/src/common/htmltable-parse.ts +539 -0
- package/src/common/htmltable-port.ts +32 -0
- package/src/common/htmltable-pos-runs.ts +313 -0
- package/src/common/htmltable-pos.ts +601 -0
- package/src/common/htmltable-types.ts +262 -0
- package/src/common/htmltable.ts +477 -0
- package/src/common/layers.ts +113 -0
- package/src/common/make-label.ts +192 -0
- package/src/common/multicolor.ts +167 -0
- package/src/common/nodeinit.ts +339 -0
- package/src/common/poly-gencode.ts +475 -0
- package/src/common/poly-init.ts +133 -0
- package/src/common/poly-inside.ts +202 -0
- package/src/common/poly-shapes-cases.ts +253 -0
- package/src/common/poly-shapes-cases2.ts +170 -0
- package/src/common/poly-shapes-util.ts +124 -0
- package/src/common/poly-shapes.ts +181 -0
- package/src/common/poly-sizing.ts +639 -0
- package/src/common/poly-vertices.ts +237 -0
- package/src/common/postproc.ts +436 -0
- package/src/common/ps-fontalias.ts +112 -0
- package/src/common/random.ts +37 -0
- package/src/common/record-port.ts +89 -0
- package/src/common/record.ts +523 -0
- package/src/common/shapeData.ts +502 -0
- package/src/common/shapes.ts +187 -0
- package/src/common/spline-midpoint.ts +105 -0
- package/src/common/splines-clip.ts +449 -0
- package/src/common/splines-constants.ts +53 -0
- package/src/common/splines-geom.ts +194 -0
- package/src/common/splines-path-begin.ts +243 -0
- package/src/common/splines-path-end.ts +231 -0
- package/src/common/splines-path-shared.ts +258 -0
- package/src/common/splines-routespl.ts +444 -0
- package/src/common/splines-selfedge.ts +403 -0
- package/src/common/splines.ts +33 -0
- package/src/common/style-resolve.ts +481 -0
- package/src/common/subst.ts +126 -0
- package/src/common/taper.ts +219 -0
- package/src/common/textmeasure-factory.ts +86 -0
- package/src/common/textmeasure-lookup.ts +50 -0
- package/src/common/textmeasure-lut-data-a.ts +182 -0
- package/src/common/textmeasure-lut-data-b.ts +140 -0
- package/src/common/textmeasure-lut-data-c.ts +221 -0
- package/src/common/textmeasure-lut-data.ts +78 -0
- package/src/common/textmeasure.ts +321 -0
- package/src/common/types.ts +425 -0
- package/src/common/xlabels-place.ts +475 -0
- package/src/debug.ts +38 -0
- package/src/errors.ts +95 -0
- package/src/gvc/anchor.ts +530 -0
- package/src/gvc/context.ts +260 -0
- package/src/gvc/default-context.ts +70 -0
- package/src/gvc/device-cluster.ts +114 -0
- package/src/gvc/device.ts +598 -0
- package/src/gvc/edge-labels.ts +116 -0
- package/src/gvc/emit-walk.ts +98 -0
- package/src/gvc/image-resolver.ts +137 -0
- package/src/gvc/job.ts +401 -0
- package/src/gvc/textlayout.ts +44 -0
- package/src/gvc/textspan-emit.ts +100 -0
- package/src/gvc/usershape.ts +33 -0
- package/src/gvc/viewport.ts +203 -0
- package/src/index.ts +165 -0
- package/src/label/index.ts +302 -0
- package/src/label/node.ts +278 -0
- package/src/label/rectangle.ts +123 -0
- package/src/label/split-q.ts +237 -0
- package/src/label/xlabels-geom.ts +132 -0
- package/src/label/xlabels-intersect.ts +421 -0
- package/src/label/xlabels.ts +212 -0
- package/src/layout/circo/blockpath.ts +560 -0
- package/src/layout/circo/blocks.ts +234 -0
- package/src/layout/circo/blocktree.ts +246 -0
- package/src/layout/circo/circular.ts +227 -0
- package/src/layout/circo/index.ts +90 -0
- package/src/layout/circo/init.ts +84 -0
- package/src/layout/circo/position-helpers.ts +104 -0
- package/src/layout/circo/position.ts +196 -0
- package/src/layout/dot/__fixtures__/xcoord-pivot-divergence.gv +79 -0
- package/src/layout/dot/acyclic.ts +60 -0
- package/src/layout/dot/aspect.ts +22 -0
- package/src/layout/dot/classify.ts +462 -0
- package/src/layout/dot/cluster-path.ts +200 -0
- package/src/layout/dot/cluster.ts +480 -0
- package/src/layout/dot/compound-clip.ts +224 -0
- package/src/layout/dot/compound-geom.ts +282 -0
- package/src/layout/dot/compound.ts +294 -0
- package/src/layout/dot/conc.ts +433 -0
- package/src/layout/dot/decomp.ts +165 -0
- package/src/layout/dot/edge-order.ts +62 -0
- package/src/layout/dot/edge-route-arrow.ts +87 -0
- package/src/layout/dot/edge-route-boxes.ts +99 -0
- package/src/layout/dot/edge-route-chain.ts +420 -0
- package/src/layout/dot/edge-route-clip.ts +253 -0
- package/src/layout/dot/edge-route-faithful.ts +404 -0
- package/src/layout/dot/edge-route-geom.ts +90 -0
- package/src/layout/dot/edge-route-helpers.ts +170 -0
- package/src/layout/dot/edge-route-poly.ts +174 -0
- package/src/layout/dot/edge-route-rank.ts +136 -0
- package/src/layout/dot/edge-route-routing.ts +219 -0
- package/src/layout/dot/edge-route.ts +490 -0
- package/src/layout/dot/fastgr.ts +377 -0
- package/src/layout/dot/flat-utils.ts +52 -0
- package/src/layout/dot/flat.ts +518 -0
- package/src/layout/dot/graph-label.ts +114 -0
- package/src/layout/dot/index.ts +302 -0
- package/src/layout/dot/init.ts +300 -0
- package/src/layout/dot/label-order.ts +161 -0
- package/src/layout/dot/mincross-build.ts +373 -0
- package/src/layout/dot/mincross-cross.ts +409 -0
- package/src/layout/dot/mincross-flat.ts +213 -0
- package/src/layout/dot/mincross-order.ts +401 -0
- package/src/layout/dot/mincross-utils.ts +170 -0
- package/src/layout/dot/mincross.ts +386 -0
- package/src/layout/dot/ns-core.ts +122 -0
- package/src/layout/dot/ns-range.ts +228 -0
- package/src/layout/dot/ns-subtree.ts +347 -0
- package/src/layout/dot/ns.ts +506 -0
- package/src/layout/dot/ortho-adapter.ts +133 -0
- package/src/layout/dot/pack-components.ts +433 -0
- package/src/layout/dot/position-aux.ts +382 -0
- package/src/layout/dot/position-bbox.ts +221 -0
- package/src/layout/dot/position-cluster.ts +286 -0
- package/src/layout/dot/position-ycoords.ts +287 -0
- package/src/layout/dot/position.ts +194 -0
- package/src/layout/dot/rank-dot2.ts +528 -0
- package/src/layout/dot/rank.ts +547 -0
- package/src/layout/dot/sameport.ts +278 -0
- package/src/layout/dot/self-loop.ts +147 -0
- package/src/layout/dot/splines-clone.ts +121 -0
- package/src/layout/dot/splines-flat-labeled.ts +408 -0
- package/src/layout/dot/splines-flat-multi.ts +188 -0
- package/src/layout/dot/splines-flat.ts +598 -0
- package/src/layout/dot/splines-groups.ts +190 -0
- package/src/layout/dot/splines-label.ts +432 -0
- package/src/layout/dot/splines-route-type.ts +44 -0
- package/src/layout/dot/splines-route.ts +478 -0
- package/src/layout/dot/splines.ts +538 -0
- package/src/layout/dot/straight-edges.ts +332 -0
- package/src/layout/fdp/cluster-edges.ts +0 -0
- package/src/layout/fdp/comp.ts +160 -0
- package/src/layout/fdp/derive.ts +272 -0
- package/src/layout/fdp/fdp-model.ts +238 -0
- package/src/layout/fdp/grid.ts +77 -0
- package/src/layout/fdp/index.ts +113 -0
- package/src/layout/fdp/init.ts +116 -0
- package/src/layout/fdp/layout.ts +485 -0
- package/src/layout/fdp/normalize.ts +100 -0
- package/src/layout/fdp/ports.ts +161 -0
- package/src/layout/fdp/tlayout-init.ts +230 -0
- package/src/layout/fdp/tlayout-parms.ts +234 -0
- package/src/layout/fdp/tlayout.ts +317 -0
- package/src/layout/fdp/xlayout.ts +350 -0
- package/src/layout/neato/bfs.ts +131 -0
- package/src/layout/neato/cdt-surface.ts +693 -0
- package/src/layout/neato/conjgrad.ts +159 -0
- package/src/layout/neato/delaunay.ts +259 -0
- package/src/layout/neato/dijkstra.ts +296 -0
- package/src/layout/neato/fdp-adjust.ts +124 -0
- package/src/layout/neato/index.ts +310 -0
- package/src/layout/neato/init.ts +505 -0
- package/src/layout/neato/legal.ts +316 -0
- package/src/layout/neato/matrix-ops.ts +112 -0
- package/src/layout/neato/multispline-router.ts +417 -0
- package/src/layout/neato/multispline.ts +427 -0
- package/src/layout/neato/overlap-prism.ts +503 -0
- package/src/layout/neato/overlap.ts +158 -0
- package/src/layout/neato/sc-adjust.ts +206 -0
- package/src/layout/neato/sep-factor.ts +118 -0
- package/src/layout/neato/set-aspect.ts +178 -0
- package/src/layout/neato/sgd.ts +461 -0
- package/src/layout/neato/splines.ts +1014 -0
- package/src/layout/neato/stress-kernel.ts +362 -0
- package/src/layout/neato/stress.ts +420 -0
- package/src/layout/osage/index.ts +548 -0
- package/src/layout/osage/layout.ts +254 -0
- package/src/layout/osage/types.ts +31 -0
- package/src/layout/pack/array-pack.ts +254 -0
- package/src/layout/pack/index.ts +570 -0
- package/src/layout/pack/poly-pack.ts +266 -0
- package/src/layout/pack/poly-place.ts +426 -0
- package/src/layout/pack/spiral-search.ts +106 -0
- package/src/layout/pack/test-helpers.ts +46 -0
- package/src/layout/pack/types.ts +85 -0
- package/src/layout/patchwork/index.ts +441 -0
- package/src/layout/patchwork/tree-map.ts +183 -0
- package/src/layout/patchwork/tree-node.ts +120 -0
- package/src/layout/sfdp/index.ts +231 -0
- package/src/layout/sfdp/init.ts +224 -0
- package/src/layout/sfdp/multilevel.ts +262 -0
- package/src/layout/sfdp/quadtree.ts +267 -0
- package/src/layout/sfdp/sparse-matrix-multiply.ts +160 -0
- package/src/layout/sfdp/sparse-matrix.ts +367 -0
- package/src/layout/sfdp/sparse-solve.ts +122 -0
- package/src/layout/sfdp/spring-driver.ts +209 -0
- package/src/layout/sfdp/spring-electrical.ts +431 -0
- package/src/layout/twopi/circle.ts +339 -0
- package/src/layout/twopi/index.ts +78 -0
- package/src/layout/twopi/init.ts +174 -0
- package/src/layout/twopi/pipeline.ts +98 -0
- package/src/layout/twopi/twopi-test-helpers.ts +44 -0
- package/src/model/algData.ts +194 -0
- package/src/model/cgraph-ops.ts +175 -0
- package/src/model/edge.ts +104 -0
- package/src/model/edgeInfo.ts +431 -0
- package/src/model/geom.ts +204 -0
- package/src/model/graph.ts +172 -0
- package/src/model/graphInfo.ts +528 -0
- package/src/model/index.ts +10 -0
- package/src/model/layoutParams.ts +127 -0
- package/src/model/node.ts +138 -0
- package/src/model/nodeInfo.ts +424 -0
- package/src/model/rankEntry.ts +95 -0
- package/src/ortho/chan-dict.ts +236 -0
- package/src/ortho/fpq.ts +149 -0
- package/src/ortho/index.ts +206 -0
- package/src/ortho/maze-channels.ts +196 -0
- package/src/ortho/maze.ts +311 -0
- package/src/ortho/ortho-parallel.ts +254 -0
- package/src/ortho/ortho-route.ts +349 -0
- package/src/ortho/partition.ts +303 -0
- package/src/ortho/rawgraph.ts +119 -0
- package/src/ortho/sgraph.ts +283 -0
- package/src/ortho/trap-query.ts +174 -0
- package/src/ortho/trap-segment.ts +303 -0
- package/src/ortho/trap-types.ts +171 -0
- package/src/ortho/trap-update.ts +89 -0
- package/src/ortho/trapezoid.ts +120 -0
- package/src/ortho/types.ts +286 -0
- package/src/parser/__fixtures__/directed.dot +10 -0
- package/src/parser/__fixtures__/simple.dot +7 -0
- package/src/parser/__fixtures__/subgraph.dot +17 -0
- package/src/parser/ast.ts +64 -0
- package/src/parser/builder.ts +401 -0
- package/src/parser/dot.d.ts +208 -0
- package/src/parser/dot.js +3321 -0
- package/src/parser/dot.pegjs +263 -0
- package/src/parser/index.ts +353 -0
- package/src/pathplan/index.ts +9 -0
- package/src/pathplan/route.ts +284 -0
- package/src/pathplan/shortest.ts +268 -0
- package/src/pathplan/solvers.ts +65 -0
- package/src/pathplan/triang.ts +221 -0
- package/src/pathplan/types.ts +16 -0
- package/src/pathplan/visibility.ts +170 -0
- package/src/pathplan/vispath.ts +118 -0
- package/src/rbtree/index.ts +418 -0
- package/src/render/color-resolve.ts +171 -0
- package/src/render/dot.ts +1514 -0
- package/src/render/index.ts +29 -0
- package/src/render/json.ts +734 -0
- package/src/render/map-test-helpers.ts +61 -0
- package/src/render/map.ts +528 -0
- package/src/render/public.ts +131 -0
- package/src/render/svg-arrow-ops.ts +113 -0
- package/src/render/svg-cluster.ts +24 -0
- package/src/render/svg-edge-ortho-radius.ts +228 -0
- package/src/render/svg-edge-split.ts +180 -0
- package/src/render/svg-gradient.ts +185 -0
- package/src/render/svg-graph.ts +415 -0
- package/src/render/svg-helpers.ts +623 -0
- package/src/render/svg-id.ts +76 -0
- package/src/render/svg-multicolor.ts +313 -0
- package/src/render/svg-parallel-edge.ts +123 -0
- package/src/render/svg-tapered-edge.ts +56 -0
- package/src/render/svg.ts +307 -0
- package/src/render/xdot-public.ts +164 -0
- package/src/render/xml-escape.ts +56 -0
- package/src/util/agxbuf.ts +138 -0
- package/src/util/bsd-qsort.ts +251 -0
- package/src/util/index.ts +25 -0
- package/src/util/list.ts +122 -0
- package/src/util/math.ts +104 -0
- package/src/util/mt19937.ts +143 -0
- package/src/util/printf-round.ts +163 -0
- package/src/util/xml.ts +184 -0
- package/src/vpsc/Block.ts +375 -0
- package/src/vpsc/Blocks.ts +164 -0
- package/src/vpsc/Constraint.ts +94 -0
- package/src/vpsc/HeapUtils.ts +88 -0
- package/src/vpsc/Solver.ts +274 -0
- package/src/vpsc/SweepLine.ts +214 -0
- package/src/vpsc/Variable.ts +54 -0
- package/src/vpsc/index.ts +122 -0
- package/src/vpsc/sweepTypes.ts +31 -0
- package/src/xdot/index.ts +7 -0
- package/src/xdot/lex.ts +151 -0
- package/src/xdot/misc.ts +226 -0
- package/src/xdot/parse.ts +349 -0
- package/src/xdot/types.ts +158 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Polyomino-based rectangle packing algorithm.
|
|
5
|
+
*
|
|
6
|
+
* Based on "Disconnected Graph Layout and the Polyomino Packing Approach",
|
|
7
|
+
* K. Freivalds et al., GD'01, LNCS 2265, pp. 378-391.
|
|
8
|
+
*
|
|
9
|
+
* @see lib/pack/pack.c:polyRects
|
|
10
|
+
* @see lib/pack/pack.c:computeStep
|
|
11
|
+
* @see lib/pack/pack.c:placeGraph
|
|
12
|
+
* @see lib/pack/pack.c:fits
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { Box, Point } from '../../model/geom.js';
|
|
16
|
+
import type { PackInfo } from './types.js';
|
|
17
|
+
import { spiralSearch } from './spiral-search.js';
|
|
18
|
+
import { gvQsort } from '../../util/bsd-qsort.js';
|
|
19
|
+
import { cround } from '../../common/arith.js';
|
|
20
|
+
|
|
21
|
+
/** Max average polyomino size constant. @see lib/pack/pack.c:C */
|
|
22
|
+
const C = 100;
|
|
23
|
+
|
|
24
|
+
/** Grid cell coverage info for one rectangle. */
|
|
25
|
+
export interface GInfo {
|
|
26
|
+
perim: number;
|
|
27
|
+
cells: Point[];
|
|
28
|
+
index: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** A set of occupied grid cells (string-keyed for O(1) lookup). */
|
|
32
|
+
export type PointSet = Set<string>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Encode a grid point as a canonical string key.
|
|
36
|
+
*
|
|
37
|
+
* C keys its PointSet dict on the `pointf` cell itself (exact double compare,
|
|
38
|
+
* no rounding). Every cell coordinate reaching here is an exact integer grid
|
|
39
|
+
* index produced by genBox's `cround(cval(...))`, so the rounding mode is
|
|
40
|
+
* unobservable; `cround` is used only so no `Math.round` survives in a layout
|
|
41
|
+
* coordinate path.
|
|
42
|
+
* @see lib/common/pointset.h:45 (insertPS/inPS take pointf)
|
|
43
|
+
*/
|
|
44
|
+
export function psKey(x: number, y: number): string {
|
|
45
|
+
return `${cround(x)},${cround(y)}`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/** Check if a cell is in the point set. @see lib/pack/pack.c:inPS */
|
|
49
|
+
export function inPS(ps: PointSet, p: Point): boolean {
|
|
50
|
+
return ps.has(psKey(p.x, p.y));
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Insert a cell into the point set. @see lib/pack/pack.c:insertPS */
|
|
54
|
+
export function insertPS(ps: PointSet, p: Point): void {
|
|
55
|
+
ps.add(psKey(p.x, p.y));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Compute the polyomino grid step size (positive root of quadratic).
|
|
60
|
+
*
|
|
61
|
+
* @see lib/pack/pack.c:computeStep
|
|
62
|
+
*/
|
|
63
|
+
export function computeStep(ng: number, bbs: Box[], margin: number): number {
|
|
64
|
+
let b = 0;
|
|
65
|
+
let c = 0;
|
|
66
|
+
const a = C * ng - 1;
|
|
67
|
+
for (let i = 0; i < ng; i++) {
|
|
68
|
+
const bb = bbs[i];
|
|
69
|
+
if (bb === undefined) continue;
|
|
70
|
+
const W = bb.ur.x - bb.ll.x + 2 * margin;
|
|
71
|
+
const H = bb.ur.y - bb.ll.y + 2 * margin;
|
|
72
|
+
b -= W + H;
|
|
73
|
+
c -= W * H;
|
|
74
|
+
}
|
|
75
|
+
const d = b * b - 4.0 * a * c;
|
|
76
|
+
if (d < 0) return 1;
|
|
77
|
+
const root = Math.floor((-b + Math.sqrt(d)) / (2 * a));
|
|
78
|
+
return root <= 0 ? 1 : root;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Number of grid cells required to cover length x at cell size s.
|
|
83
|
+
*
|
|
84
|
+
* @see lib/pack/pack.c:GRID
|
|
85
|
+
*/
|
|
86
|
+
export function gridCells(x: number, s: number): number {
|
|
87
|
+
return Math.ceil(x / s);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Grid cell index containing coordinate v at cell size s.
|
|
92
|
+
*
|
|
93
|
+
* C's `CVAL` macro is applied to the DOUBLE `pointf` fields inside `CELL`
|
|
94
|
+
* (genBox), so the division is floating-point — it yields a fractional cell
|
|
95
|
+
* coordinate that genBox then rounds (see {@link cround}). Modelling it with
|
|
96
|
+
* integer/truncating division (the previous `Math.floor`/`Math.trunc` form)
|
|
97
|
+
* diverges: e.g. `CVAL(-4, 5)` is `((-4+1)/5)-1 = -1.6` (→ round -2), not
|
|
98
|
+
* `-1`. That shrank every packed box's footprint by a cell on the negative
|
|
99
|
+
* side, packing the osage pack_neato2 grid tighter than native.
|
|
100
|
+
*
|
|
101
|
+
* @see lib/pack/pack.c:CVAL / CELL
|
|
102
|
+
*/
|
|
103
|
+
export function cval(v: number, s: number): number {
|
|
104
|
+
return v >= 0 ? v / s : (v + 1) / s - 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/** Parameters for genBox. */
|
|
108
|
+
export interface GenBoxParams {
|
|
109
|
+
bb: Box;
|
|
110
|
+
ssize: number;
|
|
111
|
+
margin: number;
|
|
112
|
+
idx: number;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Generate the grid cell coverage for a bounding box.
|
|
117
|
+
*
|
|
118
|
+
* @see lib/pack/pack.c:genBox
|
|
119
|
+
*/
|
|
120
|
+
export function genBox(p: GenBoxParams): GInfo {
|
|
121
|
+
const { bb, ssize, margin, idx } = p;
|
|
122
|
+
// C rounds the box corners first, then measures the cell region relative to
|
|
123
|
+
// `center` (always the origin under polyRects/osage): LL = center - margin,
|
|
124
|
+
// UR = center + (roundedWidth/Height) + margin. Each corner is mapped to a
|
|
125
|
+
// grid cell by CELL (CVAL on the double coordinate) and then round()ed.
|
|
126
|
+
// @see lib/pack/pack.c:genBox
|
|
127
|
+
const w = cround(bb.ur.x) - cround(bb.ll.x);
|
|
128
|
+
const h = cround(bb.ur.y) - cround(bb.ll.y);
|
|
129
|
+
const llx = cround(cval(-margin, ssize));
|
|
130
|
+
const lly = cround(cval(-margin, ssize));
|
|
131
|
+
const urx = cround(cval(w + margin, ssize));
|
|
132
|
+
const ury = cround(cval(h + margin, ssize));
|
|
133
|
+
const cells: Point[] = [];
|
|
134
|
+
for (let x = llx; x <= urx; x++) {
|
|
135
|
+
for (let y = lly; y <= ury; y++) {
|
|
136
|
+
cells.push({ x, y });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
const W = gridCells(bb.ur.x - bb.ll.x + 2 * margin, ssize);
|
|
140
|
+
const H = gridCells(bb.ur.y - bb.ll.y + 2 * margin, ssize);
|
|
141
|
+
return { perim: W + H, cells, index: idx };
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/** Context passed to fits() and placeGraph(). */
|
|
145
|
+
export interface PlaceCtx {
|
|
146
|
+
ps: PointSet;
|
|
147
|
+
step: number;
|
|
148
|
+
bbs: Box[];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Test whether any shifted cell collides with the occupied set.
|
|
153
|
+
* Returns true if there is a collision (polyomino does NOT fit).
|
|
154
|
+
*
|
|
155
|
+
* @see lib/pack/pack.c:fits (collision check loop)
|
|
156
|
+
*/
|
|
157
|
+
export function hasCollision(cells: Point[], dx: number, dy: number, ps: PointSet): boolean {
|
|
158
|
+
for (let i = 0; i < cells.length; i++) {
|
|
159
|
+
const cell = cells[i];
|
|
160
|
+
if (cell !== undefined && inPS(ps, { x: cell.x + dx, y: cell.y + dy })) return true;
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Mark all shifted cells as occupied in the point set.
|
|
167
|
+
*
|
|
168
|
+
* @see lib/pack/pack.c:fits (cell insertion loop)
|
|
169
|
+
*/
|
|
170
|
+
export function markCells(cells: Point[], dx: number, dy: number, ps: PointSet): void {
|
|
171
|
+
for (let i = 0; i < cells.length; i++) {
|
|
172
|
+
const cell = cells[i];
|
|
173
|
+
if (cell !== undefined) insertPS(ps, { x: cell.x + dx, y: cell.y + dy });
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Test if a polyomino fits at (x,y); if so, record placement and fill cells.
|
|
179
|
+
*
|
|
180
|
+
* @see lib/pack/pack.c:fits
|
|
181
|
+
*/
|
|
182
|
+
export function fits(x: number, y: number, info: GInfo, ctx: PlaceCtx): Point | null {
|
|
183
|
+
if (hasCollision(info.cells, x, y, ctx.ps)) return null;
|
|
184
|
+
const bb = ctx.bbs[info.index];
|
|
185
|
+
if (bb === undefined) return null;
|
|
186
|
+
// C rounds the component's LL with round() — half AWAY from zero. Component
|
|
187
|
+
// bounding boxes are negative for every center-origin engine (neato/circo/
|
|
188
|
+
// twopi/sfdp), so a `.5` LL is ordinary and Math.round would translate the
|
|
189
|
+
// whole placed component by 1pt.
|
|
190
|
+
// @see lib/pack/pack.c:435-438 (fits: `const pointf LL = {.x = round(...)}`)
|
|
191
|
+
const place: Point = {
|
|
192
|
+
x: ctx.step * x - cround(bb.ll.x),
|
|
193
|
+
y: ctx.step * y - cround(bb.ll.y),
|
|
194
|
+
};
|
|
195
|
+
markCells(info.cells, x, y, ctx.ps);
|
|
196
|
+
return place;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Try centered placement for the first graph (i === 0).
|
|
201
|
+
*
|
|
202
|
+
* @see lib/pack/pack.c:placeGraph (i==0 branch)
|
|
203
|
+
*/
|
|
204
|
+
export function tryCenter(info: GInfo, ctx: PlaceCtx, margin: number): Point | null {
|
|
205
|
+
const bb = ctx.bbs[info.index];
|
|
206
|
+
if (bb === undefined) return null;
|
|
207
|
+
const W = gridCells(bb.ur.x - bb.ll.x + 2 * margin, ctx.step);
|
|
208
|
+
const H = gridCells(bb.ur.y - bb.ll.y + 2 * margin, ctx.step);
|
|
209
|
+
return fits(-Math.floor(W / 2), -Math.floor(H / 2), info, ctx);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Search concentric square spiral for a placement of the polyomino.
|
|
214
|
+
*
|
|
215
|
+
* @see lib/pack/pack.c:placeGraph
|
|
216
|
+
*/
|
|
217
|
+
export function placeGraph(i: number, info: GInfo, ctx: PlaceCtx, margin: number): Point {
|
|
218
|
+
if (i === 0) {
|
|
219
|
+
const p = tryCenter(info, ctx, margin);
|
|
220
|
+
if (p !== null) return p;
|
|
221
|
+
}
|
|
222
|
+
const p0 = fits(0, 0, info, ctx);
|
|
223
|
+
if (p0 !== null) return p0;
|
|
224
|
+
const bb = ctx.bbs[info.index];
|
|
225
|
+
const wide = bb !== undefined &&
|
|
226
|
+
Math.ceil(bb.ur.x - bb.ll.x) >= Math.ceil(bb.ur.y - bb.ll.y);
|
|
227
|
+
return spiralSearch(info, ctx, wide);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Sort GInfo by descending perimeter.
|
|
232
|
+
*
|
|
233
|
+
* @see lib/pack/pack.c:cmpf
|
|
234
|
+
*/
|
|
235
|
+
export function cmpByGPerimeter(a: GInfo, b: GInfo): number {
|
|
236
|
+
return b.perim - a.perim;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Pack rectangles using polyomino placement.
|
|
241
|
+
* Returns translation points indexed by original rectangle index.
|
|
242
|
+
*
|
|
243
|
+
* @see lib/pack/pack.c:polyRects
|
|
244
|
+
*/
|
|
245
|
+
export function polyRects(ng: number, bbs: Box[], pinfo: PackInfo): Point[] | null {
|
|
246
|
+
const step = computeStep(ng, bbs, pinfo.margin);
|
|
247
|
+
if (step <= 0) return null;
|
|
248
|
+
const infos: GInfo[] = [];
|
|
249
|
+
for (let i = 0; i < ng; i++) {
|
|
250
|
+
const bb = bbs[i];
|
|
251
|
+
if (bb === undefined) continue;
|
|
252
|
+
infos.push(genBox({ bb, ssize: step, margin: pinfo.margin, idx: i }));
|
|
253
|
+
}
|
|
254
|
+
// C `pack.c` sorts these via `qsort(cmpf)` (UNSTABLE); cmpf returns 0 on equal
|
|
255
|
+
// perimeter, so the tie order of equal-perimeter components is decided by libc
|
|
256
|
+
// qsort, not insertion order. Match it. @see util/bsd-qsort.ts
|
|
257
|
+
const sorted = gvQsort([...infos], cmpByGPerimeter);
|
|
258
|
+
const ctx: PlaceCtx = { ps: new Set(), step, bbs };
|
|
259
|
+
const places: Point[] = new Array<Point>(ng).fill({ x: 0, y: 0 });
|
|
260
|
+
for (let i = 0; i < sorted.length; i++) {
|
|
261
|
+
const info = sorted[i];
|
|
262
|
+
if (info === undefined) continue;
|
|
263
|
+
places[info.index] = placeGraph(i, info, ctx, pinfo.margin);
|
|
264
|
+
}
|
|
265
|
+
return places;
|
|
266
|
+
}
|
|
@@ -0,0 +1,426 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Polyomino-based packing of laid-out graphs (components), a port of
|
|
5
|
+
* the l_node/l_clust/l_graph modes of putGraphs.
|
|
6
|
+
*
|
|
7
|
+
* Each graph is approximated by the set of grid cells ("polyomino")
|
|
8
|
+
* covered by its nodes and edges (or its bounding box in l_graph
|
|
9
|
+
* mode); polyominoes are then placed largest-first on concentric
|
|
10
|
+
* rings around the origin.
|
|
11
|
+
*
|
|
12
|
+
* @see lib/pack/pack.c (Freivalds et al., GD 2002 polyomino packing)
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import type { Box, Point } from '../../model/geom.js';
|
|
16
|
+
import type { Graph } from '../../model/graph.js';
|
|
17
|
+
import type { Node } from '../../model/node.js';
|
|
18
|
+
import type { Edge } from '../../model/edge.js';
|
|
19
|
+
import type { PackInfo } from './types.js';
|
|
20
|
+
import { PackMode } from './types.js';
|
|
21
|
+
import { cround } from '../../common/arith.js';
|
|
22
|
+
import { gvQsort } from '../../util/bsd-qsort.js';
|
|
23
|
+
|
|
24
|
+
/** Max. avg. polyomino size. @see lib/pack/pack.c:C */
|
|
25
|
+
const C_AVG = 100;
|
|
26
|
+
|
|
27
|
+
/** Cells required by size x at cell size s. @see lib/pack/pack.c:GRID */
|
|
28
|
+
function grid(x: number, s: number): number {
|
|
29
|
+
return Math.ceil(x / s);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** Cell index of coordinate v (double arithmetic). @see lib/pack/pack.c:CVAL */
|
|
33
|
+
function cval(v: number, s: number): number {
|
|
34
|
+
return v >= 0 ? v / s : (v + 1) / s - 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Map a point to its containing cell. @see lib/pack/pack.c:CELL */
|
|
38
|
+
function cell(p: Point, s: number): Point {
|
|
39
|
+
return { x: cval(p.x, s), y: cval(p.y, s) };
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/** Integer point set. @see lib/common/pointset.c */
|
|
43
|
+
class PointSet {
|
|
44
|
+
private readonly m = new Map<string, Point>();
|
|
45
|
+
add(x: number, y: number): void {
|
|
46
|
+
this.m.set(`${x},${y}`, { x, y });
|
|
47
|
+
}
|
|
48
|
+
has(p: Point): boolean {
|
|
49
|
+
return this.m.has(`${p.x},${p.y}`);
|
|
50
|
+
}
|
|
51
|
+
points(): Point[] {
|
|
52
|
+
return [...this.m.values()];
|
|
53
|
+
}
|
|
54
|
+
get size(): number {
|
|
55
|
+
return this.m.size;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Polyomino info for one graph. @see lib/pack/pack.c:ginfo */
|
|
60
|
+
interface GInfo {
|
|
61
|
+
perim: number;
|
|
62
|
+
cells: Point[];
|
|
63
|
+
index: number;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Grid step size: positive root of the quadratic over total cell area.
|
|
68
|
+
* @see lib/pack/pack.c:computeStep
|
|
69
|
+
*/
|
|
70
|
+
export function computeStep(bbs: Box[], margin: number): number {
|
|
71
|
+
const a = C_AVG * bbs.length - 1;
|
|
72
|
+
let b = 0;
|
|
73
|
+
let c = 0;
|
|
74
|
+
for (const bb of bbs) {
|
|
75
|
+
const W = bb.ur.x - bb.ll.x + 2 * margin;
|
|
76
|
+
const H = bb.ur.y - bb.ll.y + 2 * margin;
|
|
77
|
+
b -= W + H;
|
|
78
|
+
c -= W * H;
|
|
79
|
+
}
|
|
80
|
+
const r = Math.sqrt(b * b - 4 * a * c);
|
|
81
|
+
const root = Math.trunc((-b + r) / (2 * a));
|
|
82
|
+
return root === 0 ? 1 : root;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/** Bresenham state for one rasterised line. */
|
|
86
|
+
interface LineState {
|
|
87
|
+
x: number; y: number; x2: number; y2: number;
|
|
88
|
+
ax: number; ay: number; sx: number; sy: number;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** X-dominant Bresenham sweep. @see pack.c:fillLine */
|
|
92
|
+
function lineXDominant(st: LineState, ps: PointSet): void {
|
|
93
|
+
let d = st.ay - (st.ax >> 1);
|
|
94
|
+
for (;;) {
|
|
95
|
+
ps.add(st.x, st.y);
|
|
96
|
+
if (st.x === st.x2) return;
|
|
97
|
+
if (d >= 0) { st.y += st.sy; d -= st.ax; }
|
|
98
|
+
st.x += st.sx;
|
|
99
|
+
d += st.ay;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** Y-dominant Bresenham sweep. @see pack.c:fillLine */
|
|
104
|
+
function lineYDominant(st: LineState, ps: PointSet): void {
|
|
105
|
+
let d = st.ax - (st.ay >> 1);
|
|
106
|
+
for (;;) {
|
|
107
|
+
ps.add(st.x, st.y);
|
|
108
|
+
if (st.y === st.y2) return;
|
|
109
|
+
if (d >= 0) { st.x += st.sx; d -= st.ay; }
|
|
110
|
+
st.y += st.sy;
|
|
111
|
+
d += st.ax;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Mark cells crossed by the cell-space line p-q (Bresenham). @see pack.c:fillLine */
|
|
116
|
+
function fillLine(p: Point, q: Point, ps: PointSet): void {
|
|
117
|
+
const x = cround(p.x);
|
|
118
|
+
const y = cround(p.y);
|
|
119
|
+
const x2 = cround(q.x);
|
|
120
|
+
const y2 = cround(q.y);
|
|
121
|
+
const dx = x2 - x;
|
|
122
|
+
const dy = y2 - y;
|
|
123
|
+
const st: LineState = {
|
|
124
|
+
x, y, x2, y2,
|
|
125
|
+
ax: Math.abs(dx) << 1, ay: Math.abs(dy) << 1,
|
|
126
|
+
sx: dx > 0 ? 1 : -1, sy: dy > 0 ? 1 : -1,
|
|
127
|
+
};
|
|
128
|
+
if (st.ax > st.ay) lineXDominant(st, ps);
|
|
129
|
+
else lineYDominant(st, ps);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** Mark all cells in the inclusive cell-rect [LL, UR]. */
|
|
133
|
+
function fillRect(LL: Point, UR: Point, ps: PointSet): void {
|
|
134
|
+
for (let x = LL.x; x <= UR.x; x++) {
|
|
135
|
+
for (let y = LL.y; y <= UR.y; y++) ps.add(x, y);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Rounded cell for a translated point. */
|
|
140
|
+
function roundedCell(p: Point, ssize: number): Point {
|
|
141
|
+
const c = cell(p, ssize);
|
|
142
|
+
return { x: cround(c.x), y: cround(c.y) };
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Mark cells crossed by edge e. With doS and a routed spline present, follow
|
|
147
|
+
* the spline control points (self-loops and curved edges bulge past the
|
|
148
|
+
* straight tail-to-head chord, adding cells the packer must respect); else a
|
|
149
|
+
* straight tail-to-head line. neato/twopi component packing set doSplines=true,
|
|
150
|
+
* so the spline branch is live — omitting it undercounts the polyomino and lets
|
|
151
|
+
* a neighbouring component pack one grid cell too close.
|
|
152
|
+
* @see lib/pack/pack.c:fillEdge
|
|
153
|
+
*/
|
|
154
|
+
function fillEdge(
|
|
155
|
+
e: Edge, p: Point, ps: PointSet, off: Point, ssize: number, doS: boolean,
|
|
156
|
+
): void {
|
|
157
|
+
const spl = e.info.spl;
|
|
158
|
+
// C: `if (!doS || !ED_spl(e))` — straight segment tail cell -> head cell.
|
|
159
|
+
if (!doS || spl === undefined) {
|
|
160
|
+
const hc = e.head.info.coord ?? { x: 0, y: 0 };
|
|
161
|
+
const hpt = roundedCell({ x: hc.x + off.x, y: hc.y + off.y }, ssize);
|
|
162
|
+
fillLine(p, hpt, ps);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const cellOf = (q: Point): Point => roundedCell({ x: q.x + off.x, y: q.y + off.y }, ssize);
|
|
166
|
+
for (let j = 0; j < spl.size; j++) {
|
|
167
|
+
const bz = spl.list[j];
|
|
168
|
+
if (bz === undefined) continue;
|
|
169
|
+
let pt: Point;
|
|
170
|
+
let hpt: Point;
|
|
171
|
+
let k: number;
|
|
172
|
+
if (bz.sflag) {
|
|
173
|
+
pt = cellOf(bz.sp);
|
|
174
|
+
hpt = cellOf(bz.list[0]!);
|
|
175
|
+
k = 1;
|
|
176
|
+
} else {
|
|
177
|
+
pt = cellOf(bz.list[0]!);
|
|
178
|
+
hpt = cellOf(bz.list[1]!);
|
|
179
|
+
k = 2;
|
|
180
|
+
}
|
|
181
|
+
fillLine(pt, hpt, ps);
|
|
182
|
+
for (; k < bz.size; k++) {
|
|
183
|
+
pt = hpt;
|
|
184
|
+
hpt = cellOf(bz.list[k]!);
|
|
185
|
+
fillLine(pt, hpt, ps);
|
|
186
|
+
}
|
|
187
|
+
if (bz.eflag) {
|
|
188
|
+
pt = hpt;
|
|
189
|
+
hpt = cellOf(bz.ep);
|
|
190
|
+
fillLine(pt, hpt, ps);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Polyomino from a graph's bounding box only (l_graph mode).
|
|
197
|
+
* @see lib/pack/pack.c:genBox
|
|
198
|
+
*/
|
|
199
|
+
function genBox(bb0: Box, ssize: number, margin: number, center: Point): GInfo {
|
|
200
|
+
const ps = new PointSet();
|
|
201
|
+
const bbW = cround(bb0.ur.x) - cround(bb0.ll.x);
|
|
202
|
+
const bbH = cround(bb0.ur.y) - cround(bb0.ll.y);
|
|
203
|
+
const LL = roundedCell({ x: center.x - margin, y: center.y - margin }, ssize);
|
|
204
|
+
const UR = roundedCell({ x: center.x + bbW + margin, y: center.y + bbH + margin }, ssize);
|
|
205
|
+
fillRect(LL, UR, ps);
|
|
206
|
+
return {
|
|
207
|
+
cells: ps.points(),
|
|
208
|
+
perim: grid(bb0.ur.x - bb0.ll.x + 2 * margin, ssize)
|
|
209
|
+
+ grid(bb0.ur.y - bb0.ll.y + 2 * margin, ssize),
|
|
210
|
+
index: 0,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/** Shared cover-pass parameters. */
|
|
215
|
+
interface CoverCtx {
|
|
216
|
+
eg: Graph;
|
|
217
|
+
ps: PointSet;
|
|
218
|
+
off: Point;
|
|
219
|
+
ssize: number;
|
|
220
|
+
margin: number;
|
|
221
|
+
doSplines: boolean;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** Cover one node's box and its out-edges. @see pack.c:genPoly (node loop body) */
|
|
225
|
+
function coverNode(n: Node, ctx: CoverCtx): void {
|
|
226
|
+
const c = n.info.coord ?? { x: 0, y: 0 };
|
|
227
|
+
const pt = { x: cround(c.x) + ctx.off.x, y: cround(c.y) + ctx.off.y };
|
|
228
|
+
const s2 = {
|
|
229
|
+
x: cround(ctx.margin + (n.info.lw + n.info.rw) / 2),
|
|
230
|
+
y: cround(ctx.margin + n.info.ht / 2),
|
|
231
|
+
};
|
|
232
|
+
const LL = roundedCell({ x: pt.x - s2.x, y: pt.y - s2.y }, ctx.ssize);
|
|
233
|
+
const UR = roundedCell({ x: pt.x + s2.x, y: pt.y + s2.y }, ctx.ssize);
|
|
234
|
+
fillRect(LL, UR, ctx.ps);
|
|
235
|
+
const cpt = roundedCell(pt, ctx.ssize);
|
|
236
|
+
for (const e of n.outEdges(ctx.eg)) {
|
|
237
|
+
fillEdge(e, cpt, ctx.ps, ctx.off, ctx.ssize, ctx.doSplines);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Polyomino from a graph's nodes and edges (l_node mode; the l_clust
|
|
243
|
+
* top-cluster special case is not ported — no packing caller has
|
|
244
|
+
* clusters inside components yet).
|
|
245
|
+
* @see lib/pack/pack.c:genPoly
|
|
246
|
+
*/
|
|
247
|
+
function genPoly(
|
|
248
|
+
root: Graph, g: Graph, bb: Box, ssize: number, pinfo: PackInfo, center: Point,
|
|
249
|
+
): GInfo {
|
|
250
|
+
const ps = new PointSet();
|
|
251
|
+
// C: dx = center.x - round(GD_bb(g).LL.x) (pack.c:genPoly). center is (0,0)
|
|
252
|
+
// for free packing and the fixed-component bb midpoint when a pinned graph
|
|
253
|
+
// is present — it shifts every component's grid phase identically so the
|
|
254
|
+
// polyomino cell counts (and thus perimeters and sort order) match C.
|
|
255
|
+
const ctx: CoverCtx = {
|
|
256
|
+
eg: root,
|
|
257
|
+
ps,
|
|
258
|
+
off: { x: center.x - cround(bb.ll.x), y: center.y - cround(bb.ll.y) },
|
|
259
|
+
ssize,
|
|
260
|
+
margin: pinfo.margin,
|
|
261
|
+
doSplines: pinfo.doSplines,
|
|
262
|
+
};
|
|
263
|
+
for (const n of g.nodes.values()) coverNode(n, ctx);
|
|
264
|
+
return {
|
|
265
|
+
cells: ps.points(),
|
|
266
|
+
perim: grid(bb.ur.x - bb.ll.x + 2 * pinfo.margin, ssize)
|
|
267
|
+
+ grid(bb.ur.y - bb.ll.y + 2 * pinfo.margin, ssize),
|
|
268
|
+
index: 0,
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Try the polyomino at cell (x, y); on success occupy the cells and
|
|
274
|
+
* record the placement offset.
|
|
275
|
+
* @see lib/pack/pack.c:fits
|
|
276
|
+
*/
|
|
277
|
+
/** Shared placement state. */
|
|
278
|
+
interface PlaceCtx {
|
|
279
|
+
ps: PointSet;
|
|
280
|
+
places: Point[];
|
|
281
|
+
step: number;
|
|
282
|
+
margin: number;
|
|
283
|
+
bbs: Box[];
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
function fits(x: number, y: number, info: GInfo, ctx: PlaceCtx): boolean {
|
|
287
|
+
for (const c of info.cells) {
|
|
288
|
+
if (ctx.ps.has({ x: c.x + x, y: c.y + y })) return false;
|
|
289
|
+
}
|
|
290
|
+
const bb = ctx.bbs[info.index]!;
|
|
291
|
+
const LL = { x: cround(bb.ll.x), y: cround(bb.ll.y) };
|
|
292
|
+
ctx.places[info.index] = { x: ctx.step * x - LL.x, y: ctx.step * y - LL.y };
|
|
293
|
+
for (const c of info.cells) ctx.ps.add(c.x + x, c.y + y);
|
|
294
|
+
return true;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/** Ring candidates for wide graphs (W >= H). @see pack.c:placeGraph */
|
|
298
|
+
function* ringWide(bnd: number): Generator<[number, number]> {
|
|
299
|
+
let x = 0;
|
|
300
|
+
let y = -bnd;
|
|
301
|
+
for (; x < bnd; x++) yield [x, y];
|
|
302
|
+
for (; y < bnd; y++) yield [x, y];
|
|
303
|
+
for (; x > -bnd; x--) yield [x, y];
|
|
304
|
+
for (; y > -bnd; y--) yield [x, y];
|
|
305
|
+
for (; x < 0; x++) yield [x, y];
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** Ring candidates for tall graphs (W < H). @see pack.c:placeGraph */
|
|
309
|
+
function* ringTall(bnd: number): Generator<[number, number]> {
|
|
310
|
+
let y = 0;
|
|
311
|
+
let x = -bnd;
|
|
312
|
+
for (; y > -bnd; y--) yield [x, y];
|
|
313
|
+
for (; x < bnd; x++) yield [x, y];
|
|
314
|
+
for (; y < bnd; y++) yield [x, y];
|
|
315
|
+
for (; x > -bnd; x--) yield [x, y];
|
|
316
|
+
for (; y > 0; y--) yield [x, y];
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Position a fixed (pinned) graph. Its polyomino was generated where it will
|
|
321
|
+
* be (via the center offset in genPoly), so the final translation is just
|
|
322
|
+
* -center and its cells are occupied as-is.
|
|
323
|
+
* @see lib/pack/pack.c:placeFixed
|
|
324
|
+
*/
|
|
325
|
+
function placeFixed(info: GInfo, ctx: PlaceCtx, center: Point): void {
|
|
326
|
+
ctx.places[info.index] = { x: -center.x, y: -center.y };
|
|
327
|
+
for (const c of info.cells) ctx.ps.add(c.x, c.y);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Place one polyomino on concentric rings out from the origin; the
|
|
332
|
+
* first (largest) graph is centered on the origin when possible.
|
|
333
|
+
* @see lib/pack/pack.c:placeGraph
|
|
334
|
+
*/
|
|
335
|
+
function placeGraph(i: number, info: GInfo, ctx: PlaceCtx): void {
|
|
336
|
+
const bb = ctx.bbs[info.index]!;
|
|
337
|
+
if (i === 0) {
|
|
338
|
+
const W = grid(bb.ur.x - bb.ll.x + 2 * ctx.margin, ctx.step);
|
|
339
|
+
const H = grid(bb.ur.y - bb.ll.y + 2 * ctx.margin, ctx.step);
|
|
340
|
+
if (fits(-Math.trunc(W / 2), -Math.trunc(H / 2), info, ctx)) return;
|
|
341
|
+
}
|
|
342
|
+
if (fits(0, 0, info, ctx)) return;
|
|
343
|
+
const wide = Math.ceil(bb.ur.x - bb.ll.x) >= Math.ceil(bb.ur.y - bb.ll.y);
|
|
344
|
+
for (let bnd = 1; ; bnd++) {
|
|
345
|
+
const ring = wide ? ringWide(bnd) : ringTall(bnd);
|
|
346
|
+
for (const [x, y] of ring) {
|
|
347
|
+
if (fits(x, y, info, ctx)) return;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Polyomino packing of pre-laid-out graphs. Returns the translation
|
|
354
|
+
* point for each graph (indexed like gs). When pinfo.fixed is set, the
|
|
355
|
+
* fixed (pinned) components stay put and the rest pack around them.
|
|
356
|
+
* @see lib/pack/pack.c:polyGraphs
|
|
357
|
+
*/
|
|
358
|
+
export function polyGraphs(
|
|
359
|
+
gs: Graph[], root: Graph, pinfo: PackInfo, bbs: Box[],
|
|
360
|
+
): Point[] | null {
|
|
361
|
+
if (gs.length === 0) return null;
|
|
362
|
+
const stepSize = computeStep(bbs, pinfo.margin);
|
|
363
|
+
if (stepSize <= 0) return null;
|
|
364
|
+
// Fixed (pinned) protocol: when some components carry a pinned node, C keeps
|
|
365
|
+
// them put and packs the rest around them. center = midpoint of the union of
|
|
366
|
+
// the fixed components' (rounded) bboxes; (0,0) for free packing.
|
|
367
|
+
// @see lib/pack/pack.c:putGraphs (fixed_bb / center / placeFixed)
|
|
368
|
+
const fixed = pinfo.fixed;
|
|
369
|
+
const center = { x: 0, y: 0 };
|
|
370
|
+
if (fixed) {
|
|
371
|
+
let fixedBB: Box | null = null;
|
|
372
|
+
for (let i = 0; i < gs.length; i++) {
|
|
373
|
+
if (!fixed[i]) continue;
|
|
374
|
+
const b = bbs[i]!;
|
|
375
|
+
const rb: Box = {
|
|
376
|
+
ll: { x: cround(b.ll.x), y: cround(b.ll.y) },
|
|
377
|
+
ur: { x: cround(b.ur.x), y: cround(b.ur.y) },
|
|
378
|
+
};
|
|
379
|
+
fixedBB = fixedBB === null ? rb : {
|
|
380
|
+
ll: { x: Math.min(rb.ll.x, fixedBB.ll.x), y: Math.min(rb.ll.y, fixedBB.ll.y) },
|
|
381
|
+
ur: { x: Math.max(rb.ur.x, fixedBB.ur.x), y: Math.max(rb.ur.y, fixedBB.ur.y) },
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (fixedBB) {
|
|
385
|
+
center.x = cround((fixedBB.ll.x + fixedBB.ur.x) / 2);
|
|
386
|
+
center.y = cround((fixedBB.ll.y + fixedBB.ur.y) / 2);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const info: GInfo[] = gs.map((g, i) => {
|
|
390
|
+
const gi = pinfo.mode === PackMode.Graph
|
|
391
|
+
? genBox(bbs[i]!, stepSize, pinfo.margin, center)
|
|
392
|
+
: genPoly(root, g, bbs[i]!, stepSize, pinfo, center);
|
|
393
|
+
gi.index = i;
|
|
394
|
+
return gi;
|
|
395
|
+
});
|
|
396
|
+
// descending by perimeter (C qsort with flipped comparator); cmpf returns 0 on
|
|
397
|
+
// equal perimeter, so the tie order is qsort's, not insertion order. @see util/bsd-qsort.ts
|
|
398
|
+
const sinfo = gvQsort([...info], (a, b) => b.perim - a.perim);
|
|
399
|
+
const ctx: PlaceCtx = {
|
|
400
|
+
ps: new PointSet(),
|
|
401
|
+
places: gs.map(() => ({ x: 0, y: 0 })),
|
|
402
|
+
step: stepSize,
|
|
403
|
+
margin: pinfo.margin,
|
|
404
|
+
bbs,
|
|
405
|
+
};
|
|
406
|
+
if (fixed) {
|
|
407
|
+
// C indexes `fixed` by the SORTED loop position i, not sinfo[i].index — an
|
|
408
|
+
// original-vs-sorted-index mismatch in pack.c that is load-bearing: the
|
|
409
|
+
// component at sorted position k is treated as fixed iff fixed[k]. With
|
|
410
|
+
// fixed = [true,false,…], that fixes the LARGEST component (sorted first)
|
|
411
|
+
// at -center, not the pinned one, and the pinned component is packed
|
|
412
|
+
// normally at its sorted position. Replicate the quirk exactly.
|
|
413
|
+
// @see lib/pack/pack.c:putGraphs (fixed placement loops)
|
|
414
|
+
for (let i = 0; i < sinfo.length; i++) {
|
|
415
|
+
if (fixed[i]) placeFixed(sinfo[i]!, ctx, center);
|
|
416
|
+
}
|
|
417
|
+
for (let i = 0; i < sinfo.length; i++) {
|
|
418
|
+
if (!fixed[i]) placeGraph(i, sinfo[i]!, ctx);
|
|
419
|
+
}
|
|
420
|
+
} else {
|
|
421
|
+
for (let i = 0; i < sinfo.length; i++) {
|
|
422
|
+
placeGraph(i, sinfo[i]!, ctx);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return ctx.places;
|
|
426
|
+
}
|