@pascal-app/core 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-operations/__fixtures__/cases.d.ts +3 -2
- package/dist/agent-operations/__fixtures__/cases.d.ts.map +1 -1
- package/dist/agent-operations/__fixtures__/place-items-cases.d.ts.map +1 -1
- package/dist/agent-operations/__fixtures__/place-items-cases.js +28 -0
- package/dist/agent-operations/__fixtures__/roof-bearing-cases.d.ts +2618 -2618
- package/dist/agent-operations/asset-catalog.d.ts +21 -11
- package/dist/agent-operations/asset-catalog.d.ts.map +1 -1
- package/dist/agent-operations/asset-catalog.js +28 -10
- package/dist/agent-operations/asset-views.d.ts +8 -3
- package/dist/agent-operations/asset-views.d.ts.map +1 -1
- package/dist/agent-operations/asset-views.js +19 -3
- package/dist/agent-operations/batch.d.ts +4 -2
- package/dist/agent-operations/batch.d.ts.map +1 -1
- package/dist/agent-operations/batch.js +9 -6
- package/dist/agent-operations/catalog-asset.d.ts +15 -0
- package/dist/agent-operations/catalog-asset.d.ts.map +1 -0
- package/dist/agent-operations/catalog-asset.js +4 -0
- package/dist/agent-operations/circulation-spaces.d.ts +585 -585
- package/dist/agent-operations/design-brief.d.ts.map +1 -1
- package/dist/agent-operations/design-brief.js +2 -0
- package/dist/agent-operations/furnish-room.d.ts.map +1 -1
- package/dist/agent-operations/furnish-room.js +2 -1
- package/dist/agent-operations/index.d.ts +5716 -7
- package/dist/agent-operations/index.d.ts.map +1 -1
- package/dist/agent-operations/index.js +17 -3
- package/dist/agent-operations/level-reads.d.ts.map +1 -1
- package/dist/agent-operations/level-reads.js +4 -1
- package/dist/agent-operations/place-in-room.d.ts.map +1 -1
- package/dist/agent-operations/place-in-room.js +2 -1
- package/dist/agent-operations/place-items.d.ts.map +1 -1
- package/dist/agent-operations/place-items.js +2 -1
- package/dist/agent-operations/scene-queries.d.ts +3818 -3818
- package/dist/agent-operations/scene-view.d.ts.map +1 -1
- package/dist/agent-operations/scene-view.js +38 -13
- package/dist/agent-operations/search-assets.d.ts.map +1 -1
- package/dist/agent-operations/search-assets.js +6 -0
- package/dist/agent-operations/types.d.ts +10 -2
- package/dist/agent-operations/types.d.ts.map +1 -1
- package/dist/agent-operations/usage-checks.js +18 -3
- package/dist/agent-operations/verify-scene.d.ts +7 -3
- package/dist/agent-operations/verify-scene.d.ts.map +1 -1
- package/dist/agent-operations/verify-scene.js +15 -7
- package/dist/agent-tools/assets.js +1 -1
- package/dist/building/__fixtures__/wall-opening-cases.d.ts +30 -30
- package/dist/building/level-duplication.d.ts +3409 -3409
- package/dist/building/level-duplication.d.ts.map +1 -1
- package/dist/building/level-duplication.js +3 -1
- package/dist/building/wall-openings.d.ts +75 -75
- package/dist/commands/structure/shared.d.ts +3407 -3407
- package/dist/commands/structure/zone-wall-merge.d.ts +652 -652
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +3818 -3818
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/lib/__fixtures__/mezzanine.d.ts +2003 -2003
- package/dist/lib/absorb-wall-separators.d.ts +1032 -1032
- package/dist/lib/asset-storage.d.ts.map +1 -1
- package/dist/lib/asset-storage.js +3 -0
- package/dist/lib/floor-foundation-datum.d.ts.map +1 -1
- package/dist/lib/floor-foundation-datum.js +5 -1
- package/dist/lib/floorplan/context.d.ts +95 -0
- package/dist/lib/floorplan/context.d.ts.map +1 -0
- package/dist/lib/floorplan/context.js +155 -0
- package/dist/lib/floorplan/index.d.ts +6 -0
- package/dist/lib/floorplan/index.d.ts.map +1 -0
- package/dist/lib/floorplan/index.js +5 -0
- package/dist/lib/floorplan/marks.d.ts +71 -0
- package/dist/lib/floorplan/marks.d.ts.map +1 -0
- package/dist/lib/floorplan/marks.js +157 -0
- package/dist/lib/floorplan/plan-math.d.ts +18 -0
- package/dist/lib/floorplan/plan-math.d.ts.map +1 -0
- package/dist/lib/floorplan/plan-math.js +82 -0
- package/dist/lib/floorplan/svg-paths.d.ts +17 -0
- package/dist/lib/floorplan/svg-paths.d.ts.map +1 -0
- package/dist/lib/floorplan/svg-paths.js +92 -0
- package/dist/lib/floorplan/wall-affordances.d.ts +31 -0
- package/dist/lib/floorplan/wall-affordances.d.ts.map +1 -0
- package/dist/lib/floorplan/wall-affordances.js +24 -0
- package/dist/lib/steps.d.ts +8 -0
- package/dist/lib/steps.d.ts.map +1 -0
- package/dist/lib/steps.js +7 -0
- package/dist/registry/__fixtures__/roof-planes.d.ts +69 -0
- package/dist/registry/__fixtures__/roof-planes.d.ts.map +1 -0
- package/dist/registry/__fixtures__/roof-planes.js +59 -0
- package/dist/registry/index.d.ts +2 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -0
- package/dist/registry/roofs.d.ts +34 -0
- package/dist/registry/roofs.d.ts.map +1 -0
- package/dist/registry/roofs.js +61 -0
- package/dist/registry/types.d.ts +30 -0
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/registry/validate-relations.d.ts +5 -1
- package/dist/registry/validate-relations.d.ts.map +1 -1
- package/dist/registry/validate-relations.js +6 -2
- package/dist/schema/asset-url.d.ts +8 -0
- package/dist/schema/asset-url.d.ts.map +1 -1
- package/dist/schema/asset-url.js +17 -0
- package/dist/schema/nodes/roof.d.ts +1 -1
- package/dist/schema/nodes/roof.d.ts.map +1 -1
- package/dist/schema/nodes/roof.js +13 -8
- package/dist/schema/types.d.ts +1 -1
- package/dist/services/roof-level.d.ts.map +1 -1
- package/dist/services/roof-level.js +12 -2
- package/dist/services/roof-move.d.ts +4 -2
- package/dist/services/roof-move.d.ts.map +1 -1
- package/dist/services/roof-move.js +21 -9
- package/dist/spatial/usage-field/findings.d.ts +10 -1
- package/dist/spatial/usage-field/findings.d.ts.map +1 -1
- package/dist/spatial/usage-field/findings.js +56 -12
- package/dist/spatial/usage-field/measure.d.ts +3 -1
- package/dist/spatial/usage-field/measure.d.ts.map +1 -1
- package/dist/spatial/usage-field/measure.js +7 -2
- package/dist/spatial/usage-field/path.d.ts.map +1 -1
- package/dist/spatial/usage-field/path.js +28 -18
- package/dist/store/actions/node-actions.d.ts +2380 -2380
- package/dist/store/scene-annotations.d.ts +1279 -1279
- package/dist/systems/document-reconcile.d.ts.map +1 -1
- package/dist/systems/document-reconcile.js +1 -2
- package/dist/systems/roof/roof-elevation.d.ts +11 -6
- package/dist/systems/roof/roof-elevation.d.ts.map +1 -1
- package/dist/systems/roof/roof-elevation.js +24 -11
- package/dist/systems/slab/__fixtures__/floor-step.d.ts +2381 -2381
- package/dist/systems/slab/__fixtures__/raised-room.d.ts +3818 -3818
- package/dist/systems/stair/stair-opening-preview.d.ts +900 -900
- package/dist/utils/ensure-scene-openings.d.ts +4815 -4815
- package/dist/utils/floor-plate-migration.d.ts +1032 -1032
- package/dist/utils/owned-floor-opening-migration.d.ts +1032 -1032
- package/dist/utils/reconcile-structure-on-load.d.ts +2380 -2380
- package/dist/utils/scene-bounds.d.ts +32 -0
- package/dist/utils/scene-bounds.d.ts.map +1 -0
- package/dist/utils/scene-bounds.js +201 -0
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { USAGE_INDICATORS, } from '../../building/code-profile.js';
|
|
2
|
+
import { inOneGo } from '../../lib/steps.js';
|
|
2
3
|
import { bedIssues } from './beds.js';
|
|
3
4
|
import { blockedOpeningIssues } from './blocked.js';
|
|
4
5
|
import { clashIssues } from './clash.js';
|
|
@@ -6,7 +7,7 @@ import { doorOverStairIssues } from './door-stairs.js';
|
|
|
6
7
|
import { entryIssues } from './entry-way.js';
|
|
7
8
|
import { fixtureClearanceIssues } from './fixtures.js';
|
|
8
9
|
import { m, nameOf, quote, unique } from './labels.js';
|
|
9
|
-
import {
|
|
10
|
+
import { measureUsageSteps, } from './measure.js';
|
|
10
11
|
import { usageShapes } from './shapes.js';
|
|
11
12
|
import { doorSwingIssues } from './swings.js';
|
|
12
13
|
/** Clear width of a path in a house: 0,90 m, the arrêté du 24 décembre 2015 art. 11 II (36 in is the IRC hall). */
|
|
@@ -202,16 +203,9 @@ function pocketIssue(nodes, room, from) {
|
|
|
202
203
|
approximate,
|
|
203
204
|
};
|
|
204
205
|
}
|
|
205
|
-
/**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
* objects that stand out into circulation, pieces inside something solid, what stands in front of a
|
|
209
|
-
* window or a door, a bed's room, a room's headroom and its ceiling. Every threshold is an indicator,
|
|
210
|
-
* not a compliance check.
|
|
211
|
-
*/
|
|
212
|
-
export function usageIssues(nodes, options = {}) {
|
|
213
|
-
const shapes = usageShapes(nodes);
|
|
214
|
-
const measure = measureUsage(nodes, shapes, options);
|
|
206
|
+
/** The passages, turning circles and pockets of every group of rooms, measured on one clearance field. */
|
|
207
|
+
function* circulationIssues(nodes, shapes, options) {
|
|
208
|
+
const measure = yield* measureUsageSteps(nodes, shapes, options);
|
|
215
209
|
const issues = [];
|
|
216
210
|
for (const group of measure.groups) {
|
|
217
211
|
const from = group.source.kind === 'door' ? 'the entrance' : 'the stair arrival';
|
|
@@ -247,6 +241,56 @@ export function usageIssues(nodes, options = {}) {
|
|
|
247
241
|
}
|
|
248
242
|
}
|
|
249
243
|
}
|
|
250
|
-
issues
|
|
244
|
+
return issues;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Each measurement with the finding types it gives, in the order their findings are listed. On a
|
|
248
|
+
* building of a few hundred rooms the circulation measurement takes seconds and the others a
|
|
249
|
+
* fraction of one, so a question about some types takes the measurements that give them alone,
|
|
250
|
+
* and the circulation measurement is taken in steps.
|
|
251
|
+
*/
|
|
252
|
+
const MEASUREMENTS = [
|
|
253
|
+
{
|
|
254
|
+
types: ['usage_pocket', 'usage_passage_narrow', 'usage_turning_narrow'],
|
|
255
|
+
run: circulationIssues,
|
|
256
|
+
},
|
|
257
|
+
{ types: ['usage_clash'], run: clashIssues },
|
|
258
|
+
{
|
|
259
|
+
types: ['usage_opening_blocked'],
|
|
260
|
+
run: (nodes, shapes) => blockedOpeningIssues(nodes, shapes),
|
|
261
|
+
},
|
|
262
|
+
{ types: ['usage_door_swing'], run: doorSwingIssues },
|
|
263
|
+
{ types: ['usage_entry_narrow'], run: entryIssues },
|
|
264
|
+
{ types: ['usage_door_over_stair'], run: doorOverStairIssues },
|
|
265
|
+
{ types: ['usage_fixture_clearance'], run: fixtureClearanceIssues },
|
|
266
|
+
{ types: ['usage_bed_clearance'], run: bedIssues },
|
|
267
|
+
];
|
|
268
|
+
/** Every finding type a measurement gives. */
|
|
269
|
+
export const USAGE_TYPES = new Set(MEASUREMENTS.flatMap((measurement) => measurement.types));
|
|
270
|
+
/**
|
|
271
|
+
* The usage findings of a scene: narrow passages (measured from the chosen entrance, one for each
|
|
272
|
+
* place that is narrow with the rooms it leads to, and the best other door as a fact), missing turning circles, floor a 0.60 m unit cannot get out of, wall
|
|
273
|
+
* objects that stand out into circulation, pieces inside something solid, what stands in front of a
|
|
274
|
+
* window or a door, a bed's room, a room's headroom and its ceiling. Every threshold is an indicator,
|
|
275
|
+
* not a compliance check.
|
|
276
|
+
*/
|
|
277
|
+
export function usageIssues(nodes, options = {}) {
|
|
278
|
+
return inOneGo(usageIssueSteps(nodes, options));
|
|
279
|
+
}
|
|
280
|
+
/** `usageIssues`, a step for each measurement and for each floor of the circulation one. */
|
|
281
|
+
export function* usageIssueSteps(nodes, options = {}) {
|
|
282
|
+
const { types, ...measure } = options;
|
|
283
|
+
const asked = types
|
|
284
|
+
? MEASUREMENTS.filter((measurement) => measurement.types.some((type) => types.has(type)))
|
|
285
|
+
: MEASUREMENTS;
|
|
286
|
+
if (asked.length === 0)
|
|
287
|
+
return [];
|
|
288
|
+
const shapes = usageShapes(nodes);
|
|
289
|
+
const issues = [];
|
|
290
|
+
for (const measurement of asked) {
|
|
291
|
+
const found = measurement.run(nodes, shapes, measure);
|
|
292
|
+
issues.push(...(Array.isArray(found) ? found : yield* found));
|
|
293
|
+
yield;
|
|
294
|
+
}
|
|
251
295
|
return issues;
|
|
252
296
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type Steps } from '../../lib/steps.js';
|
|
1
2
|
import { type Grid } from './field.js';
|
|
2
3
|
import { type FloorGroup } from './level-field.js';
|
|
3
4
|
import type { Prism, Ring, UsageShapes } from './types.js';
|
|
@@ -318,7 +319,8 @@ export declare function prepareGroup(nodes: Nodes, shapes: UsageShapes, group: F
|
|
|
318
319
|
* shapes `usageShapes` read. The floor is a cell grid of the clearance to the nearest obstacle in a
|
|
319
320
|
* band a body stands in; a passage is the widest path from the entrance to the room, its pinch
|
|
320
321
|
* re-solved on a finer grid to the millimetre; a pocket is floor where a 0.60 m unit fits but
|
|
321
|
-
* cannot get out.
|
|
322
|
+
* cannot get out. One floor a step: a building of many floors takes seconds.
|
|
322
323
|
*/
|
|
324
|
+
export declare function measureUsageSteps(nodes: Nodes, shapes: UsageShapes, options?: MeasureOptions): Steps<UsageMeasure>;
|
|
323
325
|
export declare function measureUsage(nodes: Nodes, shapes: UsageShapes, options?: MeasureOptions): UsageMeasure;
|
|
324
326
|
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/spatial/usage-field/measure.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../../../src/spatial/usage-field/measure.ts"],"names":[],"mappings":"AAQA,OAAO,EAAW,KAAK,KAAK,EAAE,MAAM,iBAAiB,CAAA;AAGrD,OAAO,EAAgB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AACjD,OAAO,EAIL,KAAK,UAAU,EAIhB,MAAM,eAAe,CAAA;AAWtB,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AACvD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,sIAAsI;AACtI,eAAO,MAAM,g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CAChC,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,cAAmB,GAC3B,KAAK,CAAC,YAAY,CAAC,CAgOrB;AAED,wBAAgB,YAAY,CAC1B,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,WAAW,EACnB,OAAO,GAAE,cAAmB,GAC3B,YAAY,CAEd"}
|
|
@@ -3,6 +3,7 @@ import { floorsOf } from '../../agent-operations/circulation-spaces.js';
|
|
|
3
3
|
import { isFloorUnderlay } from '../../agent-operations/furniture-kind.js';
|
|
4
4
|
import { area, difference, union } from '../../lib/polygon-boolean.js';
|
|
5
5
|
import { polygonInteriorPoint } from '../../lib/polygon-label.js';
|
|
6
|
+
import { inOneGo } from '../../lib/steps.js';
|
|
6
7
|
import { resolveStairWalkingSurfaces } from '../../systems/stair/stair-clearance.js';
|
|
7
8
|
import { cellX, cellZ } from './field.js';
|
|
8
9
|
import { BODY_BAND, buildField, FEET_BAND, floorGroups, inRegion, maskOf, } from './level-field.js';
|
|
@@ -248,9 +249,9 @@ export function prepareGroup(nodes, shapes, group, cell, underlay) {
|
|
|
248
249
|
* shapes `usageShapes` read. The floor is a cell grid of the clearance to the nearest obstacle in a
|
|
249
250
|
* band a body stands in; a passage is the widest path from the entrance to the room, its pinch
|
|
250
251
|
* re-solved on a finer grid to the millimetre; a pocket is floor where a 0.60 m unit fits but
|
|
251
|
-
* cannot get out.
|
|
252
|
+
* cannot get out. One floor a step: a building of many floors takes seconds.
|
|
252
253
|
*/
|
|
253
|
-
export function
|
|
254
|
+
export function* measureUsageSteps(nodes, shapes, options = {}) {
|
|
254
255
|
const cell = options.cell ?? 0.02;
|
|
255
256
|
const floors = floorsOf(nodes).floors;
|
|
256
257
|
const exterior = exteriorDoors(nodes);
|
|
@@ -453,6 +454,10 @@ export function measureUsage(nodes, shapes, options = {}) {
|
|
|
453
454
|
};
|
|
454
455
|
});
|
|
455
456
|
groups.push({ levelId: group.levelId, y: group.y, source, rooms });
|
|
457
|
+
yield;
|
|
456
458
|
}
|
|
457
459
|
return { groups, entranceDoorId: entrance };
|
|
458
460
|
}
|
|
461
|
+
export function measureUsage(nodes, shapes, options = {}) {
|
|
462
|
+
return inOneGo(measureUsageSteps(nodes, shapes, options));
|
|
463
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/spatial/usage-field/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAwB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../src/spatial/usage-field/path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAwB,KAAK,IAAI,EAAE,MAAM,SAAS,CAAA;AAqE3E;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,YAAY,EACf,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GACxB;IAAE,CAAC,EAAE,YAAY,CAAC;IAAC,CAAC,EAAE,UAAU,CAAA;CAAE,CAiCpC;AAED,qGAAqG;AACrG,wBAAgB,MAAM,CACpB,CAAC,EAAE,UAAU,EACb,CAAC,EAAE,YAAY,EACf,CAAC,EAAE,MAAM,GACR;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAOxC;AA8BD,qHAAqH;AACrH,wBAAgB,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,YAAY,CAmCzF;AA8FD,MAAM,MAAM,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CAAA;AAE1E;;;;;;GAMG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,IAAI,EACP,CAAC,EAAE,YAAY,EACf,KAAK,EAAE,WAAW,EAClB,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC5C,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACnC,QAAQ,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,OAAO,EAC3C,EACE,CAAO,EACP,IAAY,EACZ,OAAa,EACb,KAAK,EACL,OAAY,GACb,GAAE;IAAE,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,WAAW,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAO,GAC7F;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAyC1D;AAaD;;;GAGG;AACH,wBAAgB,aAAa,CAC3B,CAAC,EAAE,IAAI,EACP,IAAI,EAAE,UAAU,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,MAAM,EAAE,GAAG,IAAI,CAkCjB"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { cellOf, cellX, cellZ } from './field.js';
|
|
2
|
-
/** A binary min-heap on a numeric key. */
|
|
2
|
+
/** A binary min-heap on a numeric key. `pop` returns the value and leaves its key in `key`. */
|
|
3
3
|
class Heap {
|
|
4
4
|
keys = [];
|
|
5
5
|
values = [];
|
|
6
|
+
key = 0;
|
|
6
7
|
get size() {
|
|
7
8
|
return this.keys.length;
|
|
8
9
|
}
|
|
@@ -14,37 +15,45 @@ class Heap {
|
|
|
14
15
|
values.push(value);
|
|
15
16
|
while (i > 0) {
|
|
16
17
|
const parent = (i - 1) >> 1;
|
|
17
|
-
|
|
18
|
+
const above = keys[parent];
|
|
19
|
+
if (key >= above)
|
|
18
20
|
break;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
keys[i] = above;
|
|
22
|
+
values[i] = values[parent];
|
|
21
23
|
i = parent;
|
|
22
24
|
}
|
|
25
|
+
keys[i] = key;
|
|
26
|
+
values[i] = value;
|
|
23
27
|
}
|
|
24
28
|
pop() {
|
|
25
29
|
const keys = this.keys;
|
|
26
30
|
const values = this.values;
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
this.key = keys[0];
|
|
32
|
+
const top = values[0];
|
|
33
|
+
const key = keys.pop();
|
|
34
|
+
const value = values.pop();
|
|
35
|
+
const size = keys.length;
|
|
36
|
+
if (size) {
|
|
33
37
|
let i = 0;
|
|
34
38
|
for (;;) {
|
|
35
39
|
const l = 2 * i + 1;
|
|
36
40
|
const r = l + 1;
|
|
37
41
|
let m = i;
|
|
38
|
-
|
|
42
|
+
let least = key;
|
|
43
|
+
if (l < size && keys[l] < least) {
|
|
39
44
|
m = l;
|
|
40
|
-
|
|
45
|
+
least = keys[l];
|
|
46
|
+
}
|
|
47
|
+
if (r < size && keys[r] < least)
|
|
41
48
|
m = r;
|
|
42
49
|
if (m === i)
|
|
43
50
|
break;
|
|
44
|
-
|
|
45
|
-
|
|
51
|
+
keys[i] = keys[m];
|
|
52
|
+
values[i] = values[m];
|
|
46
53
|
i = m;
|
|
47
54
|
}
|
|
55
|
+
keys[i] = key;
|
|
56
|
+
values[i] = value;
|
|
48
57
|
}
|
|
49
58
|
return top;
|
|
50
59
|
}
|
|
@@ -72,11 +81,11 @@ export function widestPath(g, F, inside, sources) {
|
|
|
72
81
|
heap.push(-F[s], s);
|
|
73
82
|
}
|
|
74
83
|
while (heap.size) {
|
|
75
|
-
const
|
|
84
|
+
const c = heap.pop();
|
|
76
85
|
if (done[c])
|
|
77
86
|
continue;
|
|
78
87
|
done[c] = 1;
|
|
79
|
-
const b = -
|
|
88
|
+
const b = -heap.key;
|
|
80
89
|
const i = c % g.W;
|
|
81
90
|
const j = (c / g.W) | 0;
|
|
82
91
|
for (const [di, dj] of FOUR) {
|
|
@@ -150,7 +159,8 @@ export function travel(g, pass, sources) {
|
|
|
150
159
|
heap.push(0, s);
|
|
151
160
|
}
|
|
152
161
|
while (heap.size) {
|
|
153
|
-
const
|
|
162
|
+
const c = heap.pop();
|
|
163
|
+
const d = heap.key;
|
|
154
164
|
if (d > D[c])
|
|
155
165
|
continue;
|
|
156
166
|
const i = c % g.W;
|
|
@@ -322,7 +332,7 @@ export function shortestRoute(g, pass, from, to) {
|
|
|
322
332
|
cost[from] = 0;
|
|
323
333
|
heap.push(heuristic(from), from);
|
|
324
334
|
while (heap.size) {
|
|
325
|
-
const
|
|
335
|
+
const c = heap.pop();
|
|
326
336
|
if (c === to)
|
|
327
337
|
break;
|
|
328
338
|
const i = c % g.W;
|