@pascal-app/core 0.9.1 → 1.0.0-beta.1
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 +49 -2
- package/dist/events/bus.d.ts.map +1 -1
- package/dist/hooks/scene-registry/item-clip-registry.d.ts +18 -0
- package/dist/hooks/scene-registry/item-clip-registry.d.ts.map +1 -0
- package/dist/hooks/scene-registry/item-clip-registry.js +10 -0
- package/dist/hooks/scene-registry/scene-registry.d.ts +8 -1
- package/dist/hooks/scene-registry/scene-registry.d.ts.map +1 -1
- package/dist/hooks/scene-registry/scene-registry.js +27 -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 +135 -28
- package/dist/hooks/spatial-grid/spatial-grid-manager.d.ts.map +1 -1
- package/dist/hooks/spatial-grid/spatial-grid-manager.js +427 -271
- 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 +208 -9
- 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 +33 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -10
- package/dist/lib/level-name.d.ts +4 -0
- package/dist/lib/level-name.d.ts.map +1 -0
- package/dist/lib/level-name.js +10 -0
- package/dist/lib/measurement-geometry.d.ts +23 -0
- package/dist/lib/measurement-geometry.d.ts.map +1 -0
- package/dist/lib/measurement-geometry.js +249 -0
- package/dist/lib/polygon-geometry.d.ts +0 -1
- package/dist/lib/polygon-geometry.d.ts.map +1 -1
- package/dist/lib/polygon-geometry.js +0 -18
- package/dist/lib/selection-proxy.d.ts +4 -0
- package/dist/lib/selection-proxy.d.ts.map +1 -0
- package/dist/lib/selection-proxy.js +12 -0
- package/dist/lib/slab-polygon.d.ts +31 -2
- package/dist/lib/slab-polygon.d.ts.map +1 -1
- package/dist/lib/slab-polygon.js +557 -31
- package/dist/lib/slots.d.ts +14 -0
- package/dist/lib/slots.d.ts.map +1 -0
- package/dist/lib/slots.js +26 -0
- package/dist/lib/space-detection.d.ts +40 -6
- package/dist/lib/space-detection.d.ts.map +1 -1
- package/dist/lib/space-detection.js +574 -192
- 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 +60 -0
- package/dist/lib/terrain-support.d.ts.map +1 -0
- package/dist/lib/terrain-support.js +150 -0
- package/dist/lib/wall-distance.d.ts +60 -0
- package/dist/lib/wall-distance.d.ts.map +1 -0
- package/dist/lib/wall-distance.js +85 -0
- package/dist/lib/zone-quantities.d.ts +21 -0
- package/dist/lib/zone-quantities.d.ts.map +1 -0
- package/dist/lib/zone-quantities.js +428 -0
- package/dist/material-library.d.ts +28 -1
- package/dist/material-library.d.ts.map +1 -1
- package/dist/material-library.js +2233 -441
- package/dist/registry/handles.d.ts +91 -3
- package/dist/registry/handles.d.ts.map +1 -1
- package/dist/registry/index.d.ts +3 -3
- package/dist/registry/index.d.ts.map +1 -1
- package/dist/registry/index.js +1 -1
- package/dist/registry/registry.d.ts +46 -3
- package/dist/registry/registry.d.ts.map +1 -1
- package/dist/registry/registry.js +82 -1
- package/dist/registry/subtree.d.ts.map +1 -1
- package/dist/registry/subtree.js +8 -1
- package/dist/registry/types.d.ts +781 -39
- package/dist/registry/types.d.ts.map +1 -1
- package/dist/schema/index.d.ts +27 -8
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +23 -6
- package/dist/schema/material.d.ts +3 -2
- package/dist/schema/material.d.ts.map +1 -1
- package/dist/schema/material.js +7 -5
- package/dist/schema/nodes/box-vent.d.ts +2 -2
- package/dist/schema/nodes/cabinet.d.ts +536 -0
- package/dist/schema/nodes/cabinet.d.ts.map +1 -0
- package/dist/schema/nodes/cabinet.js +139 -0
- package/dist/schema/nodes/ceiling.d.ts +4 -3
- package/dist/schema/nodes/ceiling.d.ts.map +1 -1
- package/dist/schema/nodes/ceiling.js +11 -1
- package/dist/schema/nodes/chimney.d.ts +4 -4
- package/dist/schema/nodes/column.d.ts +4 -2
- package/dist/schema/nodes/column.d.ts.map +1 -1
- package/dist/schema/nodes/column.js +5 -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/cupola.d.ts +2 -2
- package/dist/schema/nodes/door.d.ts +42 -5
- package/dist/schema/nodes/door.d.ts.map +1 -1
- package/dist/schema/nodes/door.js +32 -0
- package/dist/schema/nodes/dormer.d.ts +8 -8
- package/dist/schema/nodes/dormer.js +1 -1
- package/dist/schema/nodes/downspout.d.ts +2 -2
- package/dist/schema/nodes/duct-fitting.d.ts +91 -0
- package/dist/schema/nodes/duct-fitting.d.ts.map +1 -0
- package/dist/schema/nodes/duct-fitting.js +92 -0
- package/dist/schema/nodes/duct-segment.d.ts +61 -0
- package/dist/schema/nodes/duct-segment.d.ts.map +1 -0
- package/dist/schema/nodes/duct-segment.js +73 -0
- package/dist/schema/nodes/duct-terminal.d.ts +58 -0
- package/dist/schema/nodes/duct-terminal.d.ts.map +1 -0
- package/dist/schema/nodes/duct-terminal.js +53 -0
- package/dist/schema/nodes/elevator.d.ts +3 -2
- package/dist/schema/nodes/elevator.d.ts.map +1 -1
- package/dist/schema/nodes/elevator.js +3 -0
- package/dist/schema/nodes/eyebrow-vent.d.ts +2 -2
- package/dist/schema/nodes/fence.d.ts +20 -2
- package/dist/schema/nodes/fence.d.ts.map +1 -1
- package/dist/schema/nodes/fence.js +33 -2
- package/dist/schema/nodes/gutter.d.ts +2 -2
- package/dist/schema/nodes/hvac-equipment.d.ts +64 -0
- package/dist/schema/nodes/hvac-equipment.d.ts.map +1 -0
- package/dist/schema/nodes/hvac-equipment.js +57 -0
- package/dist/schema/nodes/item.d.ts +9 -0
- package/dist/schema/nodes/item.d.ts.map +1 -1
- package/dist/schema/nodes/item.js +24 -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 -31
- package/dist/schema/nodes/lineset.d.ts +42 -0
- package/dist/schema/nodes/lineset.d.ts.map +1 -0
- package/dist/schema/nodes/lineset.js +38 -0
- package/dist/schema/nodes/liquid-line.d.ts +34 -0
- package/dist/schema/nodes/liquid-line.d.ts.map +1 -0
- package/dist/schema/nodes/liquid-line.js +24 -0
- package/dist/schema/nodes/measurement.d.ts +306 -0
- package/dist/schema/nodes/measurement.d.ts.map +1 -0
- package/dist/schema/nodes/measurement.js +87 -0
- package/dist/schema/nodes/pipe-fitting.d.ts +56 -0
- package/dist/schema/nodes/pipe-fitting.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-fitting.js +45 -0
- package/dist/schema/nodes/pipe-segment.d.ts +48 -0
- package/dist/schema/nodes/pipe-segment.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-segment.js +36 -0
- package/dist/schema/nodes/pipe-trap.d.ts +43 -0
- package/dist/schema/nodes/pipe-trap.d.ts.map +1 -0
- package/dist/schema/nodes/pipe-trap.js +36 -0
- package/dist/schema/nodes/ridge-vent.d.ts +18 -3
- package/dist/schema/nodes/ridge-vent.d.ts.map +1 -1
- package/dist/schema/nodes/ridge-vent.js +221 -3
- package/dist/schema/nodes/roof-segment-shape.d.ts +90 -0
- package/dist/schema/nodes/roof-segment-shape.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment-shape.js +318 -0
- package/dist/schema/nodes/roof-segment-walls.d.ts +101 -0
- package/dist/schema/nodes/roof-segment-walls.d.ts.map +1 -0
- package/dist/schema/nodes/roof-segment-walls.js +330 -0
- package/dist/schema/nodes/roof-segment.d.ts +84 -8
- package/dist/schema/nodes/roof-segment.d.ts.map +1 -1
- package/dist/schema/nodes/roof-segment.js +290 -5
- package/dist/schema/nodes/roof.d.ts +8 -8
- package/dist/schema/nodes/shelf.d.ts +4 -2
- package/dist/schema/nodes/shelf.d.ts.map +1 -1
- package/dist/schema/nodes/shelf.js +8 -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/skylight.d.ts +10 -10
- package/dist/schema/nodes/slab.d.ts +8 -2
- package/dist/schema/nodes/slab.d.ts.map +1 -1
- package/dist/schema/nodes/slab.js +18 -2
- package/dist/schema/nodes/solar-panel.d.ts +4 -4
- 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-segment.d.ts +4 -4
- package/dist/schema/nodes/stair.d.ts +16 -13
- package/dist/schema/nodes/stair.d.ts.map +1 -1
- package/dist/schema/nodes/stair.js +11 -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/turbine-vent.d.ts +2 -2
- package/dist/schema/nodes/wall.d.ts +248 -6
- package/dist/schema/nodes/wall.d.ts.map +1 -1
- package/dist/schema/nodes/wall.js +266 -0
- package/dist/schema/nodes/window.d.ts +40 -3
- package/dist/schema/nodes/window.d.ts.map +1 -1
- package/dist/schema/nodes/window.js +30 -0
- package/dist/schema/nodes/zone.d.ts +22 -0
- package/dist/schema/nodes/zone.d.ts.map +1 -1
- package/dist/schema/nodes/zone.js +21 -0
- package/dist/schema/scene-material.d.ts +41 -0
- package/dist/schema/scene-material.d.ts.map +1 -0
- package/dist/schema/scene-material.js +9 -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 +1300 -97
- package/dist/schema/types.d.ts.map +1 -1
- package/dist/schema/types.js +27 -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/alignment-anchors.d.ts.map +1 -1
- package/dist/services/alignment-anchors.js +30 -1
- package/dist/services/alignment.d.ts +5 -0
- package/dist/services/alignment.d.ts.map +1 -1
- package/dist/services/alignment.js +2 -0
- package/dist/services/hosting.d.ts +8 -0
- package/dist/services/hosting.d.ts.map +1 -1
- package/dist/services/hosting.js +13 -4
- package/dist/services/index.d.ts +9 -2
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +9 -2
- package/dist/services/level-height.d.ts +27 -0
- package/dist/services/level-height.d.ts.map +1 -0
- package/dist/services/level-height.js +94 -0
- package/dist/services/opening-guides.d.ts +141 -0
- package/dist/services/opening-guides.d.ts.map +1 -0
- package/dist/services/opening-guides.js +267 -0
- package/dist/services/port-connectivity.d.ts +115 -0
- package/dist/services/port-connectivity.d.ts.map +1 -0
- package/dist/services/port-connectivity.js +300 -0
- package/dist/services/riser-diagram.d.ts +40 -0
- package/dist/services/riser-diagram.d.ts.map +1 -0
- package/dist/services/riser-diagram.js +110 -0
- package/dist/services/snap.d.ts +9 -1
- package/dist/services/snap.d.ts.map +1 -1
- package/dist/services/snap.js +21 -1
- 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/services/system-graph.d.ts +30 -0
- package/dist/services/system-graph.d.ts.map +1 -0
- package/dist/services/system-graph.js +164 -0
- package/dist/services/validate-dwv.d.ts +32 -0
- package/dist/services/validate-dwv.d.ts.map +1 -0
- package/dist/services/validate-dwv.js +118 -0
- package/dist/store/actions/node-actions.d.ts.map +1 -1
- package/dist/store/actions/node-actions.js +141 -4
- package/dist/store/history-control.d.ts +31 -0
- package/dist/store/history-control.d.ts.map +1 -1
- package/dist/store/history-control.js +130 -0
- 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 +47 -3
- package/dist/store/use-scene.d.ts.map +1 -1
- package/dist/store/use-scene.js +992 -55
- 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/fence/fence-centerline.d.ts +12 -0
- package/dist/systems/fence/fence-centerline.d.ts.map +1 -0
- package/dist/systems/fence/fence-centerline.js +37 -0
- package/dist/systems/fence/fence-spline.d.ts +39 -0
- package/dist/systems/fence/fence-spline.d.ts.map +1 -0
- package/dist/systems/fence/fence-spline.js +196 -0
- 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 +137 -0
- package/dist/systems/slab/slab-support.d.ts.map +1 -0
- package/dist/systems/slab/slab-support.js +557 -0
- package/dist/systems/stair/stair-footprint.d.ts.map +1 -1
- package/dist/systems/stair/stair-footprint.js +21 -11
- package/dist/systems/stair/stair-opening-preview.d.ts +1300 -505
- 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 +19 -33
- 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.d.ts.map +1 -1
- package/dist/systems/wall/wall-mitering.js +44 -8
- 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 +1 -0
- package/dist/utils/clone-scene-graph.d.ts.map +1 -1
- package/dist/utils/clone-scene-graph.js +56 -5
- package/dist/utils/heal-scene-graph.d.ts +18 -0
- package/dist/utils/heal-scene-graph.d.ts.map +1 -0
- package/dist/utils/heal-scene-graph.js +106 -0
- package/dist/validation/validate-build-json.d.ts +3 -0
- package/dist/validation/validate-build-json.d.ts.map +1 -1
- package/dist/validation/validate-build-json.js +90 -5
- package/package.json +4 -4
- 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 -273
- 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 -77
- 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 -183
- 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 -133
- 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/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 -199
- 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/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 -95
- 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/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/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/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 -446
- 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 -59
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { ROOF_SHAPE_DEFAULTS } from './roof-segment';
|
|
2
|
+
export function getRoofShapeRatios(input) {
|
|
3
|
+
return {
|
|
4
|
+
gambrelLowerWidthRatio: input.gambrelLowerWidthRatio ?? ROOF_SHAPE_DEFAULTS.gambrelLowerWidthRatio,
|
|
5
|
+
mansardSteepWidthRatio: input.mansardSteepWidthRatio ?? ROOF_SHAPE_DEFAULTS.mansardSteepWidthRatio,
|
|
6
|
+
dutchHipWidthRatio: input.dutchHipWidthRatio ?? ROOF_SHAPE_DEFAULTS.dutchHipWidthRatio,
|
|
7
|
+
dutchHipHeightRatio: input.dutchHipHeightRatio ?? ROOF_SHAPE_DEFAULTS.dutchHipHeightRatio,
|
|
8
|
+
dutchWaistLengthRatio: input.dutchWaistLengthRatio ?? ROOF_SHAPE_DEFAULTS.dutchWaistLengthRatio,
|
|
9
|
+
dutchGabletRake: input.dutchGabletRake ?? ROOF_SHAPE_DEFAULTS.dutchGabletRake,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export function getDutchRoofShapeMetrics(input) {
|
|
13
|
+
const fallbackInset = Math.min(input.baseW, input.baseD) * input.shapeRatios.dutchHipWidthRatio;
|
|
14
|
+
const maxI = Math.max(0, Math.min(input.w, input.d) / 2 - 0.005);
|
|
15
|
+
const inset = Math.min(Math.max(0, input.dutchI ?? fallbackInset), maxI);
|
|
16
|
+
const peakHeight = input.wh + Math.max(0.001, input.rh);
|
|
17
|
+
const middleHeight = input.wh + input.rh * input.shapeRatios.dutchHipHeightRatio;
|
|
18
|
+
if (!(inset > 0.001) || !(peakHeight > middleHeight + 0.001))
|
|
19
|
+
return null;
|
|
20
|
+
if (input.w >= input.d) {
|
|
21
|
+
const innerWaistHalfX = Math.max(0, (input.w / 2 - inset) * input.shapeRatios.dutchWaistLengthRatio);
|
|
22
|
+
const innerWaistHalfZ = Math.max(0, input.d / 2 - inset);
|
|
23
|
+
if (!(innerWaistHalfX > 0.001 && innerWaistHalfZ > 0.001))
|
|
24
|
+
return null;
|
|
25
|
+
const rakeReach = Math.min(Math.max(0, input.shapeRatios.dutchGabletRake), Math.max(0, input.w / 2 - innerWaistHalfX) * 0.98);
|
|
26
|
+
return {
|
|
27
|
+
axis: 'width',
|
|
28
|
+
inset,
|
|
29
|
+
middleHeight,
|
|
30
|
+
peakHeight,
|
|
31
|
+
rakeReach,
|
|
32
|
+
innerWaistHalfX,
|
|
33
|
+
innerWaistHalfZ,
|
|
34
|
+
outerWaistHalfX: innerWaistHalfX + rakeReach,
|
|
35
|
+
outerWaistHalfZ: innerWaistHalfZ,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const innerWaistHalfX = Math.max(0, input.w / 2 - inset);
|
|
39
|
+
const innerWaistHalfZ = Math.max(0, (input.d / 2 - inset) * input.shapeRatios.dutchWaistLengthRatio);
|
|
40
|
+
if (!(innerWaistHalfX > 0.001 && innerWaistHalfZ > 0.001))
|
|
41
|
+
return null;
|
|
42
|
+
const rakeReach = Math.min(Math.max(0, input.shapeRatios.dutchGabletRake), Math.max(0, input.d / 2 - innerWaistHalfZ) * 0.98);
|
|
43
|
+
return {
|
|
44
|
+
axis: 'depth',
|
|
45
|
+
inset,
|
|
46
|
+
middleHeight,
|
|
47
|
+
peakHeight,
|
|
48
|
+
rakeReach,
|
|
49
|
+
innerWaistHalfX,
|
|
50
|
+
innerWaistHalfZ,
|
|
51
|
+
outerWaistHalfX: innerWaistHalfX,
|
|
52
|
+
outerWaistHalfZ: innerWaistHalfZ + rakeReach,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function getRoofShapeInsets(input) {
|
|
56
|
+
let inset = (input.wh - input.baseY) * input.tanTheta;
|
|
57
|
+
const maxSafeInset = Math.min(input.brushW, input.brushD) / 2 - 0.005;
|
|
58
|
+
if (inset > maxSafeInset)
|
|
59
|
+
inset = maxSafeInset;
|
|
60
|
+
let iF = 0;
|
|
61
|
+
let iB = 0;
|
|
62
|
+
let iL = 0;
|
|
63
|
+
let iR = 0;
|
|
64
|
+
if (input.roofType === 'hip' || input.roofType === 'mansard' || input.roofType === 'dutch') {
|
|
65
|
+
iF = inset;
|
|
66
|
+
iB = inset;
|
|
67
|
+
iL = inset;
|
|
68
|
+
iR = inset;
|
|
69
|
+
}
|
|
70
|
+
else if (input.roofType === 'gable' || input.roofType === 'gambrel') {
|
|
71
|
+
iF = inset;
|
|
72
|
+
iB = inset;
|
|
73
|
+
}
|
|
74
|
+
else if (input.roofType === 'shed') {
|
|
75
|
+
iF = inset;
|
|
76
|
+
}
|
|
77
|
+
let dutchI = Math.min(input.width, input.depth) * input.dutchHipWidthRatio;
|
|
78
|
+
if (input.isVoid)
|
|
79
|
+
dutchI += input.shingleThickness;
|
|
80
|
+
return { iF, iB, iL, iR, dutchI };
|
|
81
|
+
}
|
|
82
|
+
export function getDutchEndSlopeFaces(input) {
|
|
83
|
+
const dutch = getDutchRoofShapeMetrics({
|
|
84
|
+
w: input.w,
|
|
85
|
+
d: input.d,
|
|
86
|
+
wh: input.wh,
|
|
87
|
+
rh: input.rh,
|
|
88
|
+
dutchI: input.insets.dutchI,
|
|
89
|
+
baseW: input.baseW,
|
|
90
|
+
baseD: input.baseD,
|
|
91
|
+
shapeRatios: input.shapeRatios,
|
|
92
|
+
});
|
|
93
|
+
if (!dutch)
|
|
94
|
+
return [];
|
|
95
|
+
const v = (x, y, z) => ({ x, y, z });
|
|
96
|
+
const e1 = v(-input.w / 2, input.wh, input.d / 2);
|
|
97
|
+
const e2 = v(input.w / 2, input.wh, input.d / 2);
|
|
98
|
+
const e3 = v(input.w / 2, input.wh, -input.d / 2);
|
|
99
|
+
const e4 = v(-input.w / 2, input.wh, -input.d / 2);
|
|
100
|
+
// The hip end slope is constructed only up to the outer waist (rake) line.
|
|
101
|
+
// Extend its top edge inward along the same hip rulings until it reaches the
|
|
102
|
+
// gablet's inner triangle (the inner waist line), continuing each
|
|
103
|
+
// eave→outer-waist ridge line so the face stays planar and the pitch is
|
|
104
|
+
// unchanged — the edge climbs past middleHeight and meets the gablet face.
|
|
105
|
+
const lerp = (a, b, t) => v(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t);
|
|
106
|
+
const lowerAlongY = (point) => v(point.x, point.y - Math.max(0, input.dutchTopRakeThickness ?? 0), point.z);
|
|
107
|
+
if (dutch.axis === 'width') {
|
|
108
|
+
const o1 = v(-dutch.outerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
109
|
+
const o2 = v(dutch.outerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
110
|
+
const o3 = v(dutch.outerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
111
|
+
const o4 = v(-dutch.outerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
112
|
+
const m1 = v(-dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
113
|
+
const m2 = v(dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
114
|
+
const m3 = v(dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
115
|
+
const m4 = v(-dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
116
|
+
const r1 = v(-dutch.innerWaistHalfX, input.wh + input.rh, 0);
|
|
117
|
+
const r2 = v(dutch.innerWaistHalfX, input.wh + input.rh, 0);
|
|
118
|
+
const projectWidthAxisPointToEndSlope = (point, side) => {
|
|
119
|
+
const denomY = dutch.middleHeight - input.wh;
|
|
120
|
+
const tPlane = Math.abs(denomY) > 1e-9 ? (point.y - input.wh) / denomY : 0;
|
|
121
|
+
const x = side * (input.w / 2 + (dutch.outerWaistHalfX - input.w / 2) * tPlane);
|
|
122
|
+
return v(x, point.y, point.z);
|
|
123
|
+
};
|
|
124
|
+
const top2 = projectWidthAxisPointToEndSlope(lowerAlongY(lerp(m2, r2, 0.5)), 1);
|
|
125
|
+
const top3 = projectWidthAxisPointToEndSlope(lowerAlongY(lerp(m3, r2, 0.5)), 1);
|
|
126
|
+
const top1 = projectWidthAxisPointToEndSlope(lowerAlongY(lerp(m1, r1, 0.5)), -1);
|
|
127
|
+
const top4 = projectWidthAxisPointToEndSlope(lowerAlongY(lerp(m4, r1, 0.5)), -1);
|
|
128
|
+
return [
|
|
129
|
+
[e2, e3, o3, top3, top2, o2],
|
|
130
|
+
[e4, e1, o1, top1, top4, o4],
|
|
131
|
+
];
|
|
132
|
+
}
|
|
133
|
+
const o1 = v(-dutch.innerWaistHalfX, dutch.middleHeight, dutch.outerWaistHalfZ);
|
|
134
|
+
const o2 = v(dutch.innerWaistHalfX, dutch.middleHeight, dutch.outerWaistHalfZ);
|
|
135
|
+
const o3 = v(dutch.innerWaistHalfX, dutch.middleHeight, -dutch.outerWaistHalfZ);
|
|
136
|
+
const o4 = v(-dutch.innerWaistHalfX, dutch.middleHeight, -dutch.outerWaistHalfZ);
|
|
137
|
+
const m1 = v(-dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
138
|
+
const m2 = v(dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
139
|
+
const m3 = v(dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
140
|
+
const m4 = v(-dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
141
|
+
const r1 = v(0, input.wh + input.rh, dutch.innerWaistHalfZ);
|
|
142
|
+
const r2 = v(0, input.wh + input.rh, -dutch.innerWaistHalfZ);
|
|
143
|
+
const projectDepthAxisPointToEndSlope = (point, side) => {
|
|
144
|
+
const denomY = dutch.middleHeight - input.wh;
|
|
145
|
+
const tPlane = Math.abs(denomY) > 1e-9 ? (point.y - input.wh) / denomY : 0;
|
|
146
|
+
const z = side * (input.d / 2 + (dutch.outerWaistHalfZ - input.d / 2) * tPlane);
|
|
147
|
+
return v(point.x, point.y, z);
|
|
148
|
+
};
|
|
149
|
+
const top2 = projectDepthAxisPointToEndSlope(lowerAlongY(lerp(m2, r1, 0.5)), 1);
|
|
150
|
+
const top1 = projectDepthAxisPointToEndSlope(lowerAlongY(lerp(m1, r1, 0.5)), 1);
|
|
151
|
+
const top4 = projectDepthAxisPointToEndSlope(lowerAlongY(lerp(m4, r2, 0.5)), -1);
|
|
152
|
+
const top3 = projectDepthAxisPointToEndSlope(lowerAlongY(lerp(m3, r2, 0.5)), -1);
|
|
153
|
+
return [
|
|
154
|
+
[e1, e2, o2, top2, top1, o1],
|
|
155
|
+
[e3, e4, o4, top4, top3, o3],
|
|
156
|
+
];
|
|
157
|
+
}
|
|
158
|
+
export function getRoofModuleFaces(input) {
|
|
159
|
+
const v = (x, y, z) => ({ x, y, z });
|
|
160
|
+
const { iF = 0, iB = 0, iL = 0, iR = 0 } = input.insets;
|
|
161
|
+
const b1 = v(-input.w / 2 + iL, input.baseY, input.d / 2 - iF);
|
|
162
|
+
const b2 = v(input.w / 2 - iR, input.baseY, input.d / 2 - iF);
|
|
163
|
+
const b3 = v(input.w / 2 - iR, input.baseY, -input.d / 2 + iB);
|
|
164
|
+
const b4 = v(-input.w / 2 + iL, input.baseY, -input.d / 2 + iB);
|
|
165
|
+
const bottom = [b4, b3, b2, b1];
|
|
166
|
+
const e1 = v(-input.w / 2, input.wh, input.d / 2);
|
|
167
|
+
const e2 = v(input.w / 2, input.wh, input.d / 2);
|
|
168
|
+
const e3 = v(input.w / 2, input.wh, -input.d / 2);
|
|
169
|
+
const e4 = v(-input.w / 2, input.wh, -input.d / 2);
|
|
170
|
+
const faces = [];
|
|
171
|
+
faces.push([b1, b2, e2, e1], [b2, b3, e3, e2], [b3, b4, e4, e3], [b4, b1, e1, e4], bottom);
|
|
172
|
+
const h = input.wh + Math.max(0.001, input.rh);
|
|
173
|
+
if (input.type === 'flat' || input.rh === 0) {
|
|
174
|
+
faces.push([e1, e2, e3, e4]);
|
|
175
|
+
}
|
|
176
|
+
else if (input.type === 'gable') {
|
|
177
|
+
const r1 = v(-input.w / 2, h, 0);
|
|
178
|
+
const r2 = v(input.w / 2, h, 0);
|
|
179
|
+
faces.push([e4, e1, r1], [e2, e3, r2], [e1, e2, r2, r1], [e3, e4, r1, r2]);
|
|
180
|
+
}
|
|
181
|
+
else if (input.type === 'hip') {
|
|
182
|
+
if (Math.abs(input.w - input.d) < 0.01) {
|
|
183
|
+
const r = v(0, h, 0);
|
|
184
|
+
faces.push([e4, e1, r], [e1, e2, r], [e2, e3, r], [e3, e4, r]);
|
|
185
|
+
}
|
|
186
|
+
else if (input.w >= input.d) {
|
|
187
|
+
const r1 = v(-input.w / 2 + input.d / 2, h, 0);
|
|
188
|
+
const r2 = v(input.w / 2 - input.d / 2, h, 0);
|
|
189
|
+
faces.push([e4, e1, r1], [e2, e3, r2], [e1, e2, r2, r1], [e3, e4, r1, r2]);
|
|
190
|
+
}
|
|
191
|
+
else {
|
|
192
|
+
const r1 = v(0, h, input.d / 2 - input.w / 2);
|
|
193
|
+
const r2 = v(0, h, -input.d / 2 + input.w / 2);
|
|
194
|
+
faces.push([e1, e2, r1], [e3, e4, r2], [e2, e3, r2, r1], [e4, e1, r1, r2]);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
else if (input.type === 'shed') {
|
|
198
|
+
const t1 = v(-input.w / 2, h, -input.d / 2);
|
|
199
|
+
const t2 = v(input.w / 2, h, -input.d / 2);
|
|
200
|
+
faces.push([e1, e2, t2, t1], [e2, e3, t2], [e3, e4, t1, t2], [e4, e1, t1]);
|
|
201
|
+
}
|
|
202
|
+
else if (input.type === 'gambrel') {
|
|
203
|
+
const mz = (input.baseD / 2) * input.shapeRatios.gambrelLowerWidthRatio;
|
|
204
|
+
const dist = input.d / 2 - mz;
|
|
205
|
+
const mh = input.wh + dist * (input.tanTheta || 0);
|
|
206
|
+
const m1 = v(-input.w / 2, mh, mz);
|
|
207
|
+
const m2 = v(input.w / 2, mh, mz);
|
|
208
|
+
const m3 = v(input.w / 2, mh, -mz);
|
|
209
|
+
const m4 = v(-input.w / 2, mh, -mz);
|
|
210
|
+
const r1 = v(-input.w / 2, h, 0);
|
|
211
|
+
const r2 = v(input.w / 2, h, 0);
|
|
212
|
+
faces.push([e4, e1, m1, r1, m4], [e2, e3, m3, r2, m2], [e1, e2, m2, m1], [m1, m2, r2, r1], [e3, e4, m4, m3], [m3, m4, r1, r2]);
|
|
213
|
+
}
|
|
214
|
+
else if (input.type === 'mansard') {
|
|
215
|
+
const i = Math.min(input.baseW, input.baseD) * input.shapeRatios.mansardSteepWidthRatio;
|
|
216
|
+
const mh = input.wh + i * (input.tanTheta || 0);
|
|
217
|
+
const m1 = v(-input.w / 2 + i, mh, input.d / 2 - i);
|
|
218
|
+
const m2 = v(input.w / 2 - i, mh, input.d / 2 - i);
|
|
219
|
+
const m3 = v(input.w / 2 - i, mh, -input.d / 2 + i);
|
|
220
|
+
const m4 = v(-input.w / 2 + i, mh, -input.d / 2 + i);
|
|
221
|
+
const topW = input.w - i * 2;
|
|
222
|
+
const topD = input.d - i * 2;
|
|
223
|
+
faces.push([e1, e2, m2, m1], [e2, e3, m3, m2], [e3, e4, m4, m3], [e4, e1, m1, m4]);
|
|
224
|
+
if (Math.abs(topW - topD) < 0.01) {
|
|
225
|
+
const r = v(0, h, 0);
|
|
226
|
+
faces.push([m4, m1, r], [m1, m2, r], [m2, m3, r], [m3, m4, r]);
|
|
227
|
+
}
|
|
228
|
+
else if (topW >= topD) {
|
|
229
|
+
const r1 = v(-topW / 2 + topD / 2, h, 0);
|
|
230
|
+
const r2 = v(topW / 2 - topD / 2, h, 0);
|
|
231
|
+
faces.push([m4, m1, r1], [m2, m3, r2], [m1, m2, r2, r1], [m3, m4, r1, r2]);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
const r1 = v(0, h, topD / 2 - topW / 2);
|
|
235
|
+
const r2 = v(0, h, -topD / 2 + topW / 2);
|
|
236
|
+
faces.push([m1, m2, r1], [m3, m4, r2], [m2, m3, r2, r1], [m4, m1, r1, r2]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
else if (input.type === 'dutch') {
|
|
240
|
+
const dutch = getDutchRoofShapeMetrics({
|
|
241
|
+
w: input.w,
|
|
242
|
+
d: input.d,
|
|
243
|
+
wh: input.wh,
|
|
244
|
+
rh: input.rh,
|
|
245
|
+
dutchI: input.insets.dutchI,
|
|
246
|
+
baseW: input.baseW,
|
|
247
|
+
baseD: input.baseD,
|
|
248
|
+
shapeRatios: input.shapeRatios,
|
|
249
|
+
});
|
|
250
|
+
if (!dutch)
|
|
251
|
+
return faces;
|
|
252
|
+
const m1 = v(-dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
253
|
+
const m2 = v(dutch.innerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
254
|
+
const m3 = v(dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
255
|
+
const m4 = v(-dutch.innerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
256
|
+
if (dutch.axis === 'width') {
|
|
257
|
+
const o1 = v(-dutch.outerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
258
|
+
const o2 = v(dutch.outerWaistHalfX, dutch.middleHeight, dutch.innerWaistHalfZ);
|
|
259
|
+
const o3 = v(dutch.outerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
260
|
+
const o4 = v(-dutch.outerWaistHalfX, dutch.middleHeight, -dutch.innerWaistHalfZ);
|
|
261
|
+
const r1 = v(-dutch.innerWaistHalfX, h, 0);
|
|
262
|
+
const r2 = v(dutch.innerWaistHalfX, h, 0);
|
|
263
|
+
const endSlopes = input.excludeDutchEndSlopes
|
|
264
|
+
? []
|
|
265
|
+
: getDutchEndSlopeFaces({
|
|
266
|
+
w: input.w,
|
|
267
|
+
d: input.d,
|
|
268
|
+
wh: input.wh,
|
|
269
|
+
rh: input.rh,
|
|
270
|
+
insets: input.insets,
|
|
271
|
+
baseW: input.baseW,
|
|
272
|
+
baseD: input.baseD,
|
|
273
|
+
shapeRatios: input.shapeRatios,
|
|
274
|
+
dutchTopRakeThickness: input.dutchTopRakeThickness,
|
|
275
|
+
});
|
|
276
|
+
faces.push([e1, e2, o2, m2, m1, o1], [e3, e4, o4, m4, m3, o3]);
|
|
277
|
+
if (endSlopes.length === 2) {
|
|
278
|
+
faces.push(...endSlopes);
|
|
279
|
+
}
|
|
280
|
+
else if (!input.excludeDutchEndSlopes) {
|
|
281
|
+
faces.push([e2, e3, o3, o2], [e4, e1, o1, o4]);
|
|
282
|
+
}
|
|
283
|
+
faces.push([m1, m2, r2, r1], [m3, m4, r1, r2]);
|
|
284
|
+
faces.push([m4, m1, r1], [m2, m3, r2]);
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
const o1 = v(-dutch.innerWaistHalfX, dutch.middleHeight, dutch.outerWaistHalfZ);
|
|
288
|
+
const o2 = v(dutch.innerWaistHalfX, dutch.middleHeight, dutch.outerWaistHalfZ);
|
|
289
|
+
const o3 = v(dutch.innerWaistHalfX, dutch.middleHeight, -dutch.outerWaistHalfZ);
|
|
290
|
+
const o4 = v(-dutch.innerWaistHalfX, dutch.middleHeight, -dutch.outerWaistHalfZ);
|
|
291
|
+
const r1 = v(0, h, dutch.innerWaistHalfZ);
|
|
292
|
+
const r2 = v(0, h, -dutch.innerWaistHalfZ);
|
|
293
|
+
const endSlopes = input.excludeDutchEndSlopes
|
|
294
|
+
? []
|
|
295
|
+
: getDutchEndSlopeFaces({
|
|
296
|
+
w: input.w,
|
|
297
|
+
d: input.d,
|
|
298
|
+
wh: input.wh,
|
|
299
|
+
rh: input.rh,
|
|
300
|
+
insets: input.insets,
|
|
301
|
+
baseW: input.baseW,
|
|
302
|
+
baseD: input.baseD,
|
|
303
|
+
shapeRatios: input.shapeRatios,
|
|
304
|
+
dutchTopRakeThickness: input.dutchTopRakeThickness,
|
|
305
|
+
});
|
|
306
|
+
faces.push([e2, e3, o3, m3, m2, o2], [e4, e1, o1, m1, m4, o4]);
|
|
307
|
+
if (endSlopes.length === 2) {
|
|
308
|
+
faces.push(...endSlopes);
|
|
309
|
+
}
|
|
310
|
+
else if (!input.excludeDutchEndSlopes) {
|
|
311
|
+
faces.push([e1, e2, o2, o1], [e3, e4, o4, o3]);
|
|
312
|
+
}
|
|
313
|
+
faces.push([m2, m3, r2, r1], [m4, m1, r1, r2]);
|
|
314
|
+
faces.push([m1, m2, r1], [m3, m4, r2]);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
return faces;
|
|
318
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type { RoofSegmentNode } from './roof-segment';
|
|
2
|
+
/**
|
|
3
|
+
* Wall-face math for roof segments — the vertical surfaces a wall-mounted
|
|
4
|
+
* opening (door / window) can attach to. A segment's generated volume has
|
|
5
|
+
* four vertical faces; on gable-family roofs the end faces extend past the
|
|
6
|
+
* eave line into the gable (rect + triangle/pentagon, coplanar with the
|
|
7
|
+
* base wall). These helpers describe each face as a 2D frame
|
|
8
|
+
* (`u` along the face, `v` height above the segment base) plus the
|
|
9
|
+
* placeable profile polygon, so placement tools, renderers, and CSG cut
|
|
10
|
+
* builders all share one definition of "the wall under the roof".
|
|
11
|
+
*
|
|
12
|
+
* The numbers MUST mirror the outer wall volume built by
|
|
13
|
+
* `getRoofSegmentBrushes` in the viewer's roof system
|
|
14
|
+
* (`getVol(wallThickness / 2, 0, 0, …)`): the volume is the segment
|
|
15
|
+
* footprint extended outward by `wallThickness / 2`, which drops the eave
|
|
16
|
+
* line by `(wallThickness / 2) · tanθ` and raises the ridge by the same
|
|
17
|
+
* amount so the apex stays at `wallHeight + activeRh`.
|
|
18
|
+
*/
|
|
19
|
+
export type RoofWallFaceId = 'front' | 'back' | 'right' | 'left';
|
|
20
|
+
export type RoofSegmentWallFace = {
|
|
21
|
+
id: RoofWallFaceId;
|
|
22
|
+
/** Outward normal in segment-local space. */
|
|
23
|
+
normal: [number, number, number];
|
|
24
|
+
/**
|
|
25
|
+
* Yaw (radians, rotation-y) mapping opening-local +Z to the outward
|
|
26
|
+
* normal and opening-local +X to the face's +U direction — the same
|
|
27
|
+
* frame a wall-hosted door/window uses relative to its wall mesh.
|
|
28
|
+
*/
|
|
29
|
+
yaw: number;
|
|
30
|
+
/** Face length along U. */
|
|
31
|
+
length: number;
|
|
32
|
+
/**
|
|
33
|
+
* Placeable region, CCW polygon in face coords. `u ∈ [0, length]`,
|
|
34
|
+
* `v` is height above the segment base (segment-local Y).
|
|
35
|
+
*/
|
|
36
|
+
profile: [number, number][];
|
|
37
|
+
};
|
|
38
|
+
type SegmentWallInputs = Pick<RoofSegmentNode, 'roofType' | 'width' | 'depth' | 'wallHeight' | 'wallThickness' | 'pitch'> & Partial<Pick<RoofSegmentNode, 'gambrelLowerWidthRatio' | 'gambrelLowerHeightRatio' | 'mansardSteepWidthRatio' | 'mansardSteepHeightRatio' | 'dutchHipWidthRatio' | 'dutchHipHeightRatio' | 'dutchWaistLengthRatio'>>;
|
|
39
|
+
export declare function getRoofSegmentWallFace(node: SegmentWallInputs, id: RoofWallFaceId): RoofSegmentWallFace;
|
|
40
|
+
export declare function getRoofSegmentWallFaces(node: SegmentWallInputs): RoofSegmentWallFace[];
|
|
41
|
+
/**
|
|
42
|
+
* Segment-local point → face coords. `dist` is the signed offset off the
|
|
43
|
+
* outer wall plane along the face normal (0 = on the plane, positive =
|
|
44
|
+
* outside the volume).
|
|
45
|
+
*/
|
|
46
|
+
export declare function segmentPointToRoofWallFace(node: SegmentWallInputs, id: RoofWallFaceId, point: [number, number, number]): {
|
|
47
|
+
u: number;
|
|
48
|
+
v: number;
|
|
49
|
+
dist: number;
|
|
50
|
+
};
|
|
51
|
+
/**
|
|
52
|
+
* The face's render frame in segment-local space: a group placed at
|
|
53
|
+
* `origin` and yawed by `yaw` maps face coords to segment space —
|
|
54
|
+
* frame X = U (along the face), frame Y = V (height), frame Z = the
|
|
55
|
+
* outward normal, with z = 0 on the WALL MID-PLANE. The mid-plane of
|
|
56
|
+
* the generated wall volume lands exactly on the nominal footprint
|
|
57
|
+
* (`±width/2` / `±depth/2`), so hosted children use the same position
|
|
58
|
+
* conventions as wall children (openings at z = 0, wall-side items
|
|
59
|
+
* pushed +thickness/2 at render time). Renderers derive this from the
|
|
60
|
+
* live-override-merged segment, which is what makes hosted children
|
|
61
|
+
* track segment edits live instead of jumping on commit.
|
|
62
|
+
*/
|
|
63
|
+
export declare function getRoofWallFaceFrame(node: SegmentWallInputs, id: RoofWallFaceId): {
|
|
64
|
+
origin: [number, number, number];
|
|
65
|
+
yaw: number;
|
|
66
|
+
};
|
|
67
|
+
/** Face-frame point ([u, v, z-from-mid-plane]) → segment-local point. */
|
|
68
|
+
export declare function roofFacePointToSegment(node: SegmentWallInputs, id: RoofWallFaceId, point: [number, number, number]): [number, number, number];
|
|
69
|
+
/**
|
|
70
|
+
* Max width of a rect growing from an anchored vertical edge (`anchorU`)
|
|
71
|
+
* in direction `growSign` (±1 along U) while staying inside the face
|
|
72
|
+
* profile at the fixed vertical center `vCenter`. Resize-handle limit:
|
|
73
|
+
* the anchored-edge model matches the handles' apply math (opposite
|
|
74
|
+
* edge stays put, center re-derives).
|
|
75
|
+
*/
|
|
76
|
+
export declare function getMaxRoofRectWidthFromAnchor(face: RoofSegmentWallFace, anchorU: number, growSign: number, vCenter: number, height: number): number;
|
|
77
|
+
/**
|
|
78
|
+
* Max height of a rect growing from an anchored horizontal edge
|
|
79
|
+
* (`anchorV`) in direction `growSign` (+1 = bottom anchored, grows up)
|
|
80
|
+
* while staying inside the face profile at the fixed horizontal center
|
|
81
|
+
* `uCenter`.
|
|
82
|
+
*/
|
|
83
|
+
export declare function getMaxRoofRectHeightFromAnchor(face: RoofSegmentWallFace, uCenter: number, width: number, anchorV: number, growSign: number): number;
|
|
84
|
+
/**
|
|
85
|
+
* Clamp a rect center so the rect fits inside the face profile.
|
|
86
|
+
*
|
|
87
|
+
* - `lockV: true` (doors): `v` is fixed; only `u` slides. Returns null
|
|
88
|
+
* when no `u` keeps the rect inside at that height.
|
|
89
|
+
* - otherwise (windows): the center is projected into the eroded convex
|
|
90
|
+
* region (cyclic projection — profiles are convex by construction).
|
|
91
|
+
*
|
|
92
|
+
* Returns null when the rect cannot fit anywhere on the face.
|
|
93
|
+
*/
|
|
94
|
+
export declare function clampRectToRoofWallFace(face: RoofSegmentWallFace, u: number, v: number, width: number, height: number, opts?: {
|
|
95
|
+
lockV?: boolean;
|
|
96
|
+
}): {
|
|
97
|
+
u: number;
|
|
98
|
+
v: number;
|
|
99
|
+
} | null;
|
|
100
|
+
export {};
|
|
101
|
+
//# sourceMappingURL=roof-segment-walls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roof-segment-walls.d.ts","sourceRoot":"","sources":["../../../src/schema/nodes/roof-segment-walls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGrD;;;;;;;;;;;;;;;;GAgBG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAA;AAEhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,cAAc,CAAA;IAClB,6CAA6C;IAC7C,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAA;IACX,2BAA2B;IAC3B,MAAM,EAAE,MAAM,CAAA;IACd;;;OAGG;IACH,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC5B,CAAA;AAED,KAAK,iBAAiB,GAAG,IAAI,CAC3B,eAAe,EACf,UAAU,GAAG,OAAO,GAAG,OAAO,GAAG,YAAY,GAAG,eAAe,GAAG,OAAO,CAC1E,GACC,OAAO,CACL,IAAI,CACF,eAAe,EACb,wBAAwB,GACxB,yBAAyB,GACzB,wBAAwB,GACxB,yBAAyB,GACzB,oBAAoB,GACpB,qBAAqB,GACrB,uBAAuB,CAC1B,CACF,CAAA;AAqJH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,cAAc,GACjB,mBAAmB,CAUrB;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,iBAAiB,GAAG,mBAAmB,EAAE,CAStF;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,cAAc,EAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC9B;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAaxC;AA+CD;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,cAAc,GACjB;IAAE,MAAM,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAYnD;AAED,yEAAyE;AACzE,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,iBAAiB,EACvB,EAAE,EAAE,cAAc,EAClB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAC9B,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAO1B;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,MAAM,CAWR;AAED;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,IAAI,EAAE,mBAAmB,EACzB,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,MAAM,CASR;AAID;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,mBAAmB,EACzB,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GACzB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAwCjC"}
|