@mark1russell7/highways 0.3.0 → 0.4.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/README.md +26 -2
- package/build/index.d.ts +698 -12
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2353 -55
- package/build/index.js.map +1 -1
- package/package.json +3 -1
- package/src/bench/compare.ts +41 -6
- package/src/bench/screen/forms.ts +372 -0
- package/src/bench/screen/generators.ts +54 -0
- package/src/bench/screen/hash.ts +129 -0
- package/src/bench/screen/index.ts +6 -0
- package/src/bench/screen/measures.ts +114 -0
- package/src/bench/screen/screen.ts +390 -0
- package/src/bench/screen/set.ts +136 -0
- package/src/bench/suite.ts +71 -13
- package/src/highways/corridors/index.ts +305 -0
- package/src/highways/follow.ts +155 -0
- package/src/highways/index.ts +7 -0
- package/src/highways/keys/index.ts +15 -0
- package/src/highways/model.ts +111 -0
- package/src/highways/result.ts +34 -0
- package/src/highways/router.ts +40 -0
- package/src/highways/shared-ways/index.ts +15 -0
- package/src/index.ts +2 -0
- package/src/strategies/builtins.ts +82 -6
- package/src/strategies/model.ts +36 -6
- package/src/strategies/schemas.ts +13 -0
package/README.md
CHANGED
|
@@ -323,7 +323,8 @@ The steps of the pipeline that vary have strategies. Each step has one interface
|
|
|
323
323
|
|---|---|---|---|
|
|
324
324
|
| `group` | `Graph` | `Section`: the tree of groups of the router `sections` | `quadtree`, `keys`, `kd`, `cut` |
|
|
325
325
|
| `router` | `Graph` | `Result` | `straight`, `plugs`, `corners`, `corners-smooth`, `trunks`, `shared`, `shared-all`, `sections`, `sections-tree` |
|
|
326
|
-
| `
|
|
326
|
+
| `highway` | `HighwayInput`: the graph, and optionally the first routes of a router | `HighwayPlan`: the highways as data | `keys`, `shared-ways`, `corridors` |
|
|
327
|
+
| `curve` | `CurveInput`: the points, the normals of the plugs, the free space and the lane on its board | `CurveSegment[]` | `straight`, `rounded`, `spline`, `arc`, `smooth`, `clothoid`, `highway` |
|
|
327
328
|
| `room` | `RoomInput`: the boxes and the links of a board, and the tree of sections for `levels` | `Gap[]` | `routes`, `lines`, `levels` |
|
|
328
329
|
|
|
329
330
|
A strategy has a `step`, a `name`, a `describe` text, its `defaults` and the method `run(input, options?)`. The type of the options comes from `defaults`. Each option that a call does not give gets its default value.
|
|
@@ -333,7 +334,27 @@ A strategy has a `step`, a `name`, a `describe` text, its `defaults` and the met
|
|
|
333
334
|
- `register(registry, ...strategies)` gives a new registry. It does not change the registry before it.
|
|
334
335
|
- `listStrategies(registry, step)` gives the strategies of a step, in order. `findStrategy` and `getStrategy` give one strategy by its name.
|
|
335
336
|
- `asRouter(strategy, options?)` gives a `Router`, and `routersOf(registry)` gives the routers of a registry.
|
|
336
|
-
- `STRATEGIES` is the registry of `BUILT_IN_STRATEGIES`. The records `groupStrategies`, `routerStrategies`, `curveStrategies` and `roomStrategies` give each built-in strategy with its typed options.
|
|
337
|
+
- `STRATEGIES` is the registry of `BUILT_IN_STRATEGIES`. The records `groupStrategies`, `routerStrategies`, `highwayStrategies`, `curveStrategies` and `roomStrategies` give each built-in strategy with its typed options.
|
|
338
|
+
|
|
339
|
+
### The step `highway`
|
|
340
|
+
|
|
341
|
+
The step `highway` decides which edges share a way. It gives a plan, not routes. `follow` routes the plan.
|
|
342
|
+
|
|
343
|
+
- A `Highway` has an `id`, a `key`, a `spine`, its `lanes` and its `members`. Lane 0 is on the left of the spine.
|
|
344
|
+
- A `HighwayMember` is an edge with its merge point and its split point. `on` and `off` give their places on the spine.
|
|
345
|
+
- `checkPlan(graph, plan)` lists the problems of a plan. A good plan gives an empty list.
|
|
346
|
+
- `follow(graph, plan, options?)` routes each member from its plug to its merge point, along the spine, and from its split point to its target.
|
|
347
|
+
- `follow` routes an edge that is not a member with its first route, or with the way finder. It gives one run for each stretch that two members or more share.
|
|
348
|
+
- `highwayRouter(strategy)` and `highwayRouterStrategy(strategy)` give a router that makes the plan and then calls `follow`.
|
|
349
|
+
|
|
350
|
+
| Strategy | Decision |
|
|
351
|
+
|---|---|
|
|
352
|
+
| `keys` | The trunks and the runs of the router `trunks`. `planOfResult` reads them. The router does not change. |
|
|
353
|
+
| `shared-ways` | The runs of the router `shared`. `planOfResult` reads them. The router does not change. |
|
|
354
|
+
| `corridors` | The corridor signatures of HWY-031. The links of the first routes get a MinHash signature, and each cluster of ways gives a highway. |
|
|
355
|
+
|
|
356
|
+
The strategy `corridors` joins two ways when they share a long length. The length is `BREAK_EVEN` times the lane width or more, and the share `rho` of the shorter way or more.
|
|
357
|
+
The routers `trunks` and `shared` keep their own code. A test pins their output, so the strategies `keys` and `shared-ways` read the same decision.
|
|
337
358
|
|
|
338
359
|
A registry is data. No import changes it. The benchmark and the site take their lists from `STRATEGIES`, so a new built-in strategy gets its rows and its button with no other edit. A consumer makes its own registry:
|
|
339
360
|
|
|
@@ -448,10 +469,13 @@ The workflow `Bench` runs the suite in parts. Each part writes its report, and `
|
|
|
448
469
|
|
|
449
470
|
`compareStep` runs each strategy of one step on one board, with the measures of the suite. It gives one row for each strategy and the Pareto front of the step. The options give each strategy its own options. The compare page of the site uses it.
|
|
450
471
|
|
|
472
|
+
With the option `lanes`, the step `curve` opens each shared way of the routes of `curveRouter` into lanes, and each curve draws the lanes. Each input then has its `lane`, so the curve `highway` bends the lanes of a bundle as one with each of its options.
|
|
473
|
+
|
|
451
474
|
```ts
|
|
452
475
|
import { compareStep } from "@mark1russell7/highways";
|
|
453
476
|
|
|
454
477
|
const { rows, front } = compareStep("curve", graph, { options: { arc: { radius: 20 } } });
|
|
478
|
+
const lanes = compareStep("curve", graph, { curveRouter: "shared", lanes: { width: 5, maxWidth: 30 }, options: { highway: { jog: "quintic" } } });
|
|
455
479
|
```
|
|
456
480
|
|
|
457
481
|
## License
|