@hatiolab/figure-model 0.1.92 → 0.1.94
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/CHANGELOG.md +12 -12
- package/README.md +25 -25
- package/dist/{v3-asset-types.d.ts → asset-types.d.ts} +73 -67
- package/dist/asset-types.d.ts.map +1 -0
- package/dist/asset-types.js +2 -0
- package/dist/asset-types.js.map +1 -0
- package/dist/asset.d.ts +20 -0
- package/dist/asset.d.ts.map +1 -0
- package/dist/{v3-asset.js → asset.js} +49 -28
- package/dist/asset.js.map +1 -0
- package/dist/{v3-authoring-actions.d.ts → authoring-actions.d.ts} +77 -66
- package/dist/authoring-actions.d.ts.map +1 -0
- package/dist/{v3-authoring-actions.js → authoring-actions.js} +129 -104
- package/dist/authoring-actions.js.map +1 -0
- package/dist/{v3-authoring-session.d.ts → authoring-session.d.ts} +23 -21
- package/dist/authoring-session.d.ts.map +1 -0
- package/dist/{v3-authoring-session.js → authoring-session.js} +4 -4
- package/dist/authoring-session.js.map +1 -0
- package/dist/capabilities.d.ts +3 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/{v3-capabilities.js → capabilities.js} +8 -8
- package/dist/capabilities.js.map +1 -0
- package/dist/clip-keeping.d.ts +30 -0
- package/dist/clip-keeping.d.ts.map +1 -0
- package/dist/clip-keeping.js +77 -0
- package/dist/clip-keeping.js.map +1 -0
- package/dist/command-preview.d.ts +125 -0
- package/dist/command-preview.d.ts.map +1 -0
- package/dist/command-preview.js +246 -0
- package/dist/command-preview.js.map +1 -0
- package/dist/contract.d.ts +7 -0
- package/dist/contract.d.ts.map +1 -0
- package/dist/contract.js +12 -0
- package/dist/contract.js.map +1 -0
- package/dist/{v3-cost.d.ts → cost.d.ts} +5 -5
- package/dist/cost.d.ts.map +1 -0
- package/dist/{v3-cost.js → cost.js} +11 -11
- package/dist/cost.js.map +1 -0
- package/dist/{v3-create.d.ts → create.d.ts} +8 -8
- package/dist/{v3-create.d.ts.map → create.d.ts.map} +1 -1
- package/dist/{v3-create.js → create.js} +26 -26
- package/dist/create.js.map +1 -0
- package/dist/document.d.ts +5 -0
- package/dist/document.d.ts.map +1 -0
- package/dist/document.js +31 -0
- package/dist/document.js.map +1 -0
- package/dist/{v3-driver.d.ts → driver.d.ts} +10 -10
- package/dist/driver.d.ts.map +1 -0
- package/dist/{v3-driver.js → driver.js} +10 -10
- package/dist/driver.js.map +1 -0
- package/dist/{v3-editor-workspace.d.ts → editor-workspace.d.ts} +99 -73
- package/dist/editor-workspace.d.ts.map +1 -0
- package/dist/{v3-editor-workspace.js → editor-workspace.js} +48 -32
- package/dist/editor-workspace.js.map +1 -0
- package/dist/{v3-examples.d.ts → examples.d.ts} +5 -5
- package/dist/examples.d.ts.map +1 -0
- package/dist/{v3-examples.js → examples.js} +11 -11
- package/dist/examples.js.map +1 -0
- package/dist/{v3-follow.d.ts → follow.d.ts} +5 -5
- package/dist/follow.d.ts.map +1 -0
- package/dist/{v3-follow.js → follow.js} +2 -2
- package/dist/follow.js.map +1 -0
- package/dist/{v3-gate.d.ts → gate.d.ts} +36 -28
- package/dist/gate.d.ts.map +1 -0
- package/dist/{v3-gate.js → gate.js} +54 -48
- package/dist/gate.js.map +1 -0
- package/dist/{v3-graph-types.d.ts → graph-types.d.ts} +33 -33
- package/dist/graph-types.d.ts.map +1 -0
- package/dist/graph-types.js +2 -0
- package/dist/graph-types.js.map +1 -0
- package/dist/{v3-graph.d.ts → graph.d.ts} +14 -14
- package/dist/graph.d.ts.map +1 -0
- package/dist/{v3-graph.js → graph.js} +16 -16
- package/dist/graph.js.map +1 -0
- package/dist/index.d.ts +39 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -33
- package/dist/index.js.map +1 -1
- package/dist/{v3-instance-size.d.ts → instance-size.d.ts} +14 -14
- package/dist/instance-size.d.ts.map +1 -0
- package/dist/{v3-instance-size.js → instance-size.js} +13 -13
- package/dist/instance-size.js.map +1 -0
- package/dist/json.d.ts +12 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/{v3-json.js → json.js} +13 -13
- package/dist/json.js.map +1 -0
- package/dist/kernel-version.d.ts +8 -0
- package/dist/kernel-version.d.ts.map +1 -0
- package/dist/{v3-kernel-version.js → kernel-version.js} +4 -4
- package/dist/kernel-version.js.map +1 -0
- package/dist/{v3-part-edit.d.ts → part-edit.d.ts} +12 -11
- package/dist/part-edit.d.ts.map +1 -0
- package/dist/{v3-part-edit.js → part-edit.js} +84 -68
- package/dist/part-edit.js.map +1 -0
- package/dist/proposal.d.ts +55 -0
- package/dist/proposal.d.ts.map +1 -0
- package/dist/{v3-proposal.js → proposal.js} +29 -21
- package/dist/proposal.js.map +1 -0
- package/dist/{v3-public-inputs.d.ts → public-inputs.d.ts} +4 -4
- package/dist/public-inputs.d.ts.map +1 -0
- package/dist/{v3-public-inputs.js → public-inputs.js} +3 -3
- package/dist/public-inputs.js.map +1 -0
- package/dist/recipe-build.d.ts +27 -0
- package/dist/recipe-build.d.ts.map +1 -0
- package/dist/{v3-recipe-build.js → recipe-build.js} +9 -9
- package/dist/recipe-build.js.map +1 -0
- package/dist/recipe-from-parts.d.ts +8 -0
- package/dist/recipe-from-parts.d.ts.map +1 -0
- package/dist/{v3-recipe-from-parts.js → recipe-from-parts.js} +9 -9
- package/dist/recipe-from-parts.js.map +1 -0
- package/dist/{v3-recipe.d.ts → recipe.d.ts} +25 -25
- package/dist/recipe.d.ts.map +1 -0
- package/dist/{v3-recipe.js → recipe.js} +30 -30
- package/dist/recipe.js.map +1 -0
- package/dist/release-contract.d.ts +19 -0
- package/dist/release-contract.d.ts.map +1 -0
- package/dist/{v3-release-contract.js → release-contract.js} +8 -7
- package/dist/release-contract.js.map +1 -0
- package/dist/{v3-render-batches.d.ts → render-batches.d.ts} +8 -8
- package/dist/render-batches.d.ts.map +1 -0
- package/dist/{v3-render-batches.js → render-batches.js} +4 -4
- package/dist/render-batches.js.map +1 -0
- package/dist/resize-plan.d.ts +61 -0
- package/dist/resize-plan.d.ts.map +1 -0
- package/dist/resize-plan.js +189 -0
- package/dist/resize-plan.js.map +1 -0
- package/dist/room.d.ts +53 -0
- package/dist/room.d.ts.map +1 -0
- package/dist/room.js +90 -0
- package/dist/room.js.map +1 -0
- package/dist/{v3-score.d.ts → score.d.ts} +19 -19
- package/dist/score.d.ts.map +1 -0
- package/dist/{v3-score.js → score.js} +32 -32
- package/dist/score.js.map +1 -0
- package/dist/shape-provider.d.ts +37 -0
- package/dist/shape-provider.d.ts.map +1 -0
- package/dist/shape-provider.js +69 -0
- package/dist/shape-provider.js.map +1 -0
- package/dist/{v3-shape-sampling.d.ts → shape-sampling.d.ts} +4 -4
- package/dist/shape-sampling.d.ts.map +1 -0
- package/dist/{v3-shape-sampling.js → shape-sampling.js} +3 -3
- package/dist/shape-sampling.js.map +1 -0
- package/dist/size-edit.d.ts +38 -0
- package/dist/size-edit.d.ts.map +1 -0
- package/dist/size-edit.js +178 -0
- package/dist/size-edit.js.map +1 -0
- package/dist/{v3-surface.d.ts → surface.d.ts} +5 -5
- package/dist/surface.d.ts.map +1 -0
- package/dist/{v3-surface.js → surface.js} +7 -7
- package/dist/surface.js.map +1 -0
- package/dist/{v3-words.d.ts → words.d.ts} +3 -3
- package/dist/words.d.ts.map +1 -0
- package/dist/{v3-words.js → words.js} +3 -3
- package/dist/words.js.map +1 -0
- package/docs/{assembly-constraints-v3.md → assembly-constraints.md} +1 -1
- package/docs/{v3-asset-persistence.md → asset-persistence.md} +8 -8
- package/docs/{v3-authoring-transactions.md → authoring-transactions.md} +2 -2
- package/docs/{v3-capability-bindings.md → capability-bindings.md} +8 -8
- package/docs/{v3-common-kernel-experiment.md → common-kernel-experiment.md} +4 -4
- package/docs/{v3-core-semantics.md → core-semantics.md} +5 -5
- package/docs/{v3-cutover.md → cutover.md} +4 -4
- package/docs/{v3-design.md → design.md} +11 -11
- package/docs/{v3-document-contract.md → document-contract.md} +9 -9
- package/docs/{v3-dryroom-profile-validation.md → dryroom-profile-validation.md} +4 -4
- package/docs/{v3-editor-integration.md → editor-integration.md} +6 -6
- package/docs/{v3-full-conveyor-validation.md → full-conveyor-validation.md} +4 -4
- package/docs/{v3-full-dryroom-validation.md → full-dryroom-validation.md} +4 -4
- package/docs/{v3-full-forklift-validation.md → full-forklift-validation.md} +5 -5
- package/docs/{v3-full-robot-validation.md → full-robot-validation.md} +4 -4
- package/docs/{v3-layout-system.md → layout-system.md} +4 -4
- package/docs/{v3-legacy-risk-audit-2026-09-23.md → legacy-risk-audit-2026-09-23.md} +5 -5
- package/docs/{v3-minimal-model.md → minimal-model.md} +6 -6
- package/docs/{v3-motion-contract.md → motion-contract.md} +3 -3
- package/docs/{v3-openusd-review.md → openusd-review.md} +8 -8
- package/docs/{v3-operator-contracts.md → operator-contracts.md} +6 -6
- package/docs/{v3-payload-collision-validation.md → payload-collision-validation.md} +4 -4
- package/docs/{v3-payload-contact-validation.md → payload-contact-validation.md} +5 -5
- package/docs/prototypes/README.md +10 -10
- package/docs/prototypes/{v3-asset-samples.mjs → asset-samples.mjs} +6 -6
- package/docs/prototypes/{v3-asset-store.mjs → asset-store.mjs} +3 -3
- package/docs/prototypes/{v3-asset-store.test.mjs → asset-store.test.mjs} +6 -6
- package/docs/prototypes/asset.mjs +1 -0
- package/docs/prototypes/{v3-asset.schema.json → asset.schema.json} +2 -2
- package/docs/prototypes/{v3-asset.test.mjs → asset.test.mjs} +10 -10
- package/docs/prototypes/authoring-session.mjs +1 -0
- package/docs/prototypes/{v3-authoring-session.test.mjs → authoring-session.test.mjs} +6 -6
- package/docs/prototypes/capability-plan.mjs +1 -0
- package/docs/prototypes/{v3-capability-plan.test.mjs → capability-plan.test.mjs} +5 -5
- package/docs/prototypes/{v3-capability-samples.mjs → capability-samples.mjs} +2 -2
- package/docs/prototypes/document.mjs +2 -0
- package/docs/prototypes/{v3-document.schema.json → document.schema.json} +1 -1
- package/docs/prototypes/{v3-document.test.mjs → document.test.mjs} +7 -7
- package/docs/prototypes/{v3-dryroom-mesh.mjs → dryroom-mesh.mjs} +1 -1
- package/docs/prototypes/{v3-dryroom-mesh.test.mjs → dryroom-mesh.test.mjs} +1 -1
- package/docs/prototypes/{v3-editor-browser.mjs → editor-browser.mjs} +13 -13
- package/docs/prototypes/editor-workspace.mjs +1 -0
- package/docs/prototypes/{v3-editor-workspace.test.mjs → editor-workspace.test.mjs} +3 -3
- package/docs/prototypes/{v3-feature-pattern.test.mjs → feature-pattern.test.mjs} +1 -1
- package/docs/prototypes/{v3-full-conveyor.mjs → full-conveyor.mjs} +2 -2
- package/docs/prototypes/{v3-full-conveyor.test.mjs → full-conveyor.test.mjs} +3 -3
- package/docs/prototypes/{v3-full-dryroom.mjs → full-dryroom.mjs} +2 -2
- package/docs/prototypes/{v3-full-dryroom.test.mjs → full-dryroom.test.mjs} +3 -3
- package/docs/prototypes/{v3-full-forklift.mjs → full-forklift.mjs} +2 -2
- package/docs/prototypes/{v3-full-forklift.test.mjs → full-forklift.test.mjs} +3 -3
- package/docs/prototypes/{v3-full-robot.mjs → full-robot.mjs} +2 -2
- package/docs/prototypes/{v3-full-robot.test.mjs → full-robot.test.mjs} +4 -4
- package/docs/prototypes/{v3-kernel.test.mjs → kernel.test.mjs} +1 -1
- package/docs/prototypes/{v3-layout.test.mjs → layout.test.mjs} +1 -1
- package/docs/prototypes/{v3-more-samples.test.mjs → more-samples.test.mjs} +2 -2
- package/docs/prototypes/{v3-payload-collision.mjs → payload-collision.mjs} +2 -2
- package/docs/prototypes/{v3-payload-collision.test.mjs → payload-collision.test.mjs} +3 -3
- package/docs/prototypes/{v3-payload-fit.mjs → payload-fit.mjs} +2 -2
- package/docs/prototypes/{v3-payload-fit.test.mjs → payload-fit.test.mjs} +4 -4
- package/docs/prototypes/render-full-dryroom.mjs +12 -12
- package/docs/prototypes/{v3-repeated-binding.mjs → repeated-binding.mjs} +1 -1
- package/docs/prototypes/{v3-repeated-binding.test.mjs → repeated-binding.test.mjs} +6 -6
- package/docs/prototypes/{v3-runtime-browser.mjs → runtime-browser.mjs} +26 -26
- package/docs/prototypes/{v3-samples.test.mjs → samples.test.mjs} +1 -1
- package/docs/prototypes/{v3-spatial-plan.test.mjs → spatial-plan.test.mjs} +1 -1
- package/docs/prototypes/typed-plan.mjs +3 -0
- package/docs/prototypes/{v3-typed-plan.test.mjs → typed-plan.test.mjs} +1 -1
- package/docs/prototypes/{v3-typed-repeat.test.mjs → typed-repeat.test.mjs} +2 -2
- package/docs/{v3-repeated-binding-validation.md → repeated-binding-validation.md} +4 -4
- package/docs/{v3-research-review.md → research-review.md} +2 -2
- package/docs/{v3-review-2026-09-22.md → review-2026-09-22.md} +10 -10
- package/docs/{v3-runtime-extraction.md → runtime-extraction.md} +16 -16
- package/docs/{v3-sample-validation-expanded.md → sample-validation-expanded.md} +5 -5
- package/docs/{v3-sample-validation.md → sample-validation.md} +3 -3
- package/docs/{v3-shape-dimension-contract.md → shape-dimension-contract.md} +12 -12
- package/docs/{v3-shapeassembly-reproduction.md → shapeassembly-reproduction.md} +4 -4
- package/docs/{v3-spatial-contracts.md → spatial-contracts.md} +5 -5
- package/docs/status.md +12 -0
- package/docs/{v3-storage-integration.md → storage-integration.md} +5 -5
- package/docs/{v3-typed-repeat-contracts.md → typed-repeat-contracts.md} +3 -3
- package/package.json +3 -3
- package/dist/v3-asset-types.d.ts.map +0 -1
- package/dist/v3-asset-types.js +0 -2
- package/dist/v3-asset-types.js.map +0 -1
- package/dist/v3-asset.d.ts +0 -8
- package/dist/v3-asset.d.ts.map +0 -1
- package/dist/v3-asset.js.map +0 -1
- package/dist/v3-authoring-actions.d.ts.map +0 -1
- package/dist/v3-authoring-actions.js.map +0 -1
- package/dist/v3-authoring-session.d.ts.map +0 -1
- package/dist/v3-authoring-session.js.map +0 -1
- package/dist/v3-capabilities.d.ts +0 -3
- package/dist/v3-capabilities.d.ts.map +0 -1
- package/dist/v3-capabilities.js.map +0 -1
- package/dist/v3-contract.d.ts +0 -7
- package/dist/v3-contract.d.ts.map +0 -1
- package/dist/v3-contract.js +0 -12
- package/dist/v3-contract.js.map +0 -1
- package/dist/v3-cost.d.ts.map +0 -1
- package/dist/v3-cost.js.map +0 -1
- package/dist/v3-create.js.map +0 -1
- package/dist/v3-document.d.ts +0 -5
- package/dist/v3-document.d.ts.map +0 -1
- package/dist/v3-document.js +0 -31
- package/dist/v3-document.js.map +0 -1
- package/dist/v3-driver.d.ts.map +0 -1
- package/dist/v3-driver.js.map +0 -1
- package/dist/v3-editor-workspace.d.ts.map +0 -1
- package/dist/v3-editor-workspace.js.map +0 -1
- package/dist/v3-examples.d.ts.map +0 -1
- package/dist/v3-examples.js.map +0 -1
- package/dist/v3-follow.d.ts.map +0 -1
- package/dist/v3-follow.js.map +0 -1
- package/dist/v3-gate.d.ts.map +0 -1
- package/dist/v3-gate.js.map +0 -1
- package/dist/v3-graph-types.d.ts.map +0 -1
- package/dist/v3-graph-types.js +0 -2
- package/dist/v3-graph-types.js.map +0 -1
- package/dist/v3-graph.d.ts.map +0 -1
- package/dist/v3-graph.js.map +0 -1
- package/dist/v3-instance-size.d.ts.map +0 -1
- package/dist/v3-instance-size.js.map +0 -1
- package/dist/v3-json.d.ts +0 -12
- package/dist/v3-json.d.ts.map +0 -1
- package/dist/v3-json.js.map +0 -1
- package/dist/v3-kernel-version.d.ts +0 -8
- package/dist/v3-kernel-version.d.ts.map +0 -1
- package/dist/v3-kernel-version.js.map +0 -1
- package/dist/v3-part-edit.d.ts.map +0 -1
- package/dist/v3-part-edit.js.map +0 -1
- package/dist/v3-proposal.d.ts +0 -42
- package/dist/v3-proposal.d.ts.map +0 -1
- package/dist/v3-proposal.js.map +0 -1
- package/dist/v3-public-inputs.d.ts.map +0 -1
- package/dist/v3-public-inputs.js.map +0 -1
- package/dist/v3-recipe-build.d.ts +0 -27
- package/dist/v3-recipe-build.d.ts.map +0 -1
- package/dist/v3-recipe-build.js.map +0 -1
- package/dist/v3-recipe-from-parts.d.ts +0 -8
- package/dist/v3-recipe-from-parts.d.ts.map +0 -1
- package/dist/v3-recipe-from-parts.js.map +0 -1
- package/dist/v3-recipe.d.ts.map +0 -1
- package/dist/v3-recipe.js.map +0 -1
- package/dist/v3-release-contract.d.ts +0 -19
- package/dist/v3-release-contract.d.ts.map +0 -1
- package/dist/v3-release-contract.js.map +0 -1
- package/dist/v3-render-batches.d.ts.map +0 -1
- package/dist/v3-render-batches.js.map +0 -1
- package/dist/v3-score.d.ts.map +0 -1
- package/dist/v3-score.js.map +0 -1
- package/dist/v3-shape-sampling.d.ts.map +0 -1
- package/dist/v3-shape-sampling.js.map +0 -1
- package/dist/v3-surface.d.ts.map +0 -1
- package/dist/v3-surface.js.map +0 -1
- package/dist/v3-words.d.ts.map +0 -1
- package/dist/v3-words.js.map +0 -1
- package/docs/prototypes/v3-asset.mjs +0 -1
- package/docs/prototypes/v3-authoring-session.mjs +0 -1
- package/docs/prototypes/v3-capability-plan.mjs +0 -1
- package/docs/prototypes/v3-document.mjs +0 -2
- package/docs/prototypes/v3-editor-workspace.mjs +0 -1
- package/docs/prototypes/v3-typed-plan.mjs +0 -3
- package/docs/v3-status.md +0 -50
- /package/docs/prototypes/{v3-kernel.mjs → kernel.mjs} +0 -0
- /package/docs/prototypes/{v3-linear-comparison.py → linear-comparison.py} +0 -0
- /package/docs/prototypes/{v3-semantics.test.mjs → semantics.test.mjs} +0 -0
package/dist/room.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FigureAsset } from './asset-types.ts';
|
|
2
|
+
import type { FigureAuthoringAction } from './authoring-actions.ts';
|
|
3
|
+
import { type Axis } from './words.ts';
|
|
4
|
+
type Bounds = Record<Axis, {
|
|
5
|
+
min: number;
|
|
6
|
+
max: number;
|
|
7
|
+
}>;
|
|
8
|
+
/**
|
|
9
|
+
* Design inputs the declared room reads and nothing drawn does: a part's old position or size, left when a rule took
|
|
10
|
+
* its place, which the room was measured from. They move no part; typing into one changes only the room. With `part`,
|
|
11
|
+
* only that part's own (`<part>.…`).
|
|
12
|
+
*/
|
|
13
|
+
export declare function figureRoomOnlyInputsOf(asset: FigureAsset, part?: string): string[];
|
|
14
|
+
export interface FigureRoomRefit {
|
|
15
|
+
/** The command that declares the room again from the parts, as proposed now: apply it only when the author confirms. */
|
|
16
|
+
step: Extract<FigureAuthoringAction, {
|
|
17
|
+
kind: 'declare-occupancy';
|
|
18
|
+
}>;
|
|
19
|
+
/** The room as declared and as proposed, at the authored size and, when the figure declares its size, at the largest. */
|
|
20
|
+
declared: {
|
|
21
|
+
authored: Bounds;
|
|
22
|
+
largest?: Bounds;
|
|
23
|
+
};
|
|
24
|
+
proposed: {
|
|
25
|
+
authored: Bounds;
|
|
26
|
+
largest?: Bounds;
|
|
27
|
+
};
|
|
28
|
+
/** Parts the release gate finds outside each room, and how it checked: proven over the range, or sampled. */
|
|
29
|
+
/** Inputs that confirming removes: read by nothing once the room is declared again -- a part's old position or size. */
|
|
30
|
+
drops: string[];
|
|
31
|
+
outside: {
|
|
32
|
+
declared: FigureRoomFinding;
|
|
33
|
+
proposed: FigureRoomFinding;
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/** A part outside the room: on which axis, and by how much at worst. */
|
|
37
|
+
export type FigureRoomOutside = {
|
|
38
|
+
part: string;
|
|
39
|
+
axis: Axis;
|
|
40
|
+
mm: number;
|
|
41
|
+
};
|
|
42
|
+
/** The parts outside, and how the gate checked: `proven` over the whole range, or `sampled` at `states` states. */
|
|
43
|
+
export type FigureRoomFinding = {
|
|
44
|
+
parts: FigureRoomOutside[];
|
|
45
|
+
coverage: {
|
|
46
|
+
method: 'proven' | 'sampled' | 'defaults';
|
|
47
|
+
states: number;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
/** What declaring the room again would change, or undefined for a figure with no room declared. */
|
|
51
|
+
export declare function figureRoomRefitOf(asset: FigureAsset): FigureRoomRefit | undefined;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=room.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1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;IAAC,QAAQ,EAAE;QAAE,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAA;AAEvI,mGAAmG;AACnG,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,eAAe,GAAG,SAAS,CAgCjF"}
|
package/dist/room.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The declared room, read for the author (ADR-0097 §6): which inputs only the room still reads, and what declaring it
|
|
3
|
+
* again from the parts would change. The room is never widened or rewritten as a side effect of another command; a
|
|
4
|
+
* person sees the room as declared and as proposed, and what the gate finds outside each, before confirming.
|
|
5
|
+
*/
|
|
6
|
+
import { upgradeFigurePlacement } from "./asset.js";
|
|
7
|
+
import { applyFigureAuthoring, proposeFigureOccupancy } from "./authoring-actions.js";
|
|
8
|
+
import { compileFigureGraph } from "./graph.js";
|
|
9
|
+
import { inspectFigureAsset } from "./gate.js";
|
|
10
|
+
import { FIGURE_INSTANCE_SIZE_INPUTS } from "./instance-size.js";
|
|
11
|
+
import { AXES } from "./words.js";
|
|
12
|
+
const stringsIn = (value) => typeof value === 'string' ? [value] : Array.isArray(value) ? value.flatMap(stringsIn) : value && typeof value === 'object' ? Object.values(value).flatMap(stringsIn) : [];
|
|
13
|
+
/** Every value a set of references is worked out from, inputs included. */
|
|
14
|
+
function readFrom(m, from) {
|
|
15
|
+
const writers = new Map();
|
|
16
|
+
for (const n of m.nodes)
|
|
17
|
+
for (const ref of Object.values(n.outputs ?? {}))
|
|
18
|
+
writers.set(ref, n);
|
|
19
|
+
const read = new Set();
|
|
20
|
+
for (const pending = [...from]; pending.length;) {
|
|
21
|
+
const ref = pending.pop();
|
|
22
|
+
if (read.has(ref))
|
|
23
|
+
continue;
|
|
24
|
+
read.add(ref);
|
|
25
|
+
const writer = writers.get(ref);
|
|
26
|
+
if (writer)
|
|
27
|
+
pending.push(...writer.args, ...stringsIn(writer.params));
|
|
28
|
+
}
|
|
29
|
+
return read;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Design inputs the declared room reads and nothing drawn does: a part's old position or size, left when a rule took
|
|
33
|
+
* its place, which the room was measured from. They move no part; typing into one changes only the room. With `part`,
|
|
34
|
+
* only that part's own (`<part>.…`).
|
|
35
|
+
*/
|
|
36
|
+
export function figureRoomOnlyInputsOf(asset, part) {
|
|
37
|
+
asset = upgradeFigurePlacement(asset);
|
|
38
|
+
const a = asset;
|
|
39
|
+
const m = a.document.model;
|
|
40
|
+
if (!a.occupancy)
|
|
41
|
+
return [];
|
|
42
|
+
const drawn = readFrom(m, [
|
|
43
|
+
...m.nodes.filter((n) => n.op === 'place@1' || n.op === 'member@1' || n.op === 'repeat@1').flatMap((n) => n.args),
|
|
44
|
+
...stringsIn(a.appearance),
|
|
45
|
+
...stringsIn(a.document.capabilities),
|
|
46
|
+
...stringsIn(a.drivers),
|
|
47
|
+
...stringsIn(a.publicInputs),
|
|
48
|
+
...stringsIn(a.joints)
|
|
49
|
+
]);
|
|
50
|
+
const room = readFrom(m, stringsIn(a.occupancy));
|
|
51
|
+
return m.inputs
|
|
52
|
+
.filter((i) => i.role === 'design' && room.has(i.id) && !drawn.has(i.id) && (!part || i.id.startsWith(`${part}.`)))
|
|
53
|
+
.map((i) => i.id);
|
|
54
|
+
}
|
|
55
|
+
/** What declaring the room again would change, or undefined for a figure with no room declared. */
|
|
56
|
+
export function figureRoomRefitOf(asset) {
|
|
57
|
+
asset = upgradeFigurePlacement(asset);
|
|
58
|
+
if (!asset.occupancy)
|
|
59
|
+
return undefined;
|
|
60
|
+
const step = { kind: 'declare-occupancy', proposal: proposeFigureOccupancy(asset, { over: 'range' }) };
|
|
61
|
+
const refit = applyFigureAuthoring(asset, step);
|
|
62
|
+
const m = asset.document.model;
|
|
63
|
+
const sizes = AXES.map(axis => m.inputs.find((i) => i.id === FIGURE_INSTANCE_SIZE_INPUTS[axis]));
|
|
64
|
+
const largest = sizes.every(Boolean) ? Object.fromEntries(sizes.map(i => [i.id, i.max])) : undefined;
|
|
65
|
+
const boundsOf = (a, at = {}) => {
|
|
66
|
+
const values = compileFigureGraph(a.document.model).evaluate({ ...a.designInputs, ...a.stateDefaults, ...at }).values;
|
|
67
|
+
const b = a.occupancy.bounds;
|
|
68
|
+
return Object.fromEntries(AXES.map(axis => [axis, { min: values[b[axis].min], max: values[b[axis].max] }]));
|
|
69
|
+
};
|
|
70
|
+
/*
|
|
71
|
+
What lies outside, as the release gate finds it over the sizes and states the figure allows -- with its coverage:
|
|
72
|
+
proven over the whole range, or sampled at so many states, which is not a bound (designer 2026-09-27: a check of a
|
|
73
|
+
few corners is not a proof of the range).
|
|
74
|
+
*/
|
|
75
|
+
const outside = (a) => {
|
|
76
|
+
const report = inspectFigureAsset(a);
|
|
77
|
+
return {
|
|
78
|
+
parts: report.violations.filter(v => v.code === 'PART_OUTSIDE_OCCUPANCY').map(v => ({ part: v.part, axis: v.axis, mm: v.mm })),
|
|
79
|
+
coverage: { method: report.coverage.method, states: report.coverage.states }
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
return {
|
|
83
|
+
step,
|
|
84
|
+
drops: Object.keys(asset.designInputs).filter(id => !(id in refit.designInputs)),
|
|
85
|
+
declared: { authored: boundsOf(asset), ...(largest ? { largest: boundsOf(asset, largest) } : {}) },
|
|
86
|
+
proposed: { authored: boundsOf(refit), ...(largest ? { largest: boundsOf(refit, largest) } : {}) },
|
|
87
|
+
outside: { declared: outside(asset), proposed: outside(refit) }
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=room.js.map
|
package/dist/room.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"room.js","sourceRoot":"","sources":["../src/room.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAGnD,OAAO,EAAE,oBAAoB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,QAAQ,CAAC,MAAM,EAAE;SAC7E,CAAA;IACH,CAAC,CAAA;IACD,OAAO;QACL,IAAI;QACJ,KAAK,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,KAAK,CAAC,YAAY,CAAC,CAAC;QAChF,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAClG,QAAQ,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE;QAClG,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,EAAE;KAChE,CAAA;AACH,CAAC"}
|
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import type { FigureGrade } from './
|
|
2
|
-
import type {
|
|
3
|
-
export type
|
|
1
|
+
import type { FigureGrade } from './words.ts';
|
|
2
|
+
import type { FigureAsset, FigureAssetGeometry } from './asset-types.ts';
|
|
3
|
+
export type FigureBudgetKey = 'groups' | 'triangles' | 'independent' | 'moving' | 'transparent' | 'parts';
|
|
4
4
|
/** Every budget, in the order a screen draws them. */
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const FIGURE_BUDGET_KEYS: readonly FigureBudgetKey[];
|
|
6
6
|
/**
|
|
7
7
|
* How many parts the figure is authored with: one per authored part, a repeat once however many copies it makes. The number the detail level's limit (`PART_LIMIT`) is held against.
|
|
8
8
|
*/
|
|
9
|
-
export declare function
|
|
9
|
+
export declare function figurePartCountOf(asset: FigureAsset): number;
|
|
10
10
|
/** The detail level's part budget, or nothing when the figure declares no level. */
|
|
11
|
-
export declare function
|
|
11
|
+
export declare function figurePartBudgetOf(asset: FigureAsset): {
|
|
12
12
|
level: 'S' | 'M' | 'L';
|
|
13
13
|
used: number;
|
|
14
14
|
limit: number;
|
|
15
15
|
} | undefined;
|
|
16
|
-
export interface
|
|
17
|
-
key:
|
|
16
|
+
export interface FigureBudgetUse {
|
|
17
|
+
key: FigureBudgetKey;
|
|
18
18
|
used: number;
|
|
19
19
|
/** What one instance may use. For groups and triangles, the screen's total shared among the target's instances. */
|
|
20
20
|
limit: number;
|
|
21
21
|
/** `used / limit`. Over 1 breaks the budget. */
|
|
22
22
|
ratio: number;
|
|
23
23
|
}
|
|
24
|
-
export interface
|
|
24
|
+
export interface FigureScore {
|
|
25
25
|
/** 0–100, the headroom left on the tightest budget. */
|
|
26
26
|
score: number;
|
|
27
27
|
grade: FigureGrade;
|
|
28
28
|
/** The budget closest to its limit. It decides the grade, so it is where to start. */
|
|
29
|
-
tightest:
|
|
30
|
-
budgets:
|
|
29
|
+
tightest: FigureBudgetUse;
|
|
30
|
+
budgets: FigureBudgetUse[];
|
|
31
31
|
}
|
|
32
32
|
/** The grade bounds. A screen draws its scale from this list, so the two cannot disagree. */
|
|
33
|
-
export declare const
|
|
34
|
-
export declare function
|
|
33
|
+
export declare const FIGURE_GRADE_SCALE: readonly (readonly [FigureGrade, number])[];
|
|
34
|
+
export declare function figureGradeOf(ratio: number): FigureGrade;
|
|
35
35
|
/** What one instance may draw so that `LIMITS.screenInstances` of them fit on one screen. */
|
|
36
|
-
export declare const
|
|
36
|
+
export declare const FIGURE_PER_INSTANCE: {
|
|
37
37
|
readonly groups: number;
|
|
38
38
|
readonly triangles: number;
|
|
39
39
|
readonly moving: number;
|
|
40
40
|
};
|
|
41
41
|
/** The key a body's material is shared by: token, preset, transparency and glow. */
|
|
42
|
-
export declare function
|
|
42
|
+
export declare function figureMaterialKeyOf(body: FigureAssetGeometry): string;
|
|
43
43
|
/**
|
|
44
44
|
* Drawn bodies that move with a state input. A body counts when the value that places it
|
|
45
45
|
* depends on a state input (`dependence`, contract §2), which is what makes it carry its own transform frame to frame.
|
|
46
46
|
* A visibility flag is not a placement, so a lamp that only switches on does not count.
|
|
47
47
|
*/
|
|
48
|
-
export declare function
|
|
48
|
+
export declare function figureIndependentBodiesOf(asset: FigureAsset, drawn: readonly FigureAssetGeometry[]): number;
|
|
49
49
|
/**
|
|
50
|
-
* The grade of one asset, evaluated at its own design and state defaults as `
|
|
50
|
+
* The grade of one asset, evaluated at its own design and state defaults as `figureCostOf` is. Nothing when no body is
|
|
51
51
|
* drawn: there is nothing to grade, and a grade of A would say otherwise.
|
|
52
52
|
*/
|
|
53
|
-
export declare function
|
|
54
|
-
//# sourceMappingURL=
|
|
53
|
+
export declare function figureScoreOf(asset: FigureAsset): FigureScore | undefined;
|
|
54
|
+
//# sourceMappingURL=score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../src/score.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAM7C,OAAO,KAAK,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAExE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,GAAG,QAAQ,GAAG,aAAa,GAAG,OAAO,CAAA;AAEzG,sDAAsD;AACtD,eAAO,MAAM,kBAAkB,EAAE,SAAS,eAAe,EAA6E,CAAA;AAEtI;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAE5D;AAED,oFAAoF;AACpF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,GAAG;IAAE,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAG1H;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,eAAe,CAAA;IACpB,IAAI,EAAE,MAAM,CAAA;IACZ,mHAAmH;IACnH,KAAK,EAAE,MAAM,CAAA;IACb,gDAAgD;IAChD,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,WAAW;IAC1B,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,WAAW,CAAA;IAClB,sFAAsF;IACtF,QAAQ,EAAE,eAAe,CAAA;IACzB,OAAO,EAAE,eAAe,EAAE,CAAA;CAC3B;AAED,6FAA6F;AAC7F,eAAO,MAAM,kBAAkB,EAAE,SAAS,CAAC,SAAS,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC,EAIzE,CAAA;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAGxD;AAED,6FAA6F;AAC7F,eAAO,MAAM,mBAAmB;;;;CAItB,CAAA;AAEV,oFAAoF;AACpF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,CAIrE;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,CAG3G;AAaD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,SAAS,CAqCzE"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright © HatioLab Inc. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
/*
|
|
5
|
-
* How much room a
|
|
5
|
+
* How much room a asset leaves — its grade, A to D, from one place so the modeller and the catalogue agree.
|
|
6
6
|
*
|
|
7
7
|
* The grade is the headroom against a target: **how many of this figure one screen must hold** (`LIMITS.screenInstances`,
|
|
8
8
|
* chief architect's ruling 2026-09-24 on ADR-0051's 09-19 ruling). One screen holds `LIMITS.groupsOnScreen` draw groups
|
|
@@ -18,46 +18,46 @@
|
|
|
18
18
|
* The bounds: A up to half of a budget used, B up to three quarters, C up to all of it, D over.
|
|
19
19
|
* The tightest budget decides — it is where to start.
|
|
20
20
|
*/
|
|
21
|
-
import { LIMITS, PART_LIMIT } from "./
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
21
|
+
import { LIMITS, PART_LIMIT } from "./words.js";
|
|
22
|
+
import { compileFigureAsset } from "./asset.js";
|
|
23
|
+
import { compileFigureDocument } from "./document.js";
|
|
24
|
+
import { figureWritersOf } from "./gate.js";
|
|
25
|
+
import { figureTrianglesOf } from "./cost.js";
|
|
26
|
+
import { figureRenderBatchesOf } from "./render-batches.js";
|
|
27
27
|
/** Every budget, in the order a screen draws them. */
|
|
28
|
-
export const
|
|
28
|
+
export const FIGURE_BUDGET_KEYS = ['groups', 'triangles', 'independent', 'moving', 'transparent', 'parts'];
|
|
29
29
|
/**
|
|
30
30
|
* How many parts the figure is authored with: one per authored part, a repeat once however many copies it makes. The number the detail level's limit (`PART_LIMIT`) is held against.
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
32
|
+
export function figurePartCountOf(asset) {
|
|
33
33
|
return asset.appearance.length;
|
|
34
34
|
}
|
|
35
35
|
/** The detail level's part budget, or nothing when the figure declares no level. */
|
|
36
|
-
export function
|
|
36
|
+
export function figurePartBudgetOf(asset) {
|
|
37
37
|
if (!asset.detailLevel)
|
|
38
38
|
return undefined;
|
|
39
|
-
return { level: asset.detailLevel, used:
|
|
39
|
+
return { level: asset.detailLevel, used: figurePartCountOf(asset), limit: PART_LIMIT[asset.detailLevel] };
|
|
40
40
|
}
|
|
41
41
|
/** The grade bounds. A screen draws its scale from this list, so the two cannot disagree. */
|
|
42
|
-
export const
|
|
42
|
+
export const FIGURE_GRADE_SCALE = [
|
|
43
43
|
['A', 0.5],
|
|
44
44
|
['B', 0.75],
|
|
45
45
|
['C', 1]
|
|
46
46
|
];
|
|
47
|
-
export function
|
|
48
|
-
for (const [grade, bound] of
|
|
47
|
+
export function figureGradeOf(ratio) {
|
|
48
|
+
for (const [grade, bound] of FIGURE_GRADE_SCALE)
|
|
49
49
|
if (ratio <= bound)
|
|
50
50
|
return grade;
|
|
51
51
|
return 'D';
|
|
52
52
|
}
|
|
53
53
|
/** What one instance may draw so that `LIMITS.screenInstances` of them fit on one screen. */
|
|
54
|
-
export const
|
|
54
|
+
export const FIGURE_PER_INSTANCE = {
|
|
55
55
|
groups: LIMITS.groupsOnScreen / LIMITS.screenInstances,
|
|
56
56
|
triangles: LIMITS.trianglesOnScreen / LIMITS.screenInstances,
|
|
57
57
|
moving: LIMITS.movingBodiesOnScreen / LIMITS.screenInstances
|
|
58
58
|
};
|
|
59
59
|
/** The key a body's material is shared by: token, preset, transparency and glow. */
|
|
60
|
-
export function
|
|
60
|
+
export function figureMaterialKeyOf(body) {
|
|
61
61
|
const m = body.material;
|
|
62
62
|
const on = m.emissive?.on ? `on:${m.emissive.token}:${m.emissive.intensity}` : 'off';
|
|
63
63
|
return `${m.token}|${m.preset ?? 'default'}|${m.transparent ? 't' : 'o'}|${on}`;
|
|
@@ -67,14 +67,14 @@ export function v3MaterialKeyOf(body) {
|
|
|
67
67
|
* depends on a state input (`dependence`, contract §2), which is what makes it carry its own transform frame to frame.
|
|
68
68
|
* A visibility flag is not a placement, so a lamp that only switches on does not count.
|
|
69
69
|
*/
|
|
70
|
-
export function
|
|
70
|
+
export function figureIndependentBodiesOf(asset, drawn) {
|
|
71
71
|
const moves = movingOf(asset);
|
|
72
72
|
return drawn.filter(moves).length;
|
|
73
73
|
}
|
|
74
74
|
/** Whether a drawn body moves with a state input: the value that places it depends on one. */
|
|
75
75
|
function movingOf(asset) {
|
|
76
|
-
const plan =
|
|
77
|
-
const writers =
|
|
76
|
+
const plan = compileFigureDocument(asset.document);
|
|
77
|
+
const writers = figureWritersOf(asset);
|
|
78
78
|
const nodes = new Map(asset.document.model.nodes.map(node => [node.id, node]));
|
|
79
79
|
return body => {
|
|
80
80
|
const node = nodes.get(('key' in body && body.key ? writers.get(body.key) : body.id) ?? '');
|
|
@@ -82,37 +82,37 @@ function movingOf(asset) {
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
85
|
-
* The grade of one asset, evaluated at its own design and state defaults as `
|
|
85
|
+
* The grade of one asset, evaluated at its own design and state defaults as `figureCostOf` is. Nothing when no body is
|
|
86
86
|
* drawn: there is nothing to grade, and a grade of A would say otherwise.
|
|
87
87
|
*/
|
|
88
|
-
export function
|
|
89
|
-
const drawn =
|
|
88
|
+
export function figureScoreOf(asset) {
|
|
89
|
+
const drawn = compileFigureAsset(asset)
|
|
90
90
|
.evaluate()
|
|
91
91
|
.geometry.filter(body => body.visible !== false);
|
|
92
92
|
if (!drawn.length)
|
|
93
93
|
return undefined;
|
|
94
|
-
const triangles = drawn.reduce((sum, body) => sum +
|
|
95
|
-
const transparent = new Set(drawn.filter(body => body.material.transparent).map(
|
|
94
|
+
const triangles = drawn.reduce((sum, body) => sum + figureTrianglesOf(body), 0);
|
|
95
|
+
const transparent = new Set(drawn.filter(body => body.material.transparent).map(figureMaterialKeyOf)).size;
|
|
96
96
|
/*
|
|
97
|
-
As the renderer draws them (
|
|
97
|
+
As the renderer draws them (figureRenderBatchesOf, the rule it draws by -- ADR-0087 amended 2026-09-26): a draw group per
|
|
98
98
|
batch of a row's copies and per body drawn alone; what moves on its own counted once a batch; and every body that
|
|
99
99
|
moves re-evaluated and moved each frame.
|
|
100
100
|
*/
|
|
101
101
|
const moves = movingOf(asset);
|
|
102
|
-
const plan =
|
|
102
|
+
const plan = figureRenderBatchesOf(drawn);
|
|
103
103
|
const byId = new Map(drawn.map(body => [body.id, body]));
|
|
104
104
|
const groups = plan.batches.length + plan.alone.length;
|
|
105
105
|
const independent = plan.batches.filter(b => b.ids.some(id => moves(byId.get(id)))).length + plan.alone.filter(id => moves(byId.get(id))).length;
|
|
106
106
|
const moving = drawn.filter(moves).length;
|
|
107
107
|
const budget = (key, used, limit) => ({ key, used, limit, ratio: used / limit });
|
|
108
108
|
const budgets = [
|
|
109
|
-
budget('groups', groups,
|
|
110
|
-
budget('triangles', triangles,
|
|
109
|
+
budget('groups', groups, FIGURE_PER_INSTANCE.groups),
|
|
110
|
+
budget('triangles', triangles, FIGURE_PER_INSTANCE.triangles),
|
|
111
111
|
budget('independent', independent, LIMITS.independentParts),
|
|
112
|
-
budget('moving', moving,
|
|
112
|
+
budget('moving', moving, FIGURE_PER_INSTANCE.moving),
|
|
113
113
|
budget('transparent', transparent, LIMITS.transparentMaterials),
|
|
114
114
|
/* The detail level's part budget, when the figure declares a level. */
|
|
115
|
-
...(asset.detailLevel ? [budget('parts',
|
|
115
|
+
...(asset.detailLevel ? [budget('parts', figurePartCountOf(asset), PART_LIMIT[asset.detailLevel])] : [])
|
|
116
116
|
];
|
|
117
117
|
let tightest = budgets[0];
|
|
118
118
|
for (const one of budgets)
|
|
@@ -120,9 +120,9 @@ export function v3ScoreOf(asset) {
|
|
|
120
120
|
tightest = one;
|
|
121
121
|
return {
|
|
122
122
|
score: Math.max(0, Math.round(100 * (1 - tightest.ratio))),
|
|
123
|
-
grade:
|
|
123
|
+
grade: figureGradeOf(tightest.ratio),
|
|
124
124
|
tightest,
|
|
125
125
|
budgets
|
|
126
126
|
};
|
|
127
127
|
}
|
|
128
|
-
//# sourceMappingURL=
|
|
128
|
+
//# sourceMappingURL=score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.js","sourceRoot":"","sources":["../src/score.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE/C,OAAO,EAAE,k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AuE;QACvE,GAAG,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACzG,CAAA;IACD,IAAI,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAE,CAAA;IAC1B,KAAK,MAAM,GAAG,IAAI,OAAO;QAAE,IAAI,GAAG,CAAC,KAAK,GAAG,QAAQ,CAAC,KAAK;YAAE,QAAQ,GAAG,GAAG,CAAA;IACzE,OAAO;QACL,KAAK,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1D,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC;QACpC,QAAQ;QACR,OAAO;KACR,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { Axis } from './words.ts';
|
|
2
|
+
import { type FigureShapeFace } from './graph.ts';
|
|
3
|
+
/**
|
|
4
|
+
* What a shape offers the commands that size and place a part (ADR-0097 §6): how far it reaches along each of its own
|
|
5
|
+
* axes, which of those a size can edit and how, and the flat faces it can be attached by. Three separate answers: a
|
|
6
|
+
* sphere is measured along every axis and edited along every axis, yet has no face to attach by; a section is measured
|
|
7
|
+
* across by its corners and edited across by none. Nothing reads a shape's arguments by their order to find X, Y or Z.
|
|
8
|
+
*/
|
|
9
|
+
export interface FigureShapeProvider {
|
|
10
|
+
/** Along each axis, candidates whose largest is the reach -- `Σ k × argument` each (a frustum is as wide as its wider end). */
|
|
11
|
+
measure: Readonly<Record<Axis, ReadonlyArray<FigureShapeTerm> | 'profile'>>;
|
|
12
|
+
/** Along each axis, how a size edits the shape, or why it cannot. */
|
|
13
|
+
edit: Readonly<Record<Axis, FigureShapeEdit>>;
|
|
14
|
+
/** The flat faces a part can be attached by, as the shape's operator declares them; none for a sphere. */
|
|
15
|
+
faces: Readonly<Record<string, FigureShapeFace>>;
|
|
16
|
+
}
|
|
17
|
+
export type FigureShapeTerm = {
|
|
18
|
+
arg: number;
|
|
19
|
+
k: number;
|
|
20
|
+
};
|
|
21
|
+
export type FigureShapeEdit = {
|
|
22
|
+
arg: number;
|
|
23
|
+
k: number;
|
|
24
|
+
with?: readonly number[];
|
|
25
|
+
sameAs?: Axis;
|
|
26
|
+
} | {
|
|
27
|
+
refused: FigureShapeEditRefusal;
|
|
28
|
+
};
|
|
29
|
+
/** Why an axis cannot be edited: its measure is its section's corners, or the shape has no measure along it. */
|
|
30
|
+
export type FigureShapeEditRefusal = 'SECTION_CORNERS' | 'NO_MEASURE';
|
|
31
|
+
/** The provider for a shape operator, or undefined for an operator that is not a shape. */
|
|
32
|
+
export declare function figureShapeProviderOf(op: string): FigureShapeProvider | undefined;
|
|
33
|
+
/** The axes a size can edit on its own: every editable axis but one that is another's measure. */
|
|
34
|
+
export declare function figureEditableAxesOf(op: string): Axis[];
|
|
35
|
+
/** The axes a part of this shape can make follow the figure's size, or another's measure, now. */
|
|
36
|
+
export declare function figureFollowableAxesOf(op: string): Axis[];
|
|
37
|
+
//# sourceMappingURL=shape-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-provider.d.ts","sourceRoot":"","sources":["../src/shape-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AACtC,OAAO,EAAoB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAA;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,+HAA+H;IAC/H,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;IAC3E,qEAAqE;IACrE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAA;IAC7C,0GAA0G;IAC1G,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAA;CACjD;AAED,MAAM,MAAM,eAAe,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAExD,MAAM,MAAM,eAAe,GAMvB;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,GACnE;IAAE,OAAO,EAAE,sBAAsB,CAAA;CAAE,CAAA;AAEvC,gHAAgH;AAChH,MAAM,MAAM,sBAAsB,GAAG,iBAAiB,GAAG,YAAY,CAAA;AA6CrE,2FAA2F;AAC3F,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAGjF;AAED,kGAAkG;AAClG,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,CAOvD;AAUD,kGAAkG;AAClG,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,EAAE,CAEzD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { figureShapeFaces } from "./graph.js";
|
|
2
|
+
const term = (arg, k = 1) => [{ arg, k }];
|
|
3
|
+
const BOX_MEASURE = { x: term(0), y: term(1), z: term(2) };
|
|
4
|
+
const BOX_EDIT = { x: { arg: 0, k: 1 }, y: { arg: 1, k: 1 }, z: { arg: 2, k: 1 } };
|
|
5
|
+
const PROVIDERS = {
|
|
6
|
+
'box-shape@1': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
7
|
+
/* A rounded, hollow or framed box measures and edits as a box; its corners, walls, jambs and head keep their own numbers. */
|
|
8
|
+
'rounded-box@1': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
9
|
+
'rounded-box@2': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
10
|
+
'hollow-box@1': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
11
|
+
'hollow-box@2': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
12
|
+
'portal-profile@2': { measure: BOX_MEASURE, edit: BOX_EDIT },
|
|
13
|
+
/* A cylinder stands along its Y: its radius across (X, and Z with it), its length along. */
|
|
14
|
+
'cylinder-shape@1': {
|
|
15
|
+
measure: { x: term(0, 2), y: term(1), z: term(0, 2) },
|
|
16
|
+
edit: { x: { arg: 0, k: 2 }, y: { arg: 1, k: 1 }, z: { arg: 0, k: 2, sameAs: 'x' } }
|
|
17
|
+
},
|
|
18
|
+
/* An elliptic cylinder: (radiusX, radiusZ, length) -- a radius across each way, its length along Y. */
|
|
19
|
+
'cylinder-shape@2': {
|
|
20
|
+
measure: { x: term(0, 2), y: term(2), z: term(1, 2) },
|
|
21
|
+
edit: { x: { arg: 0, k: 2 }, y: { arg: 2, k: 1 }, z: { arg: 1, k: 2 } }
|
|
22
|
+
},
|
|
23
|
+
/* An ellipsoid: a radius each way. */
|
|
24
|
+
'sphere-shape@1': {
|
|
25
|
+
measure: { x: term(0, 2), y: term(1, 2), z: term(2, 2) },
|
|
26
|
+
edit: { x: { arg: 0, k: 2 }, y: { arg: 1, k: 2 }, z: { arg: 2, k: 2 } }
|
|
27
|
+
},
|
|
28
|
+
/*
|
|
29
|
+
A frustum (radiusTop, radiusBottom, height): as wide as the wider of its two ends, whichever that is. A width edits
|
|
30
|
+
both ends in proportion, so the taper stays and an end of radius 0 -- a cone's point -- stays a point; editing one
|
|
31
|
+
radius alone is not a change of width.
|
|
32
|
+
*/
|
|
33
|
+
'frustum-shape@1': {
|
|
34
|
+
measure: { x: [{ arg: 0, k: 2 }, { arg: 1, k: 2 }], y: term(2), z: [{ arg: 0, k: 2 }, { arg: 1, k: 2 }] },
|
|
35
|
+
edit: { x: { arg: 1, k: 2, with: [0] }, y: { arg: 2, k: 1 }, z: { arg: 1, k: 2, with: [0], sameAs: 'x' } }
|
|
36
|
+
},
|
|
37
|
+
/* A section (height, then its corners) pushed along Y: measured across by its corners, which no size edits. */
|
|
38
|
+
'polygon-shape@1': {
|
|
39
|
+
measure: { x: 'profile', y: term(0), z: 'profile' },
|
|
40
|
+
edit: { x: { refused: 'SECTION_CORNERS' }, y: { arg: 0, k: 1 }, z: { refused: 'SECTION_CORNERS' } }
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/** The provider for a shape operator, or undefined for an operator that is not a shape. */
|
|
44
|
+
export function figureShapeProviderOf(op) {
|
|
45
|
+
const own = PROVIDERS[op];
|
|
46
|
+
return own && { ...own, faces: figureShapeFaces(op) ?? {} };
|
|
47
|
+
}
|
|
48
|
+
/** The axes a size can edit on its own: every editable axis but one that is another's measure. */
|
|
49
|
+
export function figureEditableAxesOf(op) {
|
|
50
|
+
const edit = PROVIDERS[op]?.edit;
|
|
51
|
+
if (!edit)
|
|
52
|
+
return [];
|
|
53
|
+
return ['x', 'y', 'z'].filter(axis => {
|
|
54
|
+
const e = edit[axis];
|
|
55
|
+
return !('refused' in e) && !e.sameAs;
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
/*
|
|
59
|
+
* The shapes whose size can follow something today: a measure is linked through the shape's argument at the axis's
|
|
60
|
+
* place, so only shapes whose edited measures sit there are taken. Every command and screen that offers "follow"
|
|
61
|
+
* asks here -- follow-size, the resize plan, the modeller -- so no two lists decide it apart (designer 2026-09-27).
|
|
62
|
+
* The other shapes wait for linking to read the provider's `edit`.
|
|
63
|
+
*/
|
|
64
|
+
const FOLLOWS_NOW = new Set(['box-shape@1', 'rounded-box@1', 'portal-profile@2', 'hollow-box@2', 'cylinder-shape@1']);
|
|
65
|
+
/** The axes a part of this shape can make follow the figure's size, or another's measure, now. */
|
|
66
|
+
export function figureFollowableAxesOf(op) {
|
|
67
|
+
return FOLLOWS_NOW.has(op) ? figureEditableAxesOf(op) : [];
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=shape-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-provider.js","sourceRoot":"","sources":["../src/shape-provider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAwB,MAAM,YAAY,CAAA;AA+BnE,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,CAAC,GAAG,CAAC,EAAkC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;AACjF,MAAM,WAAW,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAA;AAC1D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAA;AAElF,MAAM,SAAS,GAAiE;IAC9E,aAAa,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACvD,6HAA6H;IAC7H,eAAe,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACzD,eAAe,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACzD,cAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE;IACxD,cAAc,EAAE,EAAE,OAAO,EAAE,WAAW,EAAE,IAAI,EAA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
|
|
3
3
|
/** Points on the outline of a rounded rectangle in the X–Z plane, centred, y = 0. */
|
|
4
4
|
export declare function roundedOutline(width: number, depth: number, roundX: number, roundZ: number): Point[];
|
|
@@ -8,7 +8,7 @@ export declare function cylinderPoints(rx: number, rz: number, length: number, s
|
|
|
8
8
|
/** Points on an ellipsoid: a fixed latitude–longitude grid. */
|
|
9
9
|
export declare function spherePoints(rx: number, ry: number, rz: number): Point[];
|
|
10
10
|
export declare function boxPoints(w: number, h: number, d: number): Point[];
|
|
11
|
-
/** Surface points of a
|
|
12
|
-
export declare function
|
|
11
|
+
/** Surface points of a shape in its own frame. */
|
|
12
|
+
export declare function figureShapePoints(shape: FigureShape, segments?: number): Point[];
|
|
13
13
|
export declare function transformPoints(points: readonly Point[], r: number[][], t: readonly number[]): Point[];
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=shape-sampling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-sampling.d.ts","sourceRoot":"","sources":["../src/shape-sampling.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,MAAM,KAAK,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;AAK5C,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,CA2BpG;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,CAEzD;AAED,mEAAmE;AACnE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,KAAK,EAAE,CAQhG;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,KAAK,EAAE,CAaxE;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,CAIlE;AAED,kDAAkD;AAClD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,KAAK,EAAE,CA+ChF;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,KAAK,EAAE,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,EAAE,CAMtG"}
|
|
@@ -61,8 +61,8 @@ export function boxPoints(w, h, d) {
|
|
|
61
61
|
pts.push([(sx * w) / 2, (sy * h) / 2, (sz * d) / 2]);
|
|
62
62
|
return pts;
|
|
63
63
|
}
|
|
64
|
-
/** Surface points of a
|
|
65
|
-
export function
|
|
64
|
+
/** Surface points of a shape in its own frame. */
|
|
65
|
+
export function figureShapePoints(shape, segments) {
|
|
66
66
|
const d = shape.dimensions;
|
|
67
67
|
switch (shape.provider) {
|
|
68
68
|
case 'box':
|
|
@@ -117,4 +117,4 @@ export function transformPoints(points, r, t) {
|
|
|
117
117
|
r[2][0] * x + r[2][1] * y + r[2][2] * z + t[2]
|
|
118
118
|
]);
|
|
119
119
|
}
|
|
120
|
-
//# sourceMappingURL=
|
|
120
|
+
//# sourceMappingURL=shape-sampling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shape-sampling.js","sourceRoot":"","sources":["../src/shape-sampling.ts"],"names":[],"mappings":"AAQA,iGAAiG;AACjG,MAAM,gBAAgB,GAAG,CAAC,CAAA;AAE1B,qFAAqF;AACrF,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE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