@mark1russell7/layout-contract 0.11.2 → 0.11.4
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/README.md +1 -0
- package/build/index.d.ts +70 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +178 -1
- package/build/index.js.map +1 -1
- package/package.json +2 -1
- package/src/grid-walk.ts +219 -0
- package/src/index.ts +1 -0
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ The package has one runtime dependency: `@mark1russell7/rigor-generators`, the h
|
|
|
19
19
|
| The balance and stability measures | `balanceOf`, `Balance`, `nearestGaps`, `procrustesOf`, `ProcrustesOptions`, `perChange`, `balanceMeasures`, `balanceMeasureSpecs`, `BALANCE_MEASURE_SUFFIXES`, `BalanceMeasureSuffix`, `BALANCE_SIDE_DEPTH`, `PlacedBox` |
|
|
20
20
|
| The cell measures | `cellsOf`, `Cells`, `CellItem`, `cellMeasures`, `cellMeasureSpecs`, `cellMeasureEntries`, `CELL_MEASURE_SUFFIXES`, `CellMeasureSuffix`, `CELL_SOURCE`, `SQUARE_COMPACTNESS` |
|
|
21
21
|
| The paths | `PathSegment`, `PathMove`, `PathLine`, `PathCubic`, `PathArc`, `PathTangent`, `PATH_KINDS`, `pathOf`, `samplePath`, `pathBounds`, `pathStart`, `pathEnd`, `toSvgPath`, `cubicAt`, `checkPath` |
|
|
22
|
+
| The grid walk inside a polygon | `CellGrid`, `GridPoint`, `PolygonGridOptions`, `polygonGrid`, `cellCenter`, `cellNear`, `GridSearch`, `searchGrid`, `walkCells`, `inSight`, `straightenWalk`, `polylineLength` |
|
|
22
23
|
| The picture `layout-picture/1` | `LayoutPicture`, `PictureBox`, `PictureRoute`, `PictureLabel`, `LabelAlign`, `LABEL_ALIGNS`, `PICTURE_SCHEMA`, `pictureOf`, `PictureParts`, `PictureRouteSource`, `checkPicture`, `parsePicture`, `pictureBounds` |
|
|
23
24
|
| The boxes in boxes | `BoxNode`, `boxTree`, `topBoxes`, `siblingEdges`, `flattenInput`, `FlattenOptions`, `FLATTEN_SIDES`, `flatPortId` |
|
|
24
25
|
| Text layout, in the subpath `/text` | `layoutText`, `TextLayout`, `TextLayoutOptions`, `TextSizing`, `createTextCharset`, `TextCharset`, `TextCharsetOptions`, `DIGITS`, `PRINTABLE_ASCII`, `createTextLayoutCache`, `TextLayoutCache`, `TextLayoutCacheOptions`, `TextLayoutCacheStats`, `createMeasurer`, `TextMeasurer`, `canvasAdvance`, `AdvanceFn`, `fontKey`, `graphemesOf`, `textMeasures`, `TEXT_MEASURES`, `TEXT_UNITS` |
|
package/build/index.d.ts
CHANGED
|
@@ -998,6 +998,76 @@ export declare function pathEnd(segments: readonly PathSegment[]): PathTangent;
|
|
|
998
998
|
* An arc starts at the end of the segment before, and it ends at its `to`, to 1e-6 of its radius plus 1.
|
|
999
999
|
*/
|
|
1000
1000
|
export declare function checkPath(value: unknown): string[];
|
|
1001
|
+
/** A point of a grid walk: an x and a y, in the unit of the polygon. */
|
|
1002
|
+
export type GridPoint = readonly [number, number];
|
|
1003
|
+
/**
|
|
1004
|
+
* A grid of the cells inside a polygon. A cell is inside when its center is inside the polygon and not inside a hole.
|
|
1005
|
+
* The cell at column `c` and row `r` has the index `r * columns + c`.
|
|
1006
|
+
*/
|
|
1007
|
+
export interface CellGrid {
|
|
1008
|
+
/** The least x and the least y of the outer ring. */
|
|
1009
|
+
readonly origin: GridPoint;
|
|
1010
|
+
/** The side of a cell, in the unit of the polygon. */
|
|
1011
|
+
readonly cell: number;
|
|
1012
|
+
readonly columns: number;
|
|
1013
|
+
readonly rows: number;
|
|
1014
|
+
/** The value 1 for each cell inside the polygon, else 0. */
|
|
1015
|
+
readonly inside: Uint8Array;
|
|
1016
|
+
}
|
|
1017
|
+
/** The options of `polygonGrid`. */
|
|
1018
|
+
export interface PolygonGridOptions {
|
|
1019
|
+
/** The rings of the holes of the polygon. A cell inside a hole is not inside the polygon. */
|
|
1020
|
+
readonly holes?: readonly Ring[] | undefined;
|
|
1021
|
+
/** The greatest count of cells. When the grid has more cells, the side of a cell doubles until it fits. The default is 4,000,000. */
|
|
1022
|
+
readonly largest?: number | undefined;
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* This function makes the grid of the cells inside a polygon.
|
|
1026
|
+
*
|
|
1027
|
+
* @param ring - The outer ring of the polygon
|
|
1028
|
+
* @param cell - The side of a cell, in the unit of the polygon. It is a finite number above 0.
|
|
1029
|
+
* @param options - The holes of the polygon, and the greatest count of cells
|
|
1030
|
+
*/
|
|
1031
|
+
export declare function polygonGrid(ring: Ring, cell: number, options?: PolygonGridOptions): CellGrid;
|
|
1032
|
+
/** This function gives the center of a cell of a grid. */
|
|
1033
|
+
export declare function cellCenter(grid: CellGrid, index: number): GridPoint;
|
|
1034
|
+
/**
|
|
1035
|
+
* This function gives the cell inside the polygon that is nearest to a point, within `reach` cells of the cell of the point.
|
|
1036
|
+
* It gives -1 when no cell inside the polygon is so near.
|
|
1037
|
+
*
|
|
1038
|
+
* @param grid - The grid of the polygon
|
|
1039
|
+
* @param point - The point
|
|
1040
|
+
* @param reach - The greatest count of cells from the cell of the point, on each axis. The default is 4.
|
|
1041
|
+
*/
|
|
1042
|
+
export declare function cellNear(grid: CellGrid, [x, y]: GridPoint, reach?: number): number;
|
|
1043
|
+
/** The result of a search of a grid from one cell: the walk length to each cell, and the cell before it on the walk. */
|
|
1044
|
+
export interface GridSearch {
|
|
1045
|
+
/** The length of the shortest walk to each cell, in the unit of the polygon. A cell with no walk has `Infinity`. */
|
|
1046
|
+
readonly distance: Float64Array;
|
|
1047
|
+
/** The cell before each cell on its shortest walk. The start and a cell with no walk have -1. */
|
|
1048
|
+
readonly previous: Int32Array;
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* This function finds the shortest walk from one cell to each cell of a grid, in steps to the 8 next cells.
|
|
1052
|
+
* A diagonal step goes only between two cells inside the polygon, so a walk does not cut a corner of the edge.
|
|
1053
|
+
* Such a walk is at most 8.3% longer than the shortest walk in any direction.
|
|
1054
|
+
*
|
|
1055
|
+
* @param grid - The grid of the polygon
|
|
1056
|
+
* @param start - The index of the start cell
|
|
1057
|
+
* @param targets - The cells that end the search when the search reaches each of them. No value searches each cell.
|
|
1058
|
+
*/
|
|
1059
|
+
export declare function searchGrid(grid: CellGrid, start: number, targets?: readonly number[]): GridSearch;
|
|
1060
|
+
/** This function gives the cells of the walk from the start of a search to a cell, in their sequence. A cell with no walk gives an empty list. */
|
|
1061
|
+
export declare function walkCells(search: GridSearch, end: number): number[];
|
|
1062
|
+
/** This function tells if the straight line between two points stays in the cells inside the polygon. It samples the line at each half cell. */
|
|
1063
|
+
export declare function inSight(grid: CellGrid, [xa, ya]: GridPoint, [xb, yb]: GridPoint): boolean;
|
|
1064
|
+
/**
|
|
1065
|
+
* This function makes a walk shorter: from each corner, it goes straight to the farthest next point in sight.
|
|
1066
|
+
* The first point and the last point stay. Each straight run stays in the cells inside the polygon.
|
|
1067
|
+
*/
|
|
1068
|
+
export declare function straightenWalk(grid: CellGrid, points: readonly GridPoint[]): GridPoint[];
|
|
1069
|
+
/** This function gives the length of a line through a list of points. */
|
|
1070
|
+
export declare function polylineLength(points: readonly GridPoint[]): number;
|
|
1001
1071
|
/** The schema of a picture. */
|
|
1002
1072
|
export declare const PICTURE_SCHEMA = "layout-picture/1";
|
|
1003
1073
|
/** The places of the lines of a label in its width. */
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["StrategySpace","KindOptions","SpaceSizeOptions","SpaceSize","EnumerateOptions","StrategyConfig"],"sources":["../src/geometry3.ts","../src/curves.ts","../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/resize.ts","../src/balance.ts","../src/measure-registry.ts","../src/cell.ts","../src/frame.ts","../src/path.ts","../src/picture.ts","../src/nest.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/corpus-manifest.ts","../src/strategy-space.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts","../src/measure-survey.ts"],"mappings":";;;;;;;;iBAOiB;WACN;WACA;WACA;;;qBAIE,SAAS;;;;;iBAML;WACN;WACA;WACA;WACA;WACA;WACA;;;;;;iBAOM;WACN;WACA;WACA;WACA;;;qBAIE,cAAc;;;;;iBAMV;WACN,UAAU;WACV,UAAU;;;qBAIR,eAAe;;wBAGZ,WAAW,GAAG,QAAQ,GAAG,SAAS;;wBAKlC,gBAAgB,GAAG,QAAQ,GAAG,SAAS;;wBAKvC,YAAY,OAAO,QAAQ,iBAAiB;;wBAK5C,KAAK,GAAG,QAAQ,GAAG;;wBAKnB,OAAO,GAAG,QAAQ,GAAG,SAAS;;wBAK9B,QAAQ,QAAQ;;wBAKhB,UAAU,GAAG,QAAQ,GAAG;;;;;;wBASxB,cAAc,MAAM,QAAQ,gBAAgB;;;;;wBAa5C,kBAAkB,OAAO,WAAW,OAAO,YAAY;;wBAUvD,iBAAiB,UAAU,YAAY;;;;;wBAQvC,mBAAmB,UAAU,YAAY;;wBAOzC,aAAa,UAAU,WAAW,OAAO,SAAS;;wBAYlD,gBAAgB,WAAW,YAAY,OAAO,SAAS;;;;;wBAQvD,mBAAmB,OAAO,YAAY,OAAO,aAAa;;wBAQ1D,kBAAkB,WAAW,aAAa;;;;;wBAS1C,iBAAiB,WAAW;;wBAwB5B,WAAW,KAAK,OAAO;;wBAKvB,WAAW,KAAK;;;;;wBAQhB,YAAY,KAAK,gBAAgB;;wBAajC,UAAU,iBAAiB,WAAW;;;;;wBAwBtC,mBAAmB,KAAK,MAAM,WAAW,aAAa;;;;;wBAStD,WAAW,GAAG,MAAM,GAAG,OAAO;;;;;YCnPlC;;qBAmBC,2BAA2B;;YAG5B;;YAGA,yBAAyB,eAAe,eAAe,eAAe;;iBAGjE;WACN;WACA,iBAAiB,eAAe,eAAe,eAAe;WAC9D,MAAM;WACN,OAAO;;;qBAY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B;;iBAGI;WACN;WACA;WACA,WAAW;WACX;WACA;;WAEA;;;iBAIM;WACN;WACA;WACA,mBAAmB;;;iBAIb;WACN,eAAe;;WAEf;WACA,kBAAkB;;;;;;iBAOZ;WACN;WACA;;WAEA;aAA4B;aAAqB;aAAyB;;;;iBAIpE;;WAEN;;WAEA,UAAU,SAAS;;WAEnB;aAA+B;aAAqB;aAAsC;;;WAE1F,gBAAgB;;WAEhB;;WAEA,OAAO,SAAS;;;wBAOX,YAAY;;wBA8CZ,eAAe;;wBAMf,eAAe,QAAQ,gBAAgB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["StrategySpace","KindOptions","SpaceSizeOptions","SpaceSize","EnumerateOptions","StrategyConfig"],"sources":["../src/geometry3.ts","../src/curves.ts","../src/tolerance.ts","../src/output.ts","../src/record.ts","../src/rules.ts","../src/turn.ts","../src/resize.ts","../src/balance.ts","../src/measure-registry.ts","../src/cell.ts","../src/frame.ts","../src/path.ts","../src/grid-walk.ts","../src/picture.ts","../src/nest.ts","../src/strategy.ts","../src/random.ts","../src/edges.ts","../src/hash.ts","../src/portfolio.ts","../src/corpus-manifest.ts","../src/strategy-space.ts","../src/strategy-catalog.ts","../src/verdict.ts","../src/families.ts","../src/measure-survey.ts"],"mappings":";;;;;;;;iBAOiB;WACN;WACA;WACA;;;qBAIE,SAAS;;;;;iBAML;WACN;WACA;WACA;WACA;WACA;WACA;;;;;;iBAOM;WACN;WACA;WACA;WACA;;;qBAIE,cAAc;;;;;iBAMV;WACN,UAAU;WACV,UAAU;;;qBAIR,eAAe;;wBAGZ,WAAW,GAAG,QAAQ,GAAG,SAAS;;wBAKlC,gBAAgB,GAAG,QAAQ,GAAG,SAAS;;wBAKvC,YAAY,OAAO,QAAQ,iBAAiB;;wBAK5C,KAAK,GAAG,QAAQ,GAAG;;wBAKnB,OAAO,GAAG,QAAQ,GAAG,SAAS;;wBAK9B,QAAQ,QAAQ;;wBAKhB,UAAU,GAAG,QAAQ,GAAG;;;;;;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iBAIM;WACN;WACA;WACA,mBAAmB;;;iBAIb;WACN,eAAe;;WAEf;WACA,kBAAkB;;;;;;iBAOZ;WACN;WACA;;WAEA;aAA4B;aAAqB;aAAyB;;;;iBAIpE;;WAEN;;WAEA,UAAU,SAAS;;WAEnB;aAA+B;aAAqB;aAAsC;;;WAE1F,gBAAgB;;WAEhB;;WAEA,OAAO,SAAS;;;wBAOX,YAAY;;wBA8CZ,eAAe;;wBAMf,eAAe,QAAQ,gBAAgB"}
|
package/build/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { orient2dSign } from "@mark1russell7/predicates";
|
|
2
|
+
import { priorityQueue } from "@mark1russell7/collections";
|
|
2
3
|
import { canonicalJson as canonicalJson$1, deriveSeed, fnv1a32 as fnv1a32$1, mulberry32 as mulberry32$1, sha256Hex as sha256Hex$1 } from "@mark1russell7/rigor-generators";
|
|
3
4
|
import { STRATEGY_SPACE_SCHEMA, canonicalConfig, checkConfig, checkOptions, checkSchema, checkSpace as checkSpace$1, clampOptions, configId, declarationIssues, enumerateSpace as enumerateSpace$1, joinConfigs, listOptions, optionDefaults, optionIssue, paramActive, paramAt, paramLevels, paramProblem, paramUnit, paramValue, productSpace, spaceShapeKinds as spaceShapeKinds$1, spaceSize as spaceSize$1, splitConfig, sweepGrid, sweepOf, sweepValues } from "@mark1russell7/strategy-space";
|
|
4
5
|
import { bootstrap, bootstrapStrata, signFlipTest, signTest } from "@mark1russell7/rigor-statistics";
|
|
@@ -3692,6 +3693,182 @@ function checkPath(value) {
|
|
|
3692
3693
|
});
|
|
3693
3694
|
return out;
|
|
3694
3695
|
}
|
|
3696
|
+
// src/grid-walk.ts
|
|
3697
|
+
/**
|
|
3698
|
+
* This function makes the grid of the cells inside a polygon.
|
|
3699
|
+
*
|
|
3700
|
+
* @param ring - The outer ring of the polygon
|
|
3701
|
+
* @param cell - The side of a cell, in the unit of the polygon. It is a finite number above 0.
|
|
3702
|
+
* @param options - The holes of the polygon, and the greatest count of cells
|
|
3703
|
+
*/
|
|
3704
|
+
function polygonGrid(ring, cell, options = {}) {
|
|
3705
|
+
if (!(cell > 0) || !Number.isFinite(cell)) throw new RangeError(`The side of a cell is ${cell}. It must be a finite number above 0.`);
|
|
3706
|
+
const largest = options.largest ?? 4e6;
|
|
3707
|
+
const xs = ring.map(([x]) => x);
|
|
3708
|
+
const ys = ring.map(([, y]) => y);
|
|
3709
|
+
const origin = [Math.min(...xs), Math.min(...ys)];
|
|
3710
|
+
const width = Math.max(...xs) - origin[0];
|
|
3711
|
+
const height = Math.max(...ys) - origin[1];
|
|
3712
|
+
let side = cell;
|
|
3713
|
+
while (Math.ceil(width / side) * Math.ceil(height / side) > largest) side *= 2;
|
|
3714
|
+
const columns = Math.max(1, Math.ceil(width / side));
|
|
3715
|
+
const rows = Math.max(1, Math.ceil(height / side));
|
|
3716
|
+
const grid = {
|
|
3717
|
+
origin,
|
|
3718
|
+
cell: side,
|
|
3719
|
+
columns,
|
|
3720
|
+
rows,
|
|
3721
|
+
inside: new Uint8Array(columns * rows)
|
|
3722
|
+
};
|
|
3723
|
+
fillRing(grid, ring, 1);
|
|
3724
|
+
for (const hole of options.holes ?? []) fillRing(grid, hole, 0);
|
|
3725
|
+
return grid;
|
|
3726
|
+
}
|
|
3727
|
+
/** This function sets each cell with its center inside a ring to a value. Each row fills the cells between pairs of edge crossings. */
|
|
3728
|
+
function fillRing(grid, ring, value) {
|
|
3729
|
+
const { origin, cell, columns, rows, inside } = grid;
|
|
3730
|
+
const ys = ring.map(([, y]) => y);
|
|
3731
|
+
const firstRow = Math.max(0, Math.floor((Math.min(...ys) - origin[1]) / cell));
|
|
3732
|
+
const lastRow = Math.min(rows - 1, Math.ceil((Math.max(...ys) - origin[1]) / cell));
|
|
3733
|
+
for (let row = firstRow; row <= lastRow; row++) {
|
|
3734
|
+
const y = origin[1] + (row + .5) * cell;
|
|
3735
|
+
const crossings = [];
|
|
3736
|
+
ring.forEach(([xa, ya], index) => {
|
|
3737
|
+
const [xb, yb] = ring[(index + 1) % ring.length];
|
|
3738
|
+
if (ya > y !== yb > y) crossings.push(xa + (y - ya) * (xb - xa) / (yb - ya));
|
|
3739
|
+
});
|
|
3740
|
+
crossings.sort((a, b) => a - b);
|
|
3741
|
+
for (let k = 0; k + 1 < crossings.length; k += 2) {
|
|
3742
|
+
const first = Math.max(0, Math.ceil((crossings[k] - origin[0]) / cell - .5));
|
|
3743
|
+
const last = Math.min(columns - 1, Math.floor((crossings[k + 1] - origin[0]) / cell - .5));
|
|
3744
|
+
if (last >= first) inside.fill(value, row * columns + first, row * columns + last + 1);
|
|
3745
|
+
}
|
|
3746
|
+
}
|
|
3747
|
+
}
|
|
3748
|
+
/** This function gives the center of a cell of a grid. */
|
|
3749
|
+
function cellCenter(grid, index) {
|
|
3750
|
+
const column = index % grid.columns;
|
|
3751
|
+
const row = (index - column) / grid.columns;
|
|
3752
|
+
return [grid.origin[0] + (column + .5) * grid.cell, grid.origin[1] + (row + .5) * grid.cell];
|
|
3753
|
+
}
|
|
3754
|
+
/**
|
|
3755
|
+
* This function gives the cell inside the polygon that is nearest to a point, within `reach` cells of the cell of the point.
|
|
3756
|
+
* It gives -1 when no cell inside the polygon is so near.
|
|
3757
|
+
*
|
|
3758
|
+
* @param grid - The grid of the polygon
|
|
3759
|
+
* @param point - The point
|
|
3760
|
+
* @param reach - The greatest count of cells from the cell of the point, on each axis. The default is 4.
|
|
3761
|
+
*/
|
|
3762
|
+
function cellNear(grid, [x, y], reach = 4) {
|
|
3763
|
+
const column = Math.floor((x - grid.origin[0]) / grid.cell);
|
|
3764
|
+
const row = Math.floor((y - grid.origin[1]) / grid.cell);
|
|
3765
|
+
let best = -1;
|
|
3766
|
+
let bestDistance = Infinity;
|
|
3767
|
+
for (let dr = -reach; dr <= reach; dr++) for (let dc = -reach; dc <= reach; dc++) {
|
|
3768
|
+
const c = column + dc;
|
|
3769
|
+
const r = row + dr;
|
|
3770
|
+
if (c < 0 || r < 0 || c >= grid.columns || r >= grid.rows || grid.inside[r * grid.columns + c] === 0) continue;
|
|
3771
|
+
const [cx, cy] = cellCenter(grid, r * grid.columns + c);
|
|
3772
|
+
const distance = Math.hypot(cx - x, cy - y);
|
|
3773
|
+
if (distance < bestDistance) {
|
|
3774
|
+
best = r * grid.columns + c;
|
|
3775
|
+
bestDistance = distance;
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3778
|
+
return best;
|
|
3779
|
+
}
|
|
3780
|
+
/**
|
|
3781
|
+
* This function finds the shortest walk from one cell to each cell of a grid, in steps to the 8 next cells.
|
|
3782
|
+
* A diagonal step goes only between two cells inside the polygon, so a walk does not cut a corner of the edge.
|
|
3783
|
+
* Such a walk is at most 8.3% longer than the shortest walk in any direction.
|
|
3784
|
+
*
|
|
3785
|
+
* @param grid - The grid of the polygon
|
|
3786
|
+
* @param start - The index of the start cell
|
|
3787
|
+
* @param targets - The cells that end the search when the search reaches each of them. No value searches each cell.
|
|
3788
|
+
*/
|
|
3789
|
+
function searchGrid(grid, start, targets) {
|
|
3790
|
+
const { columns, rows, inside, cell } = grid;
|
|
3791
|
+
const distance = new Float64Array(columns * rows).fill(Infinity);
|
|
3792
|
+
const previous = new Int32Array(columns * rows).fill(-1);
|
|
3793
|
+
const done = new Uint8Array(columns * rows);
|
|
3794
|
+
let left = targets === void 0 ? -1 : new Set(targets).size;
|
|
3795
|
+
const wanted = targets === void 0 ? void 0 : new Set(targets);
|
|
3796
|
+
const diagonal = cell * Math.SQRT2;
|
|
3797
|
+
const queue = priorityQueue({ compare: (a, b) => a[0] - b[0] });
|
|
3798
|
+
distance[start] = 0;
|
|
3799
|
+
queue.offer([0, start]);
|
|
3800
|
+
for (let item = queue.pollOrUndefined(); item !== void 0; item = queue.pollOrUndefined()) {
|
|
3801
|
+
const [length, index] = item;
|
|
3802
|
+
if (done[index] === 1 || length > distance[index]) continue;
|
|
3803
|
+
done[index] = 1;
|
|
3804
|
+
if (wanted?.has(index) === true && --left === 0) break;
|
|
3805
|
+
const column = index % columns;
|
|
3806
|
+
const row = (index - column) / columns;
|
|
3807
|
+
for (let dr = -1; dr <= 1; dr++) for (let dc = -1; dc <= 1; dc++) {
|
|
3808
|
+
if (dr === 0 && dc === 0) continue;
|
|
3809
|
+
const c = column + dc;
|
|
3810
|
+
const r = row + dr;
|
|
3811
|
+
if (c < 0 || r < 0 || c >= columns || r >= rows) continue;
|
|
3812
|
+
const next = r * columns + c;
|
|
3813
|
+
if (inside[next] === 0) continue;
|
|
3814
|
+
if (dr !== 0 && dc !== 0 && (inside[row * columns + c] === 0 || inside[r * columns + column] === 0)) continue;
|
|
3815
|
+
const step = length + (dr !== 0 && dc !== 0 ? diagonal : cell);
|
|
3816
|
+
if (step < distance[next]) {
|
|
3817
|
+
distance[next] = step;
|
|
3818
|
+
previous[next] = index;
|
|
3819
|
+
queue.offer([step, next]);
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
return {
|
|
3824
|
+
distance,
|
|
3825
|
+
previous
|
|
3826
|
+
};
|
|
3827
|
+
}
|
|
3828
|
+
/** This function gives the cells of the walk from the start of a search to a cell, in their sequence. A cell with no walk gives an empty list. */
|
|
3829
|
+
function walkCells(search, end) {
|
|
3830
|
+
if (search.distance[end] === Infinity) return [];
|
|
3831
|
+
const cells = [];
|
|
3832
|
+
for (let index = end; index !== -1; index = search.previous[index]) cells.push(index);
|
|
3833
|
+
return cells.reverse();
|
|
3834
|
+
}
|
|
3835
|
+
/** This function tells if the straight line between two points stays in the cells inside the polygon. It samples the line at each half cell. */
|
|
3836
|
+
function inSight(grid, [xa, ya], [xb, yb]) {
|
|
3837
|
+
const samples = Math.max(1, Math.ceil(Math.hypot(xb - xa, yb - ya) / (grid.cell / 2)));
|
|
3838
|
+
for (let k = 0; k <= samples; k++) {
|
|
3839
|
+
const x = xa + (xb - xa) * k / samples;
|
|
3840
|
+
const y = ya + (yb - ya) * k / samples;
|
|
3841
|
+
const column = Math.floor((x - grid.origin[0]) / grid.cell);
|
|
3842
|
+
const row = Math.floor((y - grid.origin[1]) / grid.cell);
|
|
3843
|
+
if (column < 0 || row < 0 || column >= grid.columns || row >= grid.rows || grid.inside[row * grid.columns + column] === 0) return false;
|
|
3844
|
+
}
|
|
3845
|
+
return true;
|
|
3846
|
+
}
|
|
3847
|
+
/**
|
|
3848
|
+
* This function makes a walk shorter: from each corner, it goes straight to the farthest next point in sight.
|
|
3849
|
+
* The first point and the last point stay. Each straight run stays in the cells inside the polygon.
|
|
3850
|
+
*/
|
|
3851
|
+
function straightenWalk(grid, points) {
|
|
3852
|
+
if (points.length <= 2) return [...points];
|
|
3853
|
+
const result = [points[0]];
|
|
3854
|
+
let anchor = 0;
|
|
3855
|
+
while (anchor < points.length - 1) {
|
|
3856
|
+
let next = anchor + 1;
|
|
3857
|
+
for (let k = points.length - 1; k > anchor + 1; k--) if (inSight(grid, points[anchor], points[k])) {
|
|
3858
|
+
next = k;
|
|
3859
|
+
break;
|
|
3860
|
+
}
|
|
3861
|
+
result.push(points[next]);
|
|
3862
|
+
anchor = next;
|
|
3863
|
+
}
|
|
3864
|
+
return result;
|
|
3865
|
+
}
|
|
3866
|
+
/** This function gives the length of a line through a list of points. */
|
|
3867
|
+
function polylineLength(points) {
|
|
3868
|
+
let length = 0;
|
|
3869
|
+
for (let k = 1; k < points.length; k++) length += Math.hypot(points[k][0] - points[k - 1][0], points[k][1] - points[k - 1][1]);
|
|
3870
|
+
return length;
|
|
3871
|
+
}
|
|
3695
3872
|
// src/picture.ts
|
|
3696
3873
|
/** The schema of a picture. */
|
|
3697
3874
|
const PICTURE_SCHEMA = "layout-picture/1";
|
|
@@ -7306,6 +7483,6 @@ function surveyFindings(survey) {
|
|
|
7306
7483
|
units
|
|
7307
7484
|
};
|
|
7308
7485
|
}
|
|
7309
|
-
export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CELL_MEASURE_SUFFIXES, CELL_SOURCE, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, CORPUS_MANIFEST_SCHEMA, CURVE_MAX_SIDE, CURVE_SYMMETRIES, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, EPS_STEPS, FAMILY_ANY_KIND, FLATTEN_SIDES, FRAME_SCHEMA, FRAME_STATES, HARD_RULE_VERSION, HILBERT_CURVE, HILBERT_PATTERN, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, JOINT_SOURCE, LABEL_ALIGNS, MEASURE_REGISTRY, MEASURE_SURVEY_SCHEMA, MOORE_CURVE, MOORE_PATTERN, MORTON_CURVE, NODE_POSITIONS_DIMENSION, NOISE_KINDS, NO_FINITE_RANGE, NO_ROTATION3, NO_TRANSFORM3, NO_UNIT, ORIGIN3, OUTPUT_CLASS_MIN_INPUTS, OUTPUT_GRID_PROPERTIES, OUTPUT_NEAR_WHOLE, PACK_HARD_RULES, PATH_KINDS, PICTURE_SCHEMA, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, REFUSED_PROBE, SHAPE_KINDS, SHAPE_KIND_IDS, SHARE_UNIT, SIDES, SPLIT_SCHEMA, SQUARE_COMPACTNESS, STRATEGY_CATALOG_SCHEMA, STRATEGY_CATALOG_SCHEMAS, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, addPoints3, applyPack, applySymmetry, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boundsOf3, box3Center, box3Corners, box3Volume, boxArea, boxCenterDistance, boxTree, canonicalConfig, canonicalInput, canonicalJson, carryRecord, catalogChoices, catalogDefaults, catalogKey, catalogOptions, cellMeasureEntries, cellMeasureSpecs, cellMeasures, cellsOf, chainPolylines, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkPath, checkPicture, checkRegistry, checkSchema, checkShapes, checkSpace, checkSplit, checkSurvey, circleOverlaps, circlesOutside, clampOptions, clipRing, compareMeasure, composeFamily, composeRotations3, composeTransforms3, configId, convexCorners, convexOverlap, cornersInConvex, corpusHashOf, corpusManifestText, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, countResizeBreaks, createFamilyRegistry, cross3, crossingPoint, cubicAt, curveCell, curveCells, curveIndex, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, defaultNormalize, dimensionAt, dimensionSupports, dimensionUnit, distance3, documentHash, dot3, dropIndex, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fixedPointMove, flatPortId, flattenInput, fnv1a32, frameAt, frameMove, frameOf, grow, hardRuleOf, hilbertCell, hilbertIndex, inputShapeLevel, inverseRotation3, inverseSymmetry, inverseTransform3, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, length3, levelsOf, lineJson, listOptions, locateOnPolyline, manifestText, marginSides, measureEntry, minEffectOf, mooreCell, mooreIndex, mortonCell, mortonIndex, mulberry32, nameAfterStage, nearestGaps, nearestOnSegment, normalizeMeasure, normalizeRotation3, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, outputOf, overlapOf, overlapOf3, ownerDimension, packHard, packLinks, packOutputForm, paramActive, paramAt, paramLevels, paramProblem, paramUnit, paramValue, parseLayoutRecord, parsePicture, parseStrategyCatalog, pathBounds, pathEnd, pathOf, pathStart, perChange, pickMoves, pictureBounds, pictureOf, placedCircle, placedConvex, placedRect, pointAlongPolyline, pointInRing, pointInRings, pointPolylineDistance, pointRegionDistance, pointSegmentDistance, portPoint, portfolio, probeHash, procrustesOf, productSpace, randomInt, rectCenter, rectInRegion, regionArea, regionHitsRect, regionPerimeter, resizeBox, resizeProblems, resolveDimensions, ringCentroid, rotatePoint3, rotationAbout, ruleLevel, samplePath, scalePoint3, scaleRect, segmentThroughShape, segmentsCross, selectBest, sha256Hex, shapeFits, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, siblingEdges, sizeBoundsOf, sizeFits, snapRect, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, subtractPoints3, surveyFindings, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, toSvgPath, topBoxes, transformMatrix4, transformPoint3, transformedBounds3, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnResize, turnSide, unitFault, verdict, writeStrategyCatalog };
|
|
7486
|
+
export { BALANCE_MEASURE_SUFFIXES, BALANCE_SIDE_DEPTH, CELL_MEASURE_SUFFIXES, CELL_SOURCE, CIRCLE_SCATTERED, CORPUS_DIMENSIONS, CORPUS_MANIFEST_SCHEMA, CURVE_MAX_SIDE, CURVE_SYMMETRIES, DEFAULT_FAMILY_BY, DEFAULT_RNG, DEFAULT_SHAPES, DEFAULT_TOLERANCE, EDGES_STEP, EDGE_DENSITY, EDGE_KEY_STEP, EDGE_KEY_STEP_VERSION, EDGE_STEP_VERSION, EPS, EPS_STEPS, FAMILY_ANY_KIND, FLATTEN_SIDES, FRAME_SCHEMA, FRAME_STATES, HARD_RULE_VERSION, HILBERT_CURVE, HILBERT_PATTERN, INVALIDATED_FIELD, JOINT_MEASURES, JOINT_MOVED_MIN, JOINT_SOURCE, LABEL_ALIGNS, MEASURE_REGISTRY, MEASURE_SURVEY_SCHEMA, MOORE_CURVE, MOORE_PATTERN, MORTON_CURVE, NODE_POSITIONS_DIMENSION, NOISE_KINDS, NO_FINITE_RANGE, NO_ROTATION3, NO_TRANSFORM3, NO_UNIT, ORIGIN3, OUTPUT_CLASS_MIN_INPUTS, OUTPUT_GRID_PROPERTIES, OUTPUT_NEAR_WHOLE, PACK_HARD_RULES, PATH_KINDS, PICTURE_SCHEMA, RECORD_EPS, RECORD_SCALE, RECT_SCATTERED, REFUSED_PROBE, SHAPE_KINDS, SHAPE_KIND_IDS, SHARE_UNIT, SIDES, SPLIT_SCHEMA, SQUARE_COMPACTNESS, STRATEGY_CATALOG_SCHEMA, STRATEGY_CATALOG_SCHEMAS, STRATEGY_SPACE_SCHEMA, VERDICT_DRAWS, VERDICT_EXACT_CAP, VERDICT_EXACT_MAX, VERDICT_RUNS, VERDICT_SEED, addPoints3, applyPack, applySymmetry, balanceMeasureSpecs, balanceMeasures, balanceOf, boundsOf, boundsOf3, box3Center, box3Corners, box3Volume, boxArea, boxCenterDistance, boxTree, canonicalConfig, canonicalInput, canonicalJson, carryRecord, catalogChoices, catalogDefaults, catalogKey, catalogOptions, cellCenter, cellMeasureEntries, cellMeasureSpecs, cellMeasures, cellNear, cellsOf, chainPolylines, checkCatalog, checkConfig, checkDeclared, checkInput, checkLayoutRecord, checkOptions, checkPath, checkPicture, checkRegistry, checkSchema, checkShapes, checkSpace, checkSplit, checkSurvey, circleOverlaps, circlesOutside, clampOptions, clipRing, compareMeasure, composeFamily, composeRotations3, composeTransforms3, configId, convexCorners, convexOverlap, cornersInConvex, corpusHashOf, corpusManifestText, countLinksThroughShapes, countObstacleHits, countOutside, countOverlaps, countPortsOffBorder, countResizeBreaks, createFamilyRegistry, cross3, crossingPoint, cubicAt, curveCell, curveCells, curveIndex, declarationIssues, declaredClaimOf, declaredCounts, decodeOptionValue, defaultNormalize, dimensionAt, dimensionSupports, dimensionUnit, distance3, documentHash, dot3, dropIndex, edgeKeyStep, edgeStep, encodeOptionValue, enumerateSpace, exercised, familyKind, familyOf, fingerprintOf, fixedPointMove, flatPortId, flattenInput, fnv1a32, frameAt, frameMove, frameOf, grow, hardRuleOf, hilbertCell, hilbertIndex, inSight, inputShapeLevel, inverseRotation3, inverseSymmetry, inverseTransform3, isShapeKind, itemShapeOf, joinConfigs, leaveOneSeedOut, length3, levelsOf, lineJson, listOptions, locateOnPolyline, manifestText, marginSides, measureEntry, minEffectOf, mooreCell, mooreIndex, mortonCell, mortonIndex, mulberry32, nameAfterStage, nearestGaps, nearestOnSegment, normalizeMeasure, normalizeRotation3, optionDefaults, optionIssue, outputGridClass, outputGroups, outputHash, outputOf, overlapOf, overlapOf3, ownerDimension, packHard, packLinks, packOutputForm, paramActive, paramAt, paramLevels, paramProblem, paramUnit, paramValue, parseLayoutRecord, parsePicture, parseStrategyCatalog, pathBounds, pathEnd, pathOf, pathStart, perChange, pickMoves, pictureBounds, pictureOf, placedCircle, placedConvex, placedRect, pointAlongPolyline, pointInRing, pointInRings, pointPolylineDistance, pointRegionDistance, pointSegmentDistance, polygonGrid, polylineLength, portPoint, portfolio, probeHash, procrustesOf, productSpace, randomInt, rectCenter, rectInRegion, regionArea, regionHitsRect, regionPerimeter, resizeBox, resizeProblems, resolveDimensions, ringCentroid, rotatePoint3, rotationAbout, ruleLevel, samplePath, scalePoint3, scaleRect, searchGrid, segmentThroughShape, segmentsCross, selectBest, sha256Hex, shapeFits, shapeKindOf, shapeKindProblem, shapeKindsOf, shapeLevel, shapeSupportProblems, shapesOf, shapesOverlap, sharedDimension, siblingEdges, sizeBoundsOf, sizeFits, snapRect, spaceShapeKinds, spaceSize, splitConfig, splitFileName, splitFolds, stepRandom, straightenWalk, subtractPoints3, surveyFindings, sweepGrid, sweepOf, sweepValues, toLayoutRecord, toPackInput, toRect, toSizedRect, toSvgPath, topBoxes, transformMatrix4, transformPoint3, transformedBounds3, translate, turnBox, turnMargin, turnPoint, turnPort, turnRegion, turnResize, turnSide, unitFault, verdict, walkCells, writeStrategyCatalog };
|
|
7310
7487
|
|
|
7311
7488
|
//# sourceMappingURL=index.js.map
|