@pascal-app/core 0.9.2 → 1.0.0-beta.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/README.md +17 -10
- package/dist/events/bus.d.ts +21 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts +17 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.js +61 -8
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts +116 -66
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +319 -441
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts +46 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-sync.js +204 -12
- package/dist/hooks/spatial-grid/support-host-id.d.ts +3 -0
- package/dist/hooks/spatial-grid/support-host-id.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/support-host-id.js +2 -0
- package/dist/hooks/spatial-grid/support-host-patch.d.ts +51 -0
- package/dist/hooks/spatial-grid/support-host-patch.d.ts.map +1 -0
- package/dist/hooks/spatial-grid/support-host-patch.js +164 -0
- package/dist/index.d.ts +23 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -10
- package/dist/lib/measurement-geometry.d.ts +4 -0
- package/dist/lib/measurement-geometry.d.ts.map +1 -1
- package/dist/lib/measurement-geometry.js +27 -10
- package/dist/lib/slab-polygon.d.ts.map +1 -1
- package/dist/lib/slab-polygon.js +33 -1
- package/dist/lib/space-detection.d.ts +15 -4
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +232 -91
- package/dist/lib/terrain-brush.d.ts +163 -0
- package/dist/lib/terrain-brush.d.ts.map +1 -0
- package/dist/lib/terrain-brush.js +359 -0
- package/dist/lib/terrain-codec.d.ts +51 -0
- package/dist/lib/terrain-codec.d.ts.map +1 -0
- package/dist/lib/terrain-codec.js +167 -0
- package/dist/lib/terrain-field.d.ts +150 -0
- package/dist/lib/terrain-field.d.ts.map +1 -0
- package/dist/lib/terrain-field.js +248 -0
- package/dist/lib/terrain-raycast.d.ts +44 -0
- package/dist/lib/terrain-raycast.d.ts.map +1 -0
- package/dist/lib/terrain-raycast.js +188 -0
- package/dist/lib/terrain-source.d.ts +60 -0
- package/dist/lib/terrain-source.d.ts.map +1 -0
- package/dist/lib/terrain-source.js +90 -0
- package/dist/lib/terrain-support.d.ts +85 -0
- package/dist/lib/terrain-support.d.ts.map +1 -0
- package/dist/lib/terrain-support.js +218 -0
- package/dist/lib/zone-quantities.d.ts +1 -1
- package/dist/lib/zone-quantities.d.ts.map +1 -1
- package/dist/lib/zone-quantities.js +311 -66
- package/dist/material-library.d.ts +9 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +56 -4
- package/dist/registry/handles.d.ts +16 -1
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +1 -1
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +5 -2
- package/dist/registry/types.d.ts +83 -1
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/schema/index.d.ts +6 -3
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +6 -3
- package/dist/schema/nodes/cabinet.d.ts +2 -0
- package/dist/schema/nodes/cabinet.d.ts.map +1 -1
- package/dist/schema/nodes/cabinet.js +4 -2
- package/dist/schema/nodes/ceiling.d.ts +1 -1
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +7 -1
- package/dist/schema/nodes/column.d.ts +1 -0
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +2 -0
- package/dist/schema/nodes/construction-dimension.d.ts +195 -0
- package/dist/schema/nodes/construction-dimension.d.ts.map +1 -0
- package/dist/schema/nodes/construction-dimension.js +151 -0
- package/dist/schema/nodes/door.d.ts +29 -0
- package/dist/schema/nodes/door.d.ts.map +1 -1
- package/dist/schema/nodes/door.js +20 -0
- package/dist/schema/nodes/duct-terminal.d.ts +1 -0
- package/dist/schema/nodes/duct-terminal.d.ts.map +1 -1
- package/dist/schema/nodes/duct-terminal.js +2 -0
- package/dist/schema/nodes/fence.d.ts +2 -0
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +8 -0
- package/dist/schema/nodes/hvac-equipment.d.ts +1 -0
- package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -1
- package/dist/schema/nodes/hvac-equipment.js +2 -0
- package/dist/schema/nodes/item.d.ts +1 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +13 -0
- package/dist/schema/nodes/level.d.ts +2 -1
- package/dist/schema/nodes/level.d.ts.map +1 -1
- package/dist/schema/nodes/level.js +12 -33
- package/dist/schema/nodes/shelf.d.ts +1 -0
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/shelf.js +2 -0
- package/dist/schema/nodes/site.d.ts +9 -0
- package/dist/schema/nodes/site.d.ts.map +1 -1
- package/dist/schema/nodes/site.js +8 -6
- package/dist/schema/nodes/slab.d.ts +5 -0
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +14 -2
- package/dist/schema/nodes/spawn.d.ts +1 -0
- package/dist/schema/nodes/spawn.d.ts.map +1 -1
- package/dist/schema/nodes/spawn.js +2 -0
- package/dist/schema/nodes/stair.d.ts +3 -1
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +8 -1
- package/dist/schema/nodes/structural-grid.d.ts +27 -0
- package/dist/schema/nodes/structural-grid.d.ts.map +1 -0
- package/dist/schema/nodes/structural-grid.js +17 -0
- package/dist/schema/nodes/wall.d.ts +5 -2
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +13 -4
- package/dist/schema/nodes/window.d.ts +29 -0
- package/dist/schema/nodes/window.d.ts.map +1 -1
- package/dist/schema/nodes/window.js +18 -0
- package/dist/schema/nodes/zone.d.ts +20 -0
- package/dist/schema/nodes/zone.d.ts.map +1 -1
- package/dist/schema/nodes/zone.js +15 -0
- package/dist/schema/terrain.d.ts +28 -0
- package/dist/schema/terrain.d.ts.map +1 -0
- package/dist/schema/terrain.js +30 -0
- package/dist/schema/types.d.ts +211 -3
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +4 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts +80 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.d.ts.map +1 -0
- package/dist/services/__fixtures__/wall-plane-top-boundary-repro.js +89 -0
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +2 -1
- package/dist/services/level-height.d.ts +8 -9
- package/dist/services/level-height.d.ts.map +1 -1
- package/dist/services/level-height.js +48 -16
- package/dist/services/storey.d.ts +103 -0
- package/dist/services/storey.d.ts.map +1 -0
- package/dist/services/storey.js +296 -0
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +47 -3
- package/dist/store/history-control.d.ts +20 -0
- package/dist/store/history-control.d.ts.map +1 -1
- package/dist/store/history-control.js +110 -13
- package/dist/store/use-live-terrain.d.ts +65 -0
- package/dist/store/use-live-terrain.d.ts.map +1 -0
- package/dist/store/use-live-terrain.js +31 -0
- package/dist/store/use-live-transforms.d.ts +8 -0
- package/dist/store/use-live-transforms.d.ts.map +1 -1
- package/dist/store/use-scene.d.ts +31 -2
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +638 -8
- package/dist/systems/elevator/elevator-opening-system.d.ts +1 -0
- package/dist/systems/elevator/elevator-opening-system.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-opening-system.js +27 -21
- package/dist/systems/elevator/elevator-service.d.ts +0 -2
- package/dist/systems/elevator/elevator-service.d.ts.map +1 -1
- package/dist/systems/elevator/elevator-service.js +2 -24
- package/dist/systems/slab/slab-placement.d.ts +11 -0
- package/dist/systems/slab/slab-placement.d.ts.map +1 -0
- package/dist/systems/slab/slab-placement.js +14 -0
- package/dist/systems/slab/slab-support.d.ts +150 -0
- package/dist/systems/slab/slab-support.d.ts.map +1 -0
- package/dist/systems/slab/slab-support.js +575 -0
- package/dist/systems/stair/stair-opening-preview.d.ts +1060 -935
- package/dist/systems/stair/stair-opening-preview.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-sync.js +18 -15
- package/dist/systems/stair/stair-opening-system.d.ts.map +1 -1
- package/dist/systems/stair/stair-opening-system.js +32 -4
- package/dist/systems/stair/stair-rise.d.ts +22 -0
- package/dist/systems/stair/stair-rise.d.ts.map +1 -0
- package/dist/systems/stair/stair-rise.js +79 -0
- package/dist/systems/wall/wall-curve.d.ts +10 -0
- package/dist/systems/wall/wall-curve.d.ts.map +1 -1
- package/dist/systems/wall/wall-curve.js +1 -1
- package/dist/systems/wall/wall-mitering.js +6 -6
- package/dist/systems/wall/wall-top.d.ts +40 -0
- package/dist/systems/wall/wall-top.d.ts.map +1 -0
- package/dist/systems/wall/wall-top.js +46 -0
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +34 -3
- package/dist/utils/heal-scene-graph.d.ts +1 -1
- package/dist/utils/heal-scene-graph.d.ts.map +1 -1
- package/dist/utils/heal-scene-graph.js +25 -9
- package/dist/validation/validate-build-json.d.ts +2 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +59 -3
- package/package.json +2 -2
- package/dist/hooks/scene-registry/scene-registry.test.d.ts +0 -2
- package/dist/hooks/scene-registry/scene-registry.test.d.ts.map +0 -1
- package/dist/hooks/scene-registry/scene-registry.test.js +0 -26
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts +0 -2
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.d.ts.map +0 -1
- package/dist/hooks/spatial-grid/floor-placed-elevation.test.js +0 -366
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts +0 -2
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.d.ts.map +0 -1
- package/dist/hooks/spatial-grid/wall-slab-overlap.test.js +0 -363
- package/dist/lib/measurement-geometry.test.d.ts +0 -2
- package/dist/lib/measurement-geometry.test.d.ts.map +0 -1
- package/dist/lib/measurement-geometry.test.js +0 -102
- package/dist/lib/slab-polygon.test.d.ts +0 -2
- package/dist/lib/slab-polygon.test.d.ts.map +0 -1
- package/dist/lib/slab-polygon.test.js +0 -635
- package/dist/lib/space-detection-pause.test.d.ts +0 -2
- package/dist/lib/space-detection-pause.test.d.ts.map +0 -1
- package/dist/lib/space-detection-pause.test.js +0 -42
- package/dist/lib/space-detection.test.d.ts +0 -2
- package/dist/lib/space-detection.test.d.ts.map +0 -1
- package/dist/lib/space-detection.test.js +0 -376
- package/dist/lib/zone-quantities.test.d.ts +0 -2
- package/dist/lib/zone-quantities.test.d.ts.map +0 -1
- package/dist/lib/zone-quantities.test.js +0 -82
- package/dist/registry/registry.test.d.ts +0 -2
- package/dist/registry/registry.test.d.ts.map +0 -1
- package/dist/registry/registry.test.js +0 -196
- package/dist/registry/relations-resolver.test.d.ts +0 -2
- package/dist/registry/relations-resolver.test.d.ts.map +0 -1
- package/dist/registry/relations-resolver.test.js +0 -183
- package/dist/registry/scene-api.test.d.ts +0 -2
- package/dist/registry/scene-api.test.d.ts.map +0 -1
- package/dist/registry/scene-api.test.js +0 -183
- package/dist/registry/subtree.test.d.ts +0 -2
- package/dist/registry/subtree.test.d.ts.map +0 -1
- package/dist/registry/subtree.test.js +0 -163
- package/dist/schema/asset-url.test.d.ts +0 -2
- package/dist/schema/asset-url.test.d.ts.map +0 -1
- package/dist/schema/asset-url.test.js +0 -134
- package/dist/schema/material.test.d.ts +0 -2
- package/dist/schema/material.test.d.ts.map +0 -1
- package/dist/schema/material.test.js +0 -43
- package/dist/schema/nodes/measurement.test.d.ts +0 -2
- package/dist/schema/nodes/measurement.test.d.ts.map +0 -1
- package/dist/schema/nodes/measurement.test.js +0 -139
- package/dist/schema/nodes/ridge-vent-defaults.test.d.ts +0 -2
- package/dist/schema/nodes/ridge-vent-defaults.test.d.ts.map +0 -1
- package/dist/schema/nodes/ridge-vent-defaults.test.js +0 -205
- package/dist/schema/nodes/roof-segment-shape.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-shape.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-shape.test.js +0 -175
- package/dist/schema/nodes/roof-segment-surface.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-surface.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-surface.test.js +0 -48
- package/dist/schema/nodes/roof-segment-trim.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-trim.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-trim.test.js +0 -107
- package/dist/schema/nodes/roof-segment-walls.test.d.ts +0 -2
- package/dist/schema/nodes/roof-segment-walls.test.d.ts.map +0 -1
- package/dist/schema/nodes/roof-segment-walls.test.js +0 -92
- package/dist/schema/nodes/wall.test.d.ts +0 -2
- package/dist/schema/nodes/wall.test.d.ts.map +0 -1
- package/dist/schema/nodes/wall.test.js +0 -208
- package/dist/services/alignment-anchors.test.d.ts +0 -2
- package/dist/services/alignment-anchors.test.d.ts.map +0 -1
- package/dist/services/alignment-anchors.test.js +0 -383
- package/dist/services/alignment.test.d.ts +0 -2
- package/dist/services/alignment.test.d.ts.map +0 -1
- package/dist/services/alignment.test.js +0 -92
- package/dist/services/drag-session.test.d.ts +0 -2
- package/dist/services/drag-session.test.d.ts.map +0 -1
- package/dist/services/drag-session.test.js +0 -219
- package/dist/services/hosting.test.d.ts +0 -2
- package/dist/services/hosting.test.d.ts.map +0 -1
- package/dist/services/hosting.test.js +0 -230
- package/dist/services/movement.test.d.ts +0 -2
- package/dist/services/movement.test.d.ts.map +0 -1
- package/dist/services/movement.test.js +0 -133
- package/dist/services/opening-guides.test.d.ts +0 -2
- package/dist/services/opening-guides.test.d.ts.map +0 -1
- package/dist/services/opening-guides.test.js +0 -208
- package/dist/services/port-connectivity.test.d.ts +0 -2
- package/dist/services/port-connectivity.test.d.ts.map +0 -1
- package/dist/services/port-connectivity.test.js +0 -297
- package/dist/services/riser-diagram.test.d.ts +0 -2
- package/dist/services/riser-diagram.test.d.ts.map +0 -1
- package/dist/services/riser-diagram.test.js +0 -66
- package/dist/services/single-undo-dance.test.d.ts +0 -2
- package/dist/services/single-undo-dance.test.d.ts.map +0 -1
- package/dist/services/single-undo-dance.test.js +0 -210
- package/dist/services/snap.test.d.ts +0 -2
- package/dist/services/snap.test.d.ts.map +0 -1
- package/dist/services/snap.test.js +0 -137
- package/dist/services/system-graph.test.d.ts +0 -2
- package/dist/services/system-graph.test.d.ts.map +0 -1
- package/dist/services/system-graph.test.js +0 -138
- package/dist/services/validate-dwv.test.d.ts +0 -2
- package/dist/services/validate-dwv.test.d.ts.map +0 -1
- package/dist/services/validate-dwv.test.js +0 -109
- package/dist/store/actions/node-mutation-sanitize.test.d.ts +0 -2
- package/dist/store/actions/node-mutation-sanitize.test.d.ts.map +0 -1
- package/dist/store/actions/node-mutation-sanitize.test.js +0 -147
- package/dist/store/actions/reparent.test.d.ts +0 -2
- package/dist/store/actions/reparent.test.d.ts.map +0 -1
- package/dist/store/actions/reparent.test.js +0 -212
- package/dist/store/actions/ridge-vent-update.test.d.ts +0 -2
- package/dist/store/actions/ridge-vent-update.test.d.ts.map +0 -1
- package/dist/store/actions/ridge-vent-update.test.js +0 -264
- package/dist/store/use-scene-dirty-tracking.test.d.ts +0 -2
- package/dist/store/use-scene-dirty-tracking.test.d.ts.map +0 -1
- package/dist/store/use-scene-dirty-tracking.test.js +0 -68
- package/dist/store/use-scene-elevator-migration.test.d.ts +0 -2
- package/dist/store/use-scene-elevator-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-elevator-migration.test.js +0 -109
- package/dist/store/use-scene-measurement-roundtrip.test.d.ts +0 -2
- package/dist/store/use-scene-measurement-roundtrip.test.d.ts.map +0 -1
- package/dist/store/use-scene-measurement-roundtrip.test.js +0 -97
- package/dist/store/use-scene-plugins.test.d.ts +0 -2
- package/dist/store/use-scene-plugins.test.d.ts.map +0 -1
- package/dist/store/use-scene-plugins.test.js +0 -51
- package/dist/store/use-scene-wall-slot-migration.test.d.ts +0 -2
- package/dist/store/use-scene-wall-slot-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-wall-slot-migration.test.js +0 -210
- package/dist/store/use-scene-window-migration.test.d.ts +0 -2
- package/dist/store/use-scene-window-migration.test.d.ts.map +0 -1
- package/dist/store/use-scene-window-migration.test.js +0 -85
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts +0 -2
- package/dist/systems/elevator/elevator-opening-sync.test.d.ts.map +0 -1
- package/dist/systems/elevator/elevator-opening-sync.test.js +0 -146
- package/dist/systems/elevator/elevator-runtime.test.d.ts +0 -2
- package/dist/systems/elevator/elevator-runtime.test.d.ts.map +0 -1
- package/dist/systems/elevator/elevator-runtime.test.js +0 -64
- package/dist/systems/fence/fence-spline.test.d.ts +0 -2
- package/dist/systems/fence/fence-spline.test.d.ts.map +0 -1
- package/dist/systems/fence/fence-spline.test.js +0 -136
- package/dist/systems/stair/stair-opening-preview.test.d.ts +0 -2
- package/dist/systems/stair/stair-opening-preview.test.d.ts.map +0 -1
- package/dist/systems/stair/stair-opening-preview.test.js +0 -80
- package/dist/systems/stair/stair-opening-sync.test.d.ts +0 -2
- package/dist/systems/stair/stair-opening-sync.test.d.ts.map +0 -1
- package/dist/systems/stair/stair-opening-sync.test.js +0 -485
- package/dist/systems/wall/wall-mitering.test.d.ts +0 -2
- package/dist/systems/wall/wall-mitering.test.d.ts.map +0 -1
- package/dist/systems/wall/wall-mitering.test.js +0 -63
- package/dist/utils/clone-scene-graph.test.d.ts +0 -2
- package/dist/utils/clone-scene-graph.test.d.ts.map +0 -1
- package/dist/utils/clone-scene-graph.test.js +0 -62
- package/dist/utils/heal-scene-graph.test.d.ts +0 -2
- package/dist/utils/heal-scene-graph.test.d.ts.map +0 -1
- package/dist/utils/heal-scene-graph.test.js +0 -88
|
@@ -1,485 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { BuildingNode, CeilingNode, LevelNode, SlabNode, StairNode, StairSegmentNode, } from '../../schema';
|
|
3
|
-
import { syncAutoStairOpenings } from './stair-opening-sync';
|
|
4
|
-
describe('syncAutoStairOpenings', () => {
|
|
5
|
-
test('only applies stair holes to destination slabs that overlap the opening', () => {
|
|
6
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
7
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
8
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
9
|
-
const landingSlab = SlabNode.parse({
|
|
10
|
-
name: 'Landing Slab',
|
|
11
|
-
parentId: upper.id,
|
|
12
|
-
polygon: [
|
|
13
|
-
[0, 0],
|
|
14
|
-
[4, 0],
|
|
15
|
-
[4, 3],
|
|
16
|
-
[0, 3],
|
|
17
|
-
],
|
|
18
|
-
});
|
|
19
|
-
const bedroomSlab = SlabNode.parse({
|
|
20
|
-
name: 'Bedroom Slab',
|
|
21
|
-
parentId: upper.id,
|
|
22
|
-
polygon: [
|
|
23
|
-
[4, 0],
|
|
24
|
-
[8, 0],
|
|
25
|
-
[8, 3],
|
|
26
|
-
[4, 3],
|
|
27
|
-
],
|
|
28
|
-
});
|
|
29
|
-
const segment = StairSegmentNode.parse({
|
|
30
|
-
parentId: 'stair_main',
|
|
31
|
-
width: 1,
|
|
32
|
-
length: 2.6,
|
|
33
|
-
height: 2.5,
|
|
34
|
-
stepCount: 12,
|
|
35
|
-
});
|
|
36
|
-
const stair = StairNode.parse({
|
|
37
|
-
id: 'stair_main',
|
|
38
|
-
name: 'Main Stair',
|
|
39
|
-
parentId: ground.id,
|
|
40
|
-
position: [2, 0, 0.2],
|
|
41
|
-
stairType: 'straight',
|
|
42
|
-
fromLevelId: ground.id,
|
|
43
|
-
toLevelId: upper.id,
|
|
44
|
-
slabOpeningMode: 'destination',
|
|
45
|
-
children: [segment.id],
|
|
46
|
-
});
|
|
47
|
-
const nodes = Object.fromEntries([
|
|
48
|
-
building,
|
|
49
|
-
ground,
|
|
50
|
-
upper,
|
|
51
|
-
landingSlab,
|
|
52
|
-
bedroomSlab,
|
|
53
|
-
stair,
|
|
54
|
-
{ ...segment, parentId: stair.id },
|
|
55
|
-
].map((node) => [node.id, node]));
|
|
56
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
57
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
58
|
-
const bedroomUpdate = updates.find((update) => update.id === bedroomSlab.id);
|
|
59
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
60
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
61
|
-
expect(bedroomUpdate).toBeUndefined();
|
|
62
|
-
});
|
|
63
|
-
test('applies stair holes to a later destination slab when the configured offset overhangs the slab edge', () => {
|
|
64
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
65
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
66
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
67
|
-
const landingSlab = SlabNode.parse({
|
|
68
|
-
name: 'Landing Slab',
|
|
69
|
-
parentId: upper.id,
|
|
70
|
-
polygon: [
|
|
71
|
-
[0, 0],
|
|
72
|
-
[4, 0],
|
|
73
|
-
[4, 3],
|
|
74
|
-
[0, 3],
|
|
75
|
-
],
|
|
76
|
-
});
|
|
77
|
-
const segment = StairSegmentNode.parse({
|
|
78
|
-
parentId: 'stair_edge',
|
|
79
|
-
width: 1,
|
|
80
|
-
length: 2.6,
|
|
81
|
-
height: 2.5,
|
|
82
|
-
stepCount: 12,
|
|
83
|
-
});
|
|
84
|
-
const stair = StairNode.parse({
|
|
85
|
-
id: 'stair_edge',
|
|
86
|
-
name: 'Edge Stair',
|
|
87
|
-
parentId: ground.id,
|
|
88
|
-
position: [2, 0, 0],
|
|
89
|
-
stairType: 'straight',
|
|
90
|
-
fromLevelId: ground.id,
|
|
91
|
-
toLevelId: upper.id,
|
|
92
|
-
slabOpeningMode: 'destination',
|
|
93
|
-
openingOffset: 0.08,
|
|
94
|
-
children: [segment.id],
|
|
95
|
-
});
|
|
96
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
97
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
98
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
99
|
-
const hole = landingUpdate?.data.holes?.[0];
|
|
100
|
-
expect(hole).toBeDefined();
|
|
101
|
-
expect(Math.min(...hole.map(([, z]) => z))).toBeCloseTo(-0.08);
|
|
102
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
103
|
-
});
|
|
104
|
-
test('does not apply stair holes to slabs on another building with a matching level number', () => {
|
|
105
|
-
const buildingA = BuildingNode.parse({ name: 'Building A' });
|
|
106
|
-
const groundA = LevelNode.parse({ name: 'Ground A', level: 0, parentId: buildingA.id });
|
|
107
|
-
const upperA = LevelNode.parse({ name: 'Upper A', level: 1, parentId: buildingA.id });
|
|
108
|
-
const buildingB = BuildingNode.parse({ name: 'Building B' });
|
|
109
|
-
const upperB = LevelNode.parse({ name: 'Upper B', level: 1, parentId: buildingB.id });
|
|
110
|
-
const slabA = SlabNode.parse({
|
|
111
|
-
name: 'Upper A Slab',
|
|
112
|
-
parentId: upperA.id,
|
|
113
|
-
polygon: [
|
|
114
|
-
[0, 0],
|
|
115
|
-
[4, 0],
|
|
116
|
-
[4, 3],
|
|
117
|
-
[0, 3],
|
|
118
|
-
],
|
|
119
|
-
});
|
|
120
|
-
const slabB = SlabNode.parse({
|
|
121
|
-
name: 'Upper B Slab',
|
|
122
|
-
parentId: upperB.id,
|
|
123
|
-
polygon: [
|
|
124
|
-
[0, 0],
|
|
125
|
-
[4, 0],
|
|
126
|
-
[4, 3],
|
|
127
|
-
[0, 3],
|
|
128
|
-
],
|
|
129
|
-
});
|
|
130
|
-
const segment = StairSegmentNode.parse({
|
|
131
|
-
parentId: 'stair_scoped',
|
|
132
|
-
width: 1,
|
|
133
|
-
length: 2.6,
|
|
134
|
-
height: 2.5,
|
|
135
|
-
stepCount: 12,
|
|
136
|
-
});
|
|
137
|
-
const stair = StairNode.parse({
|
|
138
|
-
id: 'stair_scoped',
|
|
139
|
-
name: 'Scoped Stair',
|
|
140
|
-
parentId: groundA.id,
|
|
141
|
-
position: [2, 0, 0.2],
|
|
142
|
-
stairType: 'straight',
|
|
143
|
-
fromLevelId: groundA.id,
|
|
144
|
-
toLevelId: upperA.id,
|
|
145
|
-
slabOpeningMode: 'destination',
|
|
146
|
-
children: [segment.id],
|
|
147
|
-
});
|
|
148
|
-
const nodes = Object.fromEntries([
|
|
149
|
-
buildingA,
|
|
150
|
-
groundA,
|
|
151
|
-
upperA,
|
|
152
|
-
buildingB,
|
|
153
|
-
upperB,
|
|
154
|
-
slabA,
|
|
155
|
-
slabB,
|
|
156
|
-
stair,
|
|
157
|
-
{ ...segment, parentId: stair.id },
|
|
158
|
-
].map((node) => [node.id, node]));
|
|
159
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
160
|
-
expect(updates.find((update) => update.id === slabA.id)?.data.holes).toHaveLength(1);
|
|
161
|
-
expect(updates.find((update) => update.id === slabB.id)).toBeUndefined();
|
|
162
|
-
});
|
|
163
|
-
test('uses the parent level when a stair has stale from-level data', () => {
|
|
164
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
165
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
166
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
167
|
-
const landingSlab = SlabNode.parse({
|
|
168
|
-
name: 'Landing Slab',
|
|
169
|
-
parentId: upper.id,
|
|
170
|
-
polygon: [
|
|
171
|
-
[0, 0],
|
|
172
|
-
[4, 0],
|
|
173
|
-
[4, 8],
|
|
174
|
-
[0, 8],
|
|
175
|
-
],
|
|
176
|
-
});
|
|
177
|
-
const segment = StairSegmentNode.parse({
|
|
178
|
-
parentId: 'stair_stale_from',
|
|
179
|
-
width: 1,
|
|
180
|
-
length: 6,
|
|
181
|
-
height: 2.5,
|
|
182
|
-
stepCount: 12,
|
|
183
|
-
});
|
|
184
|
-
const stair = StairNode.parse({
|
|
185
|
-
id: 'stair_stale_from',
|
|
186
|
-
name: 'Stale From Stair',
|
|
187
|
-
parentId: ground.id,
|
|
188
|
-
position: [2, 0, 0.2],
|
|
189
|
-
stairType: 'straight',
|
|
190
|
-
fromLevelId: 'default',
|
|
191
|
-
toLevelId: upper.id,
|
|
192
|
-
slabOpeningMode: 'destination',
|
|
193
|
-
children: [segment.id],
|
|
194
|
-
});
|
|
195
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
196
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
197
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
198
|
-
const hole = landingUpdate?.data.holes?.[0];
|
|
199
|
-
expect(hole).toBeDefined();
|
|
200
|
-
expect(Math.min(...hole.map(([, z]) => z))).toBeGreaterThan(0.9);
|
|
201
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
202
|
-
});
|
|
203
|
-
test('infers the destination level when a destination stair has blank level fields', () => {
|
|
204
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
205
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
206
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
207
|
-
const landingSlab = SlabNode.parse({
|
|
208
|
-
name: 'Landing Slab',
|
|
209
|
-
parentId: upper.id,
|
|
210
|
-
polygon: [
|
|
211
|
-
[0, 0],
|
|
212
|
-
[4, 0],
|
|
213
|
-
[4, 8],
|
|
214
|
-
[0, 8],
|
|
215
|
-
],
|
|
216
|
-
});
|
|
217
|
-
const segment = StairSegmentNode.parse({
|
|
218
|
-
parentId: 'stair_blank_levels',
|
|
219
|
-
width: 1,
|
|
220
|
-
length: 6,
|
|
221
|
-
height: 2.5,
|
|
222
|
-
stepCount: 12,
|
|
223
|
-
});
|
|
224
|
-
const stair = StairNode.parse({
|
|
225
|
-
id: 'stair_blank_levels',
|
|
226
|
-
name: 'Blank Level Stair',
|
|
227
|
-
parentId: ground.id,
|
|
228
|
-
position: [2, 0, 0.2],
|
|
229
|
-
stairType: 'straight',
|
|
230
|
-
fromLevelId: '',
|
|
231
|
-
toLevelId: '',
|
|
232
|
-
slabOpeningMode: 'destination',
|
|
233
|
-
children: [segment.id],
|
|
234
|
-
});
|
|
235
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
236
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
237
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
238
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
239
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
240
|
-
});
|
|
241
|
-
test('infers the destination level when a destination stair targets its source level', () => {
|
|
242
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
243
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
244
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
245
|
-
const landingSlab = SlabNode.parse({
|
|
246
|
-
name: 'Landing Slab',
|
|
247
|
-
parentId: upper.id,
|
|
248
|
-
polygon: [
|
|
249
|
-
[0, 0],
|
|
250
|
-
[4, 0],
|
|
251
|
-
[4, 8],
|
|
252
|
-
[0, 8],
|
|
253
|
-
],
|
|
254
|
-
});
|
|
255
|
-
const segment = StairSegmentNode.parse({
|
|
256
|
-
parentId: 'stair_self_target',
|
|
257
|
-
width: 1,
|
|
258
|
-
length: 6,
|
|
259
|
-
height: 2.5,
|
|
260
|
-
stepCount: 12,
|
|
261
|
-
});
|
|
262
|
-
const stair = StairNode.parse({
|
|
263
|
-
id: 'stair_self_target',
|
|
264
|
-
name: 'Self Target Stair',
|
|
265
|
-
parentId: ground.id,
|
|
266
|
-
position: [2, 0, 0.2],
|
|
267
|
-
stairType: 'straight',
|
|
268
|
-
fromLevelId: ground.id,
|
|
269
|
-
toLevelId: ground.id,
|
|
270
|
-
slabOpeningMode: 'destination',
|
|
271
|
-
children: [segment.id],
|
|
272
|
-
});
|
|
273
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
274
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
275
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
276
|
-
expect(landingUpdate?.data.holes).toHaveLength(1);
|
|
277
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
278
|
-
});
|
|
279
|
-
test('does not add stair holes when a manual surface hole already covers them', () => {
|
|
280
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
281
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
282
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
283
|
-
const manualOpening = [
|
|
284
|
-
[1.0, 0.0],
|
|
285
|
-
[3.0, 0.0],
|
|
286
|
-
[3.0, 3.0],
|
|
287
|
-
[1.0, 3.0],
|
|
288
|
-
];
|
|
289
|
-
const sourceCeiling = CeilingNode.parse({
|
|
290
|
-
name: 'Source Ceiling',
|
|
291
|
-
parentId: ground.id,
|
|
292
|
-
polygon: [
|
|
293
|
-
[0, 0],
|
|
294
|
-
[4, 0],
|
|
295
|
-
[4, 3],
|
|
296
|
-
[0, 3],
|
|
297
|
-
],
|
|
298
|
-
holes: [manualOpening],
|
|
299
|
-
holeMetadata: [{ source: 'manual' }],
|
|
300
|
-
});
|
|
301
|
-
const landingSlab = SlabNode.parse({
|
|
302
|
-
name: 'Landing Slab',
|
|
303
|
-
parentId: upper.id,
|
|
304
|
-
polygon: [
|
|
305
|
-
[0, 0],
|
|
306
|
-
[4, 0],
|
|
307
|
-
[4, 3],
|
|
308
|
-
[0, 3],
|
|
309
|
-
],
|
|
310
|
-
holes: [manualOpening],
|
|
311
|
-
holeMetadata: [{ source: 'manual' }],
|
|
312
|
-
});
|
|
313
|
-
const segment = StairSegmentNode.parse({
|
|
314
|
-
parentId: 'stair_main',
|
|
315
|
-
width: 1,
|
|
316
|
-
length: 2.6,
|
|
317
|
-
height: 2.5,
|
|
318
|
-
stepCount: 12,
|
|
319
|
-
});
|
|
320
|
-
const stair = StairNode.parse({
|
|
321
|
-
id: 'stair_main',
|
|
322
|
-
name: 'Main Stair',
|
|
323
|
-
parentId: ground.id,
|
|
324
|
-
position: [2, 0, 0.2],
|
|
325
|
-
stairType: 'straight',
|
|
326
|
-
fromLevelId: ground.id,
|
|
327
|
-
toLevelId: upper.id,
|
|
328
|
-
slabOpeningMode: 'destination',
|
|
329
|
-
children: [segment.id],
|
|
330
|
-
});
|
|
331
|
-
const nodes = Object.fromEntries([
|
|
332
|
-
building,
|
|
333
|
-
ground,
|
|
334
|
-
upper,
|
|
335
|
-
sourceCeiling,
|
|
336
|
-
landingSlab,
|
|
337
|
-
stair,
|
|
338
|
-
{ ...segment, parentId: stair.id },
|
|
339
|
-
].map((node) => [node.id, node]));
|
|
340
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
341
|
-
expect(updates.find((update) => update.id === landingSlab.id)).toBeUndefined();
|
|
342
|
-
expect(updates.find((update) => update.id === sourceCeiling.id)).toBeUndefined();
|
|
343
|
-
});
|
|
344
|
-
test('adds stair holes when an existing manual hole is too small', () => {
|
|
345
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
346
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
347
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
348
|
-
const smallManualOpening = [
|
|
349
|
-
[1.8, 1.6],
|
|
350
|
-
[2.2, 1.6],
|
|
351
|
-
[2.2, 2.1],
|
|
352
|
-
[1.8, 2.1],
|
|
353
|
-
];
|
|
354
|
-
const landingSlab = SlabNode.parse({
|
|
355
|
-
name: 'Landing Slab',
|
|
356
|
-
parentId: upper.id,
|
|
357
|
-
polygon: [
|
|
358
|
-
[0, 0],
|
|
359
|
-
[4, 0],
|
|
360
|
-
[4, 3],
|
|
361
|
-
[0, 3],
|
|
362
|
-
],
|
|
363
|
-
holes: [smallManualOpening],
|
|
364
|
-
holeMetadata: [{ source: 'manual' }],
|
|
365
|
-
});
|
|
366
|
-
const segment = StairSegmentNode.parse({
|
|
367
|
-
parentId: 'stair_main',
|
|
368
|
-
width: 1,
|
|
369
|
-
length: 2.6,
|
|
370
|
-
height: 2.5,
|
|
371
|
-
stepCount: 12,
|
|
372
|
-
});
|
|
373
|
-
const stair = StairNode.parse({
|
|
374
|
-
id: 'stair_main',
|
|
375
|
-
name: 'Main Stair',
|
|
376
|
-
parentId: ground.id,
|
|
377
|
-
position: [2, 0, 0.2],
|
|
378
|
-
stairType: 'straight',
|
|
379
|
-
fromLevelId: ground.id,
|
|
380
|
-
toLevelId: upper.id,
|
|
381
|
-
slabOpeningMode: 'destination',
|
|
382
|
-
children: [segment.id],
|
|
383
|
-
});
|
|
384
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
385
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
386
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
387
|
-
expect(landingUpdate?.data.holes).toHaveLength(2);
|
|
388
|
-
expect(landingUpdate?.data.holes?.[0]).toEqual(smallManualOpening);
|
|
389
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([
|
|
390
|
-
{ source: 'manual' },
|
|
391
|
-
{ source: 'stair', stairId: stair.id },
|
|
392
|
-
]);
|
|
393
|
-
});
|
|
394
|
-
test('removes stale auto stair holes when a manual hole overlaps the stair opening', () => {
|
|
395
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
396
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
397
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
398
|
-
const manualOpening = [
|
|
399
|
-
[1.0, 0.0],
|
|
400
|
-
[3.0, 0.0],
|
|
401
|
-
[3.0, 3.0],
|
|
402
|
-
[1.0, 3.0],
|
|
403
|
-
];
|
|
404
|
-
const staleAutoOpening = [
|
|
405
|
-
[1.5, 1],
|
|
406
|
-
[2.5, 1],
|
|
407
|
-
[2.5, 2.8],
|
|
408
|
-
[1.5, 2.8],
|
|
409
|
-
];
|
|
410
|
-
const landingSlab = SlabNode.parse({
|
|
411
|
-
name: 'Landing Slab',
|
|
412
|
-
parentId: upper.id,
|
|
413
|
-
polygon: [
|
|
414
|
-
[0, 0],
|
|
415
|
-
[4, 0],
|
|
416
|
-
[4, 3],
|
|
417
|
-
[0, 3],
|
|
418
|
-
],
|
|
419
|
-
holes: [manualOpening, staleAutoOpening],
|
|
420
|
-
holeMetadata: [{ source: 'manual' }, { source: 'stair', stairId: 'stair_main' }],
|
|
421
|
-
});
|
|
422
|
-
const segment = StairSegmentNode.parse({
|
|
423
|
-
parentId: 'stair_main',
|
|
424
|
-
width: 1,
|
|
425
|
-
length: 2.6,
|
|
426
|
-
height: 2.5,
|
|
427
|
-
stepCount: 12,
|
|
428
|
-
});
|
|
429
|
-
const stair = StairNode.parse({
|
|
430
|
-
id: 'stair_main',
|
|
431
|
-
name: 'Main Stair',
|
|
432
|
-
parentId: ground.id,
|
|
433
|
-
position: [2, 0, 0.2],
|
|
434
|
-
stairType: 'straight',
|
|
435
|
-
fromLevelId: ground.id,
|
|
436
|
-
toLevelId: upper.id,
|
|
437
|
-
slabOpeningMode: 'destination',
|
|
438
|
-
children: [segment.id],
|
|
439
|
-
});
|
|
440
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair, { ...segment, parentId: stair.id }].map((node) => [node.id, node]));
|
|
441
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
442
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
443
|
-
expect(landingUpdate?.data.holes).toEqual([manualOpening]);
|
|
444
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'manual' }]);
|
|
445
|
-
});
|
|
446
|
-
test('does not add a separate rectangular hole for an integrated spiral top landing', () => {
|
|
447
|
-
const building = BuildingNode.parse({ name: 'Building' });
|
|
448
|
-
const ground = LevelNode.parse({ name: 'Ground', level: 0, parentId: building.id });
|
|
449
|
-
const upper = LevelNode.parse({ name: 'Upper', level: 1, parentId: building.id });
|
|
450
|
-
const landingSlab = SlabNode.parse({
|
|
451
|
-
name: 'Landing Slab',
|
|
452
|
-
parentId: upper.id,
|
|
453
|
-
polygon: [
|
|
454
|
-
[-4, -4],
|
|
455
|
-
[4, -4],
|
|
456
|
-
[4, 4],
|
|
457
|
-
[-4, 4],
|
|
458
|
-
],
|
|
459
|
-
});
|
|
460
|
-
const stair = StairNode.parse({
|
|
461
|
-
id: 'stair_spiral_landing',
|
|
462
|
-
name: 'Spiral Landing Stair',
|
|
463
|
-
parentId: ground.id,
|
|
464
|
-
position: [0, 0, 0],
|
|
465
|
-
rotation: Math.PI / 2,
|
|
466
|
-
stairType: 'spiral',
|
|
467
|
-
fromLevelId: ground.id,
|
|
468
|
-
toLevelId: upper.id,
|
|
469
|
-
slabOpeningMode: 'destination',
|
|
470
|
-
innerRadius: 0.35,
|
|
471
|
-
width: 1.2,
|
|
472
|
-
sweepAngle: Math.PI * 1.6,
|
|
473
|
-
topLandingMode: 'integrated',
|
|
474
|
-
topLandingDepth: 1.1,
|
|
475
|
-
});
|
|
476
|
-
const nodes = Object.fromEntries([building, ground, upper, landingSlab, stair].map((node) => [node.id, node]));
|
|
477
|
-
const updates = syncAutoStairOpenings(nodes);
|
|
478
|
-
const landingUpdate = updates.find((update) => update.id === landingSlab.id);
|
|
479
|
-
const holes = landingUpdate?.data.holes ?? [];
|
|
480
|
-
const rectangularHoles = holes.filter((hole) => hole.length === 4);
|
|
481
|
-
expect(holes).toHaveLength(1);
|
|
482
|
-
expect(rectangularHoles).toHaveLength(0);
|
|
483
|
-
expect(landingUpdate?.data.holeMetadata).toEqual([{ source: 'stair', stairId: stair.id }]);
|
|
484
|
-
});
|
|
485
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wall-mitering.test.d.ts","sourceRoot":"","sources":["../../../src/systems/wall/wall-mitering.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { calculateLevelMiters, getWallMiterBoundaryPoints } from './wall-mitering';
|
|
3
|
-
function wall(id, start, end) {
|
|
4
|
-
return {
|
|
5
|
-
id,
|
|
6
|
-
type: 'wall',
|
|
7
|
-
object: 'node',
|
|
8
|
-
visible: true,
|
|
9
|
-
parentId: 'level_test',
|
|
10
|
-
children: [],
|
|
11
|
-
start,
|
|
12
|
-
end,
|
|
13
|
-
thickness: 0.1,
|
|
14
|
-
height: 2.5,
|
|
15
|
-
frontSide: 'interior',
|
|
16
|
-
backSide: 'exterior',
|
|
17
|
-
metadata: {},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function maxBoundaryCoord(walls) {
|
|
21
|
-
const miter = calculateLevelMiters(walls);
|
|
22
|
-
let max = 0;
|
|
23
|
-
for (const w of walls) {
|
|
24
|
-
const bp = getWallMiterBoundaryPoints(w, miter);
|
|
25
|
-
expect(bp).not.toBeNull();
|
|
26
|
-
if (!bp)
|
|
27
|
-
continue;
|
|
28
|
-
for (const p of [bp.startLeft, bp.startRight, bp.endLeft, bp.endRight]) {
|
|
29
|
-
expect(Number.isFinite(p.x)).toBe(true);
|
|
30
|
-
expect(Number.isFinite(p.y)).toBe(true);
|
|
31
|
-
max = Math.max(max, Math.abs(p.x), Math.abs(p.y));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return max;
|
|
35
|
-
}
|
|
36
|
-
describe('wall mitering miter limit', () => {
|
|
37
|
-
// Two 3 m walls sharing the origin, meeting at decreasing angles. Without a
|
|
38
|
-
// miter limit the joint point runs to infinity as the angle → 0 (∝ 1/sin θ),
|
|
39
|
-
// which is the "infinite wall" seen when a room-preset preview lands on top of
|
|
40
|
-
// an existing wall. The boundary must stay bounded near the wall length.
|
|
41
|
-
test.each([90, 30, 10, 5, 1, 0.1, 0.01])('stays bounded at a %s° junction', (deg) => {
|
|
42
|
-
const rad = (deg * Math.PI) / 180;
|
|
43
|
-
const walls = [
|
|
44
|
-
wall('A', [0, 0], [3, 0]),
|
|
45
|
-
wall('B', [0, 0], [3 * Math.cos(rad), 3 * Math.sin(rad)]),
|
|
46
|
-
];
|
|
47
|
-
// 3 m walls + a few cm of joint: anything past ~4 m is a runaway spike.
|
|
48
|
-
expect(maxBoundaryCoord(walls)).toBeLessThan(4);
|
|
49
|
-
});
|
|
50
|
-
test('still miters a normal 90° corner', () => {
|
|
51
|
-
const walls = [wall('A', [0, 0], [3, 0]), wall('B', [0, 0], [0, 3])];
|
|
52
|
-
const miter = calculateLevelMiters(walls);
|
|
53
|
-
const bpA = getWallMiterBoundaryPoints(walls[0], miter);
|
|
54
|
-
expect(bpA).not.toBeNull();
|
|
55
|
-
if (!bpA)
|
|
56
|
-
throw new Error('expected miter boundary points');
|
|
57
|
-
// The shared corner is pulled to the mitred intersection, offset from the
|
|
58
|
-
// raw butt position (halfThickness 0.05) by the diagonal of the joint.
|
|
59
|
-
const startSideX = Math.min(bpA.startLeft.x, bpA.startRight.x);
|
|
60
|
-
expect(startSideX).toBeLessThan(-0.001);
|
|
61
|
-
expect(startSideX).toBeGreaterThan(-0.5);
|
|
62
|
-
});
|
|
63
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clone-scene-graph.test.d.ts","sourceRoot":"","sources":["../../src/utils/clone-scene-graph.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test';
|
|
2
|
-
import { forkSceneGraph } from './clone-scene-graph';
|
|
3
|
-
function makeNode(id, type, extra = {}) {
|
|
4
|
-
return {
|
|
5
|
-
object: 'node',
|
|
6
|
-
id,
|
|
7
|
-
type,
|
|
8
|
-
parentId: null,
|
|
9
|
-
visible: true,
|
|
10
|
-
metadata: {},
|
|
11
|
-
...extra,
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function makeSceneGraph() {
|
|
15
|
-
const site = makeNode('site_1', 'site', { children: ['level_1'] });
|
|
16
|
-
const level = makeNode('level_1', 'level', {
|
|
17
|
-
parentId: 'site_1',
|
|
18
|
-
children: ['wall_1', 'scan_1', 'guide_1'],
|
|
19
|
-
});
|
|
20
|
-
const wall = makeNode('wall_1', 'wall', { parentId: 'level_1' });
|
|
21
|
-
const scan = makeNode('scan_1', 'scan', { parentId: 'level_1', url: 'scan.glb' });
|
|
22
|
-
const guide = makeNode('guide_1', 'guide', { parentId: 'level_1', url: 'guide.png' });
|
|
23
|
-
return {
|
|
24
|
-
nodes: {
|
|
25
|
-
['site_1']: site,
|
|
26
|
-
['level_1']: level,
|
|
27
|
-
['wall_1']: wall,
|
|
28
|
-
['scan_1']: scan,
|
|
29
|
-
['guide_1']: guide,
|
|
30
|
-
},
|
|
31
|
-
rootNodeIds: ['site_1'],
|
|
32
|
-
collections: {
|
|
33
|
-
['collection_1']: {
|
|
34
|
-
id: 'collection_1',
|
|
35
|
-
name: 'References',
|
|
36
|
-
nodeIds: ['scan_1', 'guide_1'],
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
installedPlugins: ['pascal:trees'],
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
describe('forkSceneGraph', () => {
|
|
43
|
-
test('strips scan and guide nodes by default', () => {
|
|
44
|
-
const forked = forkSceneGraph(makeSceneGraph());
|
|
45
|
-
const nodes = Object.values(forked.nodes);
|
|
46
|
-
expect(nodes.some((node) => node.type === 'scan')).toBe(false);
|
|
47
|
-
expect(nodes.some((node) => node.type === 'guide')).toBe(false);
|
|
48
|
-
expect(nodes.some((node) => node.type === 'wall')).toBe(true);
|
|
49
|
-
expect(forked.collections).toEqual({});
|
|
50
|
-
expect(forked.installedPlugins).toEqual(['pascal:trees']);
|
|
51
|
-
});
|
|
52
|
-
test('preserves scan and guide nodes when requested', () => {
|
|
53
|
-
const forked = forkSceneGraph(makeSceneGraph(), { preserveScans: true });
|
|
54
|
-
const nodes = Object.values(forked.nodes);
|
|
55
|
-
expect(nodes.some((node) => node.type === 'scan')).toBe(true);
|
|
56
|
-
expect(nodes.some((node) => node.type === 'guide')).toBe(true);
|
|
57
|
-
expect(nodes.map((node) => node.id)).not.toContain('scan_1');
|
|
58
|
-
expect(nodes.map((node) => node.id)).not.toContain('guide_1');
|
|
59
|
-
expect(Object.values(forked.collections ?? {}).flatMap((collection) => collection.nodeIds)).toHaveLength(2);
|
|
60
|
-
expect(forked.installedPlugins).toEqual(['pascal:trees']);
|
|
61
|
-
});
|
|
62
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"heal-scene-graph.test.d.ts","sourceRoot":"","sources":["../../src/utils/heal-scene-graph.test.ts"],"names":[],"mappings":""}
|