@rig-c/parts 2.49.1 → 2.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/cli.ts +245 -11
- package/docs/AUTHORING.md +274 -66
- package/docs/STABILITY.md +116 -18
- package/package.json +3 -2
- package/src/behindseams.ts +164 -11
- package/src/build.ts +2 -0
- package/src/bustlandmarks.ts +656 -0
- package/src/check.ts +306 -52
- package/src/checkrow.ts +1 -0
- package/src/cloth-targets.json +10 -0
- package/src/config.ts +50 -43
- package/src/configwrite.ts +132 -13
- package/src/instruments.ts +2 -2
- package/src/outputpaths.ts +24 -0
- package/src/physicscontrib.ts +311 -0
- package/src/propose.ts +30 -22
package/docs/STABILITY.md
CHANGED
|
@@ -457,6 +457,33 @@ invalid fields with the same named rules as `readParts`. It never opens,
|
|
|
457
457
|
hashes or decodes PNGs and preserves the manifest reader's named refusals.
|
|
458
458
|
Legacy manifests may omit alternates, depth and painting declarations.
|
|
459
459
|
|
|
460
|
+
## Cloth targets data export
|
|
461
|
+
|
|
462
|
+
The stable named export `./cloth-targets.json` (`@rig-c/parts/cloth-targets.json`)
|
|
463
|
+
ships the cloth-recipe target tags as a data-only JSON file (issue #1433):
|
|
464
|
+
|
|
465
|
+
```json
|
|
466
|
+
{
|
|
467
|
+
"schema": "rig-parts/cloth-targets@1",
|
|
468
|
+
"targets": [
|
|
469
|
+
"bottomwear",
|
|
470
|
+
"back hair",
|
|
471
|
+
"front hair",
|
|
472
|
+
"handwear-r",
|
|
473
|
+
"handwear-l"
|
|
474
|
+
]
|
|
475
|
+
}
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
The object carries fixed key order (`schema`, then `targets`), two-space
|
|
479
|
+
indentation, and one trailing newline. `targets` lists the tags in
|
|
480
|
+
`CLOTH_TARGETS`' order, held equal to `src/cloth.ts` by a tree control
|
|
481
|
+
(`bun tools/check_cloth_targets.ts --write` regenerates the file). Consumers
|
|
482
|
+
read or resolve the file by its package exports key
|
|
483
|
+
(`@rig-c/parts/cloth-targets.json`), not by its internal path inside the
|
|
484
|
+
package. Adding a tag to `targets` is a minor change; removing or renaming a
|
|
485
|
+
tag, or changing `schema`, is a major change.
|
|
486
|
+
|
|
460
487
|
## Commands and flags
|
|
461
488
|
|
|
462
489
|
Exit codes are part of the interface: **0** the command did what it says, **1** it
|
|
@@ -532,8 +559,9 @@ and do not certify visibility. See the
|
|
|
532
559
|
| `assemble` | `--propose-plan` with `--source`, `--full`, `--config`, optional `--head`, `--write-config` (must name `--config` itself, issue #356); or `--source`, `--full`, `--config`, `--out`, optional `--head` (without it, one run: issue #359), `--seam` (near-white, silhouette), `--project` (core, visible), `--alt` (repeatable `<name>=<source>:<full>[:<head>]`, issue #454), `--requirements` (source-bound cut-material evidence only when the file declares `cut_material`, issue #888); or `--emit-fill-masks` (a directory) with `--source`, `--full`, `--config`, optional `--head` (each cut's hidden-band mask on the painting grid, issue #1230); or `--help` (`-h`) |
|
|
533
560
|
| `head-crop-preflight` | `--full`, `--canvas`, `--head-box` (JSON coordinate array); optional `--help` (`-h`); read-only advice before the head run, original alpha > 8 samples (issue #1082) |
|
|
534
561
|
| `propose` | `--head-box` with `--full`, `--canvas`; optional `--no-back-hair`, `--write-config` (existing config, issue #356), `--help` (`-h`) |
|
|
535
|
-
| `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes), `--only-missing` (only with `--parts` and `--write-config`, not with `--cloth` or `--from-config`, issue #671 — additive: without it nothing `--write-config` writes changes) `--bust-landmarks` (rig-pixel apex_r/apex_l and optional cleavage), or `--no-bust` (non-blank omission reason), one required when drafting a chest-holding torso, both incompatible with `--from-config
|
|
562
|
+
| `propose` | `--parts`, `--source`, `--out`; optional `--compare` or `--from-config` (one of them), `--keypoints`, `--person` and `--wrist-snap` (each with `--keypoints`), `--full`, `--head` (the turn control's depths; not with `--from-config`), `--grid-rule` (`figure` or `part`, the drafted lattice's spacing; not with `--from-config`), `--cloth` (a config whose `cloth` block is the recipe, issue #364; not with `--from-config`), `--write-config` (existing config for an ordinary proposal, issue #356; a new file with `--cloth`, issue #537; not with `--from-config` — additive: without it nothing `propose` writes changes), `--from` (the config the recipe is changed from, only with `--write-config`, issue #571 — additive: without it nothing `--write-config` writes changes), `--only-missing` (only with `--parts` and `--write-config`, not with `--cloth` or `--from-config`, issue #671 — additive: without it nothing `--write-config` writes changes) `--bust-landmarks` (rig-pixel apex_r/apex_l and optional cleavage; a `<file>.provenance.json` beside it is read and checked, and its pending shape needs `--write-config`, issue #1382), or `--no-bust` (non-blank omission reason), one required when drafting a chest-holding torso, both incompatible with `--from-config`; on a sampled body-turn neck config, either with `--write-config` and without `--full` / `--head` writes the chest alone (issue #1436), `--help` (`-h`) |
|
|
536
563
|
| `propose` | `--parts`, `--source`, `--out`, `--full`, `--head`, `--write-config` together: the [neck draft](AUTHORING.md#a-neck-that-moves-on-its-own) for an existing config with `turn.body` and one neck plan row; reassembles under `<out>/rig`, preserves the sampled turn and drafts a rigid neck unit (issue #826) |
|
|
564
|
+
| `bust-landmarks` | `--from-act`, `--parts`, `--config`, `--out`; optional `--write-config` (takes the act's `alpha`, `clearance`, `spacing`, `bone_r` and `bone_l` into the config's existing `meshes.<part>.contour.bust` when the act's three points are the declared ones, a field the act omits removed; the config is untouched when none differs, and when the act moves the points, whose shape is then pending in the record (issue #1443) — additive: without it nothing the command writes changes), `--help` (`-h`) (issue #1382; one `rig-review/act@9` chest row to the landmarks file `propose` reads, with `<out>.provenance.json` beside it) |
|
|
537
565
|
| `compare` | `--left`, `--right`; optional `--map`, `--help` (`-h`) |
|
|
538
566
|
| `rig` | `--config`, `--parts`, `--out`; optional `--idle-keys` (ctl, direct), `--page-edges` (pot, free), `--pack-shape` (rect, polygon), `--page-size`, `--help` (`-h`) |
|
|
539
567
|
| `check-parts` | `--parts`, `--out`; optional `--json`, `--help` (`-h`) |
|
|
@@ -557,6 +585,35 @@ command's flag union; `comfy paint` and `comfy seethrough` are checked separatel
|
|
|
557
585
|
Required combinations within a mode remain the CLI's; the `cli` suite's controls
|
|
558
586
|
read them from the help.
|
|
559
587
|
|
|
588
|
+
`bust-landmarks` (issue #1382) arrives in a minor version and is stable like every
|
|
589
|
+
command in the table. This page does not separate provisional commands. The
|
|
590
|
+
promise covers its command line and flags, and its refusal codes:
|
|
591
|
+
`BUST_LANDMARKS_ACT`, `BUST_LANDMARKS_ROW`, `BUST_LANDMARKS_SLOT`,
|
|
592
|
+
`BUST_LANDMARKS_PART_ROWS`, `BUST_LANDMARKS_ROWS`, `BUST_LANDMARKS_FRAME`,
|
|
593
|
+
`BUST_LANDMARKS_SHAPE` and `BUST_LANDMARKS_OUT`, and `CONFIG_BUST_CLEARANCE` for points the
|
|
594
|
+
shape `propose` will check them with does not fit (issue #1441). It also covers the landmarks
|
|
595
|
+
file it writes, which holds the three keys `propose` reads, in rig px. And it
|
|
596
|
+
covers the provenance record: its spec id `rig-parts-bust-landmarks-provenance/1`,
|
|
597
|
+
its keys and their order: `spec`, `act` (`schema`, `act_id`, `file_sha256`),
|
|
598
|
+
`row_sha256`, `slot`, `source` (`hash`, `frame`), `landmarks_sha256`, and, only
|
|
599
|
+
when the act's shape differs from the config's after defaults and the config
|
|
600
|
+
declared no `contour.bust` or the act moves its points (issue #1443), `shape` (`status`, `pending` or `applied`, and `fields`, in the
|
|
601
|
+
shorthand's key order). `propose --bust-landmarks` reads that record when it
|
|
602
|
+
sits beside the landmarks file, writes a pending shape with `--write-config` and
|
|
603
|
+
marks it applied, and refuses by name `PROPOSE_BUST_SIDECAR`,
|
|
604
|
+
`PROPOSE_BUST_SIDECAR_DIGEST`, `PROPOSE_BUST_SIDECAR_PART` and
|
|
605
|
+
`PROPOSE_BUST_PENDING`; with no record beside the file it reads the file as
|
|
606
|
+
before. On a sampled body-turn neck config (`turn.body` and a plan part tagged
|
|
607
|
+
`neck`, issue #1436), `--bust-landmarks` or `--no-bust` with `--write-config` and
|
|
608
|
+
without `--full` and `--head` is the chest-only write: it writes the chest
|
|
609
|
+
carrier's `contour.bust` and the `boob_r` / `boob_l` bones and no other entry,
|
|
610
|
+
derives a missing cleavage from the config's own `neck` and `hip` bones, and
|
|
611
|
+
says which source the cleavage came from. A carrier that is not a contour mesh
|
|
612
|
+
is refused by name, `PROPOSE_BUST_CARRIER_MESH`; the chest flags with `--full` or
|
|
613
|
+
`--head` stay `PROPOSE_NECK_MODE`. The row digest rule (the sha256 of the row's `edit` with object keys sorted recursively, recomputed and refused on a mismatch) is a copy of review's request digest. The act's grammar is review's. This package reads
|
|
614
|
+
`rig-review/act@9` only, and refuses another act version by name until a later
|
|
615
|
+
minor version reads it.
|
|
616
|
+
|
|
560
617
|
The [command reference](AUTHORING.md#command-reference) describes each mode;
|
|
561
618
|
[writing proposed config fields](AUTHORING.md#writing-proposed-config-fields)
|
|
562
619
|
records the existing-file and fresh-file destinations and byte-preservation rules.
|
|
@@ -786,7 +843,8 @@ literally, but cannot be siblings. `diagnosticSiblings` checks the entire siblin
|
|
|
786
843
|
scope before its writes, using the mapped folders' ASCII lowercase spellings.
|
|
787
844
|
A collision raises `DIAGNOSTIC_PATH_SEGMENT` naming both original inputs,
|
|
788
845
|
both folder spellings and their shared case-folded folder. Scopes are extremes
|
|
789
|
-
animations, retained render sets
|
|
846
|
+
animations, retained render sets (a preflight on the animation names before
|
|
847
|
+
any render), selected alternate-set folders, and each of
|
|
790
848
|
`requirements/as-declared`, `requirements/released` and `requirements/full`.
|
|
791
849
|
Check preflights all known scopes before creating or clearing its output;
|
|
792
850
|
requirement measurement also preflights before cleanup, and retained copies
|
|
@@ -801,14 +859,22 @@ applied. The suffix is appended after unit mapping and included in that length
|
|
|
801
859
|
check; it does not change the name's encoding.
|
|
802
860
|
|
|
803
861
|
`extremes/<segment>/` uses the original animation name. Retained render sets
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
862
|
+
are named by rig-c's render, not by this package (issue #1367): from
|
|
863
|
+
rig-c/core#1744 on, `rigc render` writes each frame-set folder with this same
|
|
864
|
+
mapping plus `@<fps>fps` outside the protocol 12 fps, and records it under
|
|
865
|
+
`frames.json`'s `sets[].dir`. The retained copy takes every `sets[].dir` as it
|
|
866
|
+
is and copies `frames.json` byte for byte; it maps no name a second time. A
|
|
867
|
+
`sets[].dir` that is absent, not a string, empty, absolute, a dot segment,
|
|
868
|
+
holds a path separator or a unit outside `[A-Za-z0-9_@+.~-]`, ends in `.`, is
|
|
869
|
+
a Windows device basename, or is longer than 255 characters is refused as
|
|
870
|
+
`FRAMES_SIDECAR` naming the set and the value, as are two recorded folders
|
|
871
|
+
that share an ASCII-case-folded spelling; every set is validated before a
|
|
872
|
+
destination is created. A render from a core before rig-c/core#1744 records
|
|
873
|
+
an unsafe animation name raw, so its copy is refused rather than renamed. The
|
|
874
|
+
original animation fields, including `extremes.json`, and the public
|
|
875
|
+
`<id>:<name>` animation names stay unchanged. Readers follow `sets[].dir`
|
|
876
|
+
rather than reconstructing a folder from `animation`. Fixed root sidecar names
|
|
877
|
+
and bytes are copied verbatim.
|
|
812
878
|
|
|
813
879
|
The same mapping applies to alternate-set folders in `setup_still/`,
|
|
814
880
|
`setup_still_auto/` and `seam/`, the complete ranked seam-picture filename stem,
|
|
@@ -1044,7 +1110,7 @@ execution in historical evidence is inferred from a current export.
|
|
|
1044
1110
|
| `parts.json`, `parts/<name>.png` | `assemble`, `build` | one record per part: `from` (`<run>:<tag>` with a See-through v3 tag, `<run>:author:<label>` for a layer the author made — issue #256, read by no role rule — or `painting:<name>` for a patch), `cut_from` on a cut's piece only (the plan part it was cut from, issue #230), `limb` on a limb segment's part only (issue #349: `name`, `segment`, `of`, `bone`, and below a joint `joint`, `range` when the config segment declares one (issue #360), and `cap` — `at`, `width`, `radius`, `box`, `layer_px`, `image_px` with a cap image, `image_layer` after it when that image was a hidden-art layer — issue #359, `<run>:<layer>:hidden` — `missing_px`, `short_px` (`left`, `right`) after it only when `missing_px` is above 0 (issue #557, additive), `excluded_px` after them only on a subset set's limb part whose cap the set exclusion took a pixel of (issue #603, additive: each pixel taken out of the count it was in, so the cap's counts are the written PNG's), then `shape` and `upper_px` under the segment's `cap_shape` — `upper_px` without the shape only when the upper segment gave a pixel (issue #557, additive) — and after them `lower_px`, `lower_kept_px` and `lower_missing_px` under `cap_shape: "ball"` (issue #579, additive), and `edge`, `feather_radius` and `feathered_px` under its `edge`, and `cut_band`, `cut_offset`, `cut_at`, `cut_crossed`, `joint_crossed`, `band_px` and `stroke_luma_max` (when the band has a split) under its `cut_band`, issue #360), the box `x`, `y`, `w`, `h` (rig px), the pixel counts `src/parts.ts` documents (`opaque_px`, `visible_px`, `occluded_px`, `projected_core_px`, `source_px_taken`, `visible_not_projected_px`, `refused_drift_px`, `merged_px` — on a subset set's limb part counted after the set exclusion, issue #603 — `seam_override_px`, and `fringe_pushed_back` when not empty); per-part `taken_layers` (with optional `transport`, issue #973, and optional `split` — `occluder`, `image`, `sha256`, `covered_px`, `visible_px` — on a split take, additive, issue #1242) and `provenance` (`unchanged_layer_px`, `hand_px`, `automatic_px`, `edits`, `automatic`, additive, issue #823); optional top-level [`assembly_config`](#assembly-config-reading), `motion_seams`, `occluder_plates` (one record per `assemble.occluders` entry declaring `plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256`, additive, issue #1237), `occluder_grow` (one record per `assemble.occluders` entry with `grow > 0` — `occluder`, `image`, `grow`, `covered_px_before`, `covered_px_after`, additive, issue #1251), `occluder_guard` (one record per `assemble.occluders` entry with `guard > 0` — `occluder`, `image`, `guard`, `guarded_px_before`, `guarded_px_after`, additive, issue #1259), `alternates` and `cut_ownership` (one row per cut, independent of RGBA equality, issue #823, with optional `under_plate` — `receipt`, `receipt_sha256`, `occluder_sha256`, `painting_sha256`, `output_sha256`, `mask_sha256` — on a `{plate}` under, additive, issue #1230); `rig_size`, `scale_rig_per_source`, `ghost_px`, `recomposite`, and `scene` (`figure_alpha_above`, `figure_px`, `figure_mask`) under `config.scene` only, with the figure's mask `figure_rig.png` beside the recomposite (issue #242), and the same bytes beside `parts.json` when the two directories differ (issue #1177); `single_run_pad` (`file_size`, `side`, `left`, `top`) last, only for one run whose file is not the `seethrough.resolution` square (issue #366) |
|
|
1045
1111
|
| `rig/rig.json`, `rig/motion.json`, `rig/images/` | `rig`, `build`, `compose` | rig-c's rig spec and motion spec, `spec` `rigc-rig/1` and `rigc-motion/1`: the format is rig-c's, and this package writes only what rig-c's parser accepts; a bone carries `inherit` only where config.bones declares one, rig-c's mode name as written (issue #348) |
|
|
1046
1112
|
| `rig/mesh_report.json` | `rig`, `build` | one row per mesh: `part`, `vertices`, `triangles`, `hull`, `bones` (the sorted names the attachment's weights bind in the written `rig.json`, in every mode — since 1.49.1 (issue #536) a rig with `turn` or `stops` names the twins and `<link>_d` bones there, where the row named the segment bones they replace: a fix of a wrong name, not a format change; a rig with neither writes the bytes it wrote), `max_influences`, `mean_influences`, `art_coverage`, then `grid` (a lattice); or `mode` "explicit" with `image_sha256` and `region_sha256` (the verified guards; counts and coverage are measured from the supplied mesh, no legacy generator report is adopted); `mode` "contour" with `params`, `contour`, `regions` (`params.maxEdge` and `contour.outlineCut` only when the mesh declares `contour.maxEdge`; `params.bridges` and `contour.bridges` — `islands`, `units`, `joins`, and `faint` only when an island was left out as faint — only when it declares `contour.bridges`); or `mode` "influence" with `influence` (as declared), `reach` (`farthest`, `at`, `nearest`, `capped`, `widest`) and `lattice` (rig-c's `SegmentsLatticeReport`: `cols`, `rows`, `artCells`, `keptCells`, `passes`, `islands`) (issue #378); or `mode` "auto" with `settings`, `source`, `result`, `residuals`, `worst_residual`, `worst_region`, `motion_amplitude`, `termination`, `weights`, `regions`, `deformation`, `quality_report` (rig-c's `mesh-quality-report/1` document whole), `motion_report`, and, only when they apply, `stray_cleared` (after `source`, when `source.stray` is declared), `skinning_residual` and `replay` (`AutoMeshReport` in `src/rig.ts`); in every mode, `exponent` when the mesh declares one (after `grid`, or after `mode`); `influences`, as declared, when a lattice or contour mesh declares it (after `exponent`, or where `exponent` would be); `stray` and `stray_cleared` when a lattice mesh declares `stray` (after `influences`, or where `influences` would be); `ribs` when a contour or auto mesh declares them (after `exponent`, or after `mode`), and then `contour.ribs` (`source.contour.ribs` in the automatic mode) |
|
|
1047
|
-
| `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates GAP on proven body-root pairs only (gap-only; mixed ghost remains INFO until rig-c/core#1555 supplies owners): `status` — `WARN`, `CLEAR`, `SKIP` or `FAIL` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, optional `root` (`limb`, `bone`, `parent`) on a proven body-root pair, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`, and only on new-root rows stock `gapOpen` plus UNDER-owned `ghostA`/`ghostB` cells selected by resolved per-frame draw order gate their summed count against the unchanged strict one-cell floor on the original raw kind boxes (their union when both kinds contribute), never narrowed partition boxes, while `gapCovered` and OVER-owned ghost cells are excluded (issue #711); `cells` retains partition counts, UNDER owner and counted total, `worst` retains frame/count/cell/box, and `roots` retains status, mode `gap-open+under-ghost`, ghost_owner `resolved-draw-order`, pairs, failed, reason and optional unmeasured bindings; eligible candidates whose valid setup bands are all zero retain a named unmeasured root and SKIP bar, including when no pair is selected; measured root FAIL wins over SKIP, while measured PASS plus an unmeasured root remains SKIP; every eligible body drawing with stock setup `banded > 0` is selected, including both when a parent is shared; issue #708 resolves a body slot on its exact generated turn child to the same named carrier only after unique identity-bone/control/per-part-transform proof, without changing pair identity, setup selection or the direct-carrier path; setup-only observation preserves the authored motion and default drawing, root-free inputs add no setup compile/render, and no animation remains SKIP rather than a measured zero; existing internal pair warnings and their exits are unchanged; issue #941 adds optional `required` only under the requirements file's `seam_over_motion.required: true` — `status` (`PASS` or `FAIL`), `mode` `gap-open`, `bar_px` 0, `pairs` (each `pair`, `class` — `body-root`, `internal-joint` or `explicit` — `frames`, `background_frames`, `max_px`) and `failed` — and with it the key is written even when no pair is declared; issue #591 adds optional `worlds` on physics rigs with readable declared pairs and animations: `default` and `still`, each `wind`, `gravity`, `status` (`REPORTED` or `SKIP`), `reason` on SKIP, `dir` only when rendered (relative to check.json: `seam_motion/default` or `seam_motion/still`, the complete retained render with frames.json and each animation's raw seam.json), and `rows` — pair, animation, status, drawn, banded, `gap` and `ghost`, each `max_px` and `worst` only; worst carries `index`, `px`, `cell`, `box`. Per-frame hits stay in the raw sidecars. These raw reference readings add no bar or warning and leave the custom environment reading unchanged), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `WIND_BAND` after it under `--wind-band` only (issue #590, additive: `status` `"REPORTED"`, `spec` `"rig-parts-wind-band/1"`, `path` as given, `sha256`, `steady_wind_only` `true`, `gravity` `[0, 1]`, `min`, `max`, `step`, `steps`, `fps`, `animations`, `max_gap`, `max_ghost`, `holds_from`, `holds_to`, `pairs_holding_all`, and `pairs` — each `pair`, `a`, `b`, `holds_all`, `holds_from`, `holds_to`, `first_break_below`, `first_break_above`, `worst_gap`, `worst_ghost`, `steps`), `skipped`, `config` under `build` only (issue #607, additive: `path` as `--config` was typed, `sha256` of the bytes the build read; `check` and `compose` read no config and write none), a `requirements` block under `--requirements` (or `build`'s `config.requirements`) — `file` first from issue #556, additive: `path` as typed or declared, `sha256`, `keys` — and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes, and `check/build-report.json` (`<out>/build-report.json` under standalone `check`) is rig-c's own `build-report/1` (`--report`) for that primary packed compile, written verbatim by `rigc` beside `check/build/` (and listed in `check/build/run.json`'s `outputs[]` as `../build-report.json`) on a failing compile as on a green one (issue #1394; `rig` keeps no compile report because its gate and `--lead-in` compiles are throwaway scratch runs whose outputs are deleted). Missing stock partitions or resolved owner are named refusals, never zero. No whole-box exemption or consumer compositor remains; internal warnings and reference raw readings are unchanged. |
|
|
1113
|
+
| `check/check.json` and the rest of `check/` | `check`, `build`, `compose` | [Check verdict spec](#check-report-rig-parts-check1) followed by the reference's fields in its order (`gate_spine_html_green`, `rigc_entry`, `pack_mode` (with `page_size` under `--page-size` only, issue #1273, additive), `environment` after it under `--environment` only (issue #538, additive: `path` as given, `sha256`, `steps`), `loop_max_diff`, the seam figures — `seam_mean`, `seam_px_over_40`, `seam_px_over_80` and, from issue #216, `seam_frame_scale`, the frame scale the bar divides the count by), `loop_physics` after `loop_max_diff` when the rig declares a physics constraint, `seam_border` after the seam figures when `parts.json` declares a scene (issue #242), `seam_pairs` after the seam figures when the seam bar fails or `--seam-pairs` asks (each row's picture under `check/seam/`; `--keep-stills` leaves the setup-pose still and its `frames.json` under `check/setup_still/`), then the judgement lines (`BREATH_VISIBLE`, `BLINK_NO_HOLE`, `CHAIN_LAG`, `TIP_OVER_ROOT`, `STILL_REGIONS_DARK`, `TEXTURE_STRETCH`), `ANIMATIONS_DO_NOT_FOLD` after them when `motion.json` holds an animation, the idle included — on every rig with an idle since issue #333 (issues #320, #363: `status`, `animations`, `fps`, `physics_left_out`, `folding` — each `animation`, `slot`, `attachment`, `frames`, `worst_frame`, `worst_triangles`, `triangles`, `physics_on`, `physics_off`, `physics_constraints`, `declared`, `line` — `folding_undeclared`, `declared_not_folding`, `bar`), `FEET_STAY_LEVEL` after it when a `footwear` part rides a bone that hangs from another and `motion.json` holds an animation (issue #348: `status`, `reason` on a SKIP only, `animations`, `fps`, `physics_left_out`, `bar_degrees`, `bar`, `feet` — each `part`, `bone`, `hangs_from`, `status`, `frames_posed`, `worst`), `LIMB_ONE_BONE` after it (and after `STRESS_OFF_CHAIN` where that is written) when `parts.json` holds a limb segment's part (issue #349: `status`, `parts` — each `part`, `limb`, `bone`, `status`, `others`), `SEAM_OVER_RANGE` after it when a limb record carries a `range` (issue #360: `status`, `frame_scale`, `physics_left_out`, `bar` — `mean`, `rig_px_over_40`, `level` — and `joints`, each `part`, `limb`, `segment`, `joint`, `bone`, `range`, `at`, `radius`, `under_px`, `status`, `poses` — each `degrees`, `status`, `mean`, `px_over_40`, `px_over_80`, `rig_px_over_40`, and `step_px` (`left`, `right`) only on a joint whose cap record carries `short_px` (issue #557, additive) — and `unread` on a joint not read), `SEAM_OVER_MOTION` after it when `parts.json` holds a limb segment or `--requirements` a `seam` (issue #493 retains existing pair warnings; issue #686 gates GAP on proven body-root pairs only (gap-only; mixed ghost remains INFO until rig-c/core#1555 supplies owners): `status` — `WARN`, `CLEAR`, `SKIP` or `FAIL` — `reason` on a SKIP only, `fps`, `floor`, `pairs` — each `pair`, `a`, `b`, `declared`, optional `root` (`limb`, `bone`, `parent`) on a proven body-root pair, and `unread` on a pair not read — `animations`, `warnings`, `rows` — each `pair`, `animation`, `status`, `drawn`, `banded`, `opens`, `px`, `max_px`, `under_floor`, and only on new-root rows stock `gapOpen` plus UNDER-owned `ghostA`/`ghostB` cells selected by resolved per-frame draw order gate their summed count against the unchanged strict one-cell floor on the original raw kind boxes (their union when both kinds contribute), never narrowed partition boxes, while `gapCovered` and OVER-owned ghost cells are excluded (issue #711); `cells` retains partition counts, UNDER owner and counted total, `worst` retains frame/count/cell/box, and `roots` retains status, mode `gap-open+under-ghost`, ghost_owner `resolved-draw-order`, pairs, failed, reason and optional unmeasured bindings; eligible candidates whose valid setup bands are all zero retain a named unmeasured root and SKIP bar, including when no pair is selected; measured root FAIL wins over SKIP, while measured PASS plus an unmeasured root remains SKIP; every eligible body drawing with stock setup `banded > 0` is selected, including both when a parent is shared; issue #708 resolves a body slot on its exact generated turn child to the same named carrier only after unique identity-bone/control/per-part-transform proof, without changing pair identity, setup selection or the direct-carrier path; setup-only observation preserves the authored motion and default drawing, root-free inputs add no setup compile/render, and no animation remains SKIP rather than a measured zero; existing internal pair warnings and their exits are unchanged; issue #941 adds optional `required` only under the requirements file's `seam_over_motion.required: true` — `status` (`PASS` or `FAIL`), `mode` `gap-open`, `bar_px` 0, `pairs` (each `pair`, `class` — `body-root`, `internal-joint` or `explicit` — `frames`, `background_frames`, `max_px`) and `failed` — and with it the key is written even when no pair is declared; issue #591 adds optional `worlds` on physics rigs with readable declared pairs and animations: `default` and `still`, each `wind`, `gravity`, `status` (`REPORTED` or `SKIP`), `reason` on SKIP, `dir` only when rendered (relative to check.json: `seam_motion/default` or `seam_motion/still`, the complete retained render with frames.json and each animation's raw seam.json), and `rows` — pair, animation, status, drawn, banded, `gap` and `ghost`, each `max_px` and `worst` only; worst carries `index`, `px`, `cell`, `box`. Per-frame hits stay in the raw sidecars. These raw reference readings add no bar or warning and leave the custom environment reading unchanged), `CLOTH_SETTLES` after it when the rig declares a physics constraint and has an idle (issue #501, a warning and not a bar: `status` — `WARN` or `CLEAR` — `fps`, `frames`, `duration`, `floor_rig_px_per_s`, `floor`, `levers`, `warnings`, `rows` — each `tip`, `root`, `links`, `point`, `settles_at`, `max_rig_px_per_s`, `min_rig_px_per_s`), `PHYSICS_CONTRIBUTES` after it when the rig declares a physics constraint and has an idle and parts (issue #1320, report-only, no bar and no threshold: `status` — `WARN` when a part under physics reads exactly 0, else `CLEAR`; a named `SKIP` writes no key — `off` (what "physics off" means: the same compiled build posed with the poser's physics off, not the spec with its constraints left out), `points`, `world`, `poser`, `fps`, `frames`, `warnings`, `rows` — each `part`, `constraints`, `external_force`, then `vertices`, `frames_read`, `max_rig_px`, `p95_rig_px`, `mean_rig_px`, `max_of_diagonal`, `moves`, or `unmeasured` with its reason), `RECOMPOSITE_HOLES` (its first figure `declared_scene` when `parts.json` declares a scene), `SETUP_POSE_VS_SOURCE`, `WIND_BAND` after it under `--wind-band` only (issue #590, additive: `status` `"REPORTED"`, `spec` `"rig-parts-wind-band/1"`, `path` as given, `sha256`, `steady_wind_only` `true`, `gravity` `[0, 1]`, `min`, `max`, `step`, `steps`, `fps`, `animations`, `max_gap`, `max_ghost`, `holds_from`, `holds_to`, `pairs_holding_all`, and `pairs` — each `pair`, `a`, `b`, `holds_all`, `holds_from`, `holds_to`, `first_break_below`, `first_break_above`, `worst_gap`, `worst_ghost`, `steps`), `skipped`, `config` under `build` only (issue #607, additive: `path` as `--config` was typed, `sha256` of the bytes the build read; `check` and `compose` read no config and write none), a `requirements` block under `--requirements` (or `build`'s `config.requirements`) — `file` first from issue #556, additive: `path` as typed or declared, `sha256`, `keys` — and `PASS`; `check/build/skeleton.json`, `.atlas` and `.png` are the packed artifact rig-c writes, and `check/build-report.json` (`<out>/build-report.json` under standalone `check`) is rig-c's own `build-report/1` (`--report`) for that primary packed compile, written verbatim by `rigc` beside `check/build/` (and listed in `check/build/run.json`'s `outputs[]` as `../build-report.json`) on a failing compile as on a green one (issue #1394; `rig` keeps no compile report because its gate and `--lead-in` compiles are throwaway scratch runs whose outputs are deleted). Missing stock partitions or resolved owner are named refusals, never zero. No whole-box exemption or consumer compositor remains; internal warnings and reference raw readings are unchanged. |
|
|
1048
1114
|
| `part_support_domains.json` | `assemble`, `build` | optional `rig-parts-support-domains/1` independent cut masks and unavailable reasons, with per-domain config-entry provenance and parts/PNG/payload digests; additive beside parts.json, whose bytes and PNGs are unchanged. Legacy output may omit it. `PART_SUPPORT_REPORT` reads pairs in the assembly placement frame and Unowned in actual setup, never as an acceptance gate. |
|
|
1049
1115
|
| `layers.json`, `<index>_<name>.png` | `layers --export` | the wrapper form `layers` reads (issue #359): `width`, `height`, then `layers` — each `name`, `filename`, `left`, `top`, `right`, `bottom`, `depth_median` (the input's own; `null` for a PSD, the manifest's order then being the draw order) — drawn layers in draw order, then the hidden-art layers; a PNG's name is its index and its layer's name, and the manifest, not the file name, says which layer it is |
|
|
1050
1116
|
| the template `.psd` | `layers --template` | one empty layer per name `templateLayerNames` (`src/layers.ts`) holds, bottom first; the same canvas writes the same bytes |
|
|
@@ -1671,16 +1737,18 @@ PASS. Existing render/sidecar refusals remain refusals. The standing
|
|
|
1671
1737
|
bracketed-run definition does not certify curved or diagonal openings.
|
|
1672
1738
|
|
|
1673
1739
|
Per-cell samples are a bounded diagnostic sample; the counts are the
|
|
1674
|
-
measurement (
|
|
1740
|
+
measurement (issues #1403, #1406). Each measured `samples[]` list (setup standing, idle
|
|
1675
1741
|
`motion_opened` on every idle frame, and turn `motion_opened` on every turn
|
|
1676
1742
|
pose; idle and turn `standing` are never measured and their `samples[]` are
|
|
1677
|
-
always `[]`) holds at most 64 rows.
|
|
1678
|
-
A list that measured more holds 64 and gains `samples_omitted
|
|
1743
|
+
always `[]`) and each `unread_corridors[].cells` list holds at most 64 rows.
|
|
1744
|
+
A list that measured more holds 64 and gains `samples_omitted` (or
|
|
1745
|
+
`cells_omitted` on an unread corridor), the number of
|
|
1679
1746
|
rows left out; a list of 64 or fewer has no such field and is written as before.
|
|
1680
1747
|
Standing keeps its 64 worst rows: counted first, then the larger of the two
|
|
1681
|
-
distances' minimum, then the earlier measured row. Motion-opened rows
|
|
1748
|
+
distances' minimum, then the earlier measured row. Motion-opened rows and
|
|
1749
|
+
unread-corridor cells carry no
|
|
1682
1750
|
distance and keep rows floor(j · n / 64), j = 0 … 63, of the n measured. Kept
|
|
1683
|
-
rows stay in measured order. Every count, `px`, `box`, hit, span, run and status
|
|
1751
|
+
rows stay in measured order. Every count (`cell_count`, `unread_cells`), `px`, `box`, hit, span, run and status
|
|
1684
1752
|
is computed from all cells.
|
|
1685
1753
|
|
|
1686
1754
|
Issue #1323 adds `behind_seams.turn: true` as an explicit opt-in. It references
|
|
@@ -1727,6 +1795,35 @@ one pair is optional SKIP even when another pair has a required override.
|
|
|
1727
1795
|
An unavailable poser or source is a HOLE. Other animations, between-sample turns and alternate
|
|
1728
1796
|
skins remain unmeasured.
|
|
1729
1797
|
|
|
1798
|
+
Issue #1409 reads `motion_opened` on a contact-only pair: one with no setup
|
|
1799
|
+
overlap band (no cell drawn at 128/255 or more by both members at setup) whose
|
|
1800
|
+
stock transported support is otherwise complete. Such a pair's idle and turn
|
|
1801
|
+
readings may change from unmeasured (`SKIP` with a `HOLE`) to `PASS` or `FAIL`.
|
|
1802
|
+
The reading carries a setup contact edge (a cell drawn only by A beside a cell
|
|
1803
|
+
drawn only by B) to the frame through both members' meshes and counts the swept
|
|
1804
|
+
cells, drawn by neither member there, that either map carries back onto that
|
|
1805
|
+
member's setup material. Pairs with a band never enter this reading and their
|
|
1806
|
+
`check.json` bytes are unchanged, `limitations` included. New optional fields,
|
|
1807
|
+
each present only on a pair read this way:
|
|
1808
|
+
|
|
1809
|
+
| Field | Stable meaning |
|
|
1810
|
+
| --- | --- |
|
|
1811
|
+
| `pairs[].motion_support`, `pairs[].frames[].motion_support`, `turn.pairs[].motion_support`, `turn.pairs[].frames[].motion_support` | `"setup-contact"`: the motion reading came from transported setup contact edges, not an overlap band. |
|
|
1812
|
+
| `pairs[].frames[].motion_opened.lower_bound_cells`, `turn.pairs[].frames[].motion_opened.lower_bound_cells` | Present only when positive: swept cells that pass the hidden/full/rear tests but that neither member's map carries back onto setup material. They are not counted, so this row's count is a lower bound. |
|
|
1813
|
+
| `pairs[].motion_opened.lower_bound_frames`, `turn.pairs[].motion_opened.lower_bound_poses` | Present only when positive: the number of frame or pose rows that carry `lower_bound_cells`. |
|
|
1814
|
+
|
|
1815
|
+
A line with at least one such pair appends one clause to `limitations`, and a
|
|
1816
|
+
turn block with one appends it to `turn.limitations`. Two limits hold. A count on a row with `lower_bound_cells` is a lower bound: a
|
|
1817
|
+
member that separates from its partner by about its own width or more sweeps
|
|
1818
|
+
cells that no map carries back. A member that draws more than one fragment at
|
|
1819
|
+
setup or on a frame is not read: that frame is a named `HOLE` in
|
|
1820
|
+
`unmeasured[]` (`CHECK_BEHIND_PART_SEAMS_UNMEASURED` with an authored T), and so
|
|
1821
|
+
is a frame where a clip cuts either member at setup or on that frame, because a
|
|
1822
|
+
clipped drawing is not its attachment's and cannot be carried through it. A
|
|
1823
|
+
pair whose members overlap only below 128/255 and share no contact edge keeps a
|
|
1824
|
+
named `HOLE` that says so; a pair with neither band nor contact keeps the
|
|
1825
|
+
existing `HOLE` text.
|
|
1826
|
+
|
|
1730
1827
|
Issue #1325 adds the following optional evidence fields to
|
|
1731
1828
|
`BEHIND_PART_SEAMS.pairs[].setup.standing` (idle `frames[].standing` and turn
|
|
1732
1829
|
`turn.pairs[].frames[].standing` are never measured). Paths in
|
|
@@ -1738,8 +1835,9 @@ the table are relative to that standing record.
|
|
|
1738
1835
|
| `unread_corridors` | Nonempty array of ambiguous-endpoint runs (at setup, those with at least one cell where `dRecomposite > T`), horizontal rows before vertical columns, each in native scan order. |
|
|
1739
1836
|
| `unread_corridors[].axis` | `horizontal` or `vertical`. |
|
|
1740
1837
|
| `unread_corridors[].endpoints` | Two `[grid_x, grid_y, world_x, world_y, owner]` tuples in left/right or top/bottom order. Grid indices are zero-based, x right and y down; world coordinates are cell centres, y up. Owner codes are 0 for neither A/B reaching half alpha, 1 for A only, 2 for B only and 3 for both; no owner is inferred. |
|
|
1741
|
-
| `unread_corridors[].cells` | Interior world-centre `[x, y]` tuples in run order, excluding endpoints. On a corridor whose endpoint owner is ambiguous (`0` or `3`) at setup, cells within T of the parts' recomposite (`dRecomposite <= T`) are left out of the unread population; the remaining interior cells are reported without a rear-colour or endpoint-contrast filter; intersections may repeat across corridors. |
|
|
1742
|
-
| `unread_corridors[].cell_count` | The
|
|
1838
|
+
| `unread_corridors[].cells` | Interior world-centre `[x, y]` tuples in run order, excluding endpoints, capped at 64 evenly spaced entries (`floor(j · cell_count / 64)`, `j = 0 … 63`, when `cell_count > 64`; all `cell_count` entries when `cell_count <= 64`). On a corridor whose endpoint owner is ambiguous (`0` or `3`) at setup, cells within T of the parts' recomposite (`dRecomposite <= T`) are left out of the unread population; the remaining interior cells are reported without a rear-colour or endpoint-contrast filter; intersections may repeat across corridors. |
|
|
1839
|
+
| `unread_corridors[].cell_count` | The corridor's full count of unread interior cells (at setup, leaving out cells within T of the recomposite), equal to `cells.length + (cells_omitted ?? 0)`. |
|
|
1840
|
+
| `unread_corridors[].cells_omitted` | Optional positive integer, present only when `cell_count > 64`: the unread interior cells left out of `cells` (`cell_count - cells.length`). |
|
|
1743
1841
|
| `unread_corridors[].row_scope` | `pair`. |
|
|
1744
1842
|
| `unread_corridors[].row_kind` | `evidence`. |
|
|
1745
1843
|
| `unread_corridors[].row_subjects` | The two selected part names in producer A/B order. |
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.51.0",
|
|
4
4
|
"description": "AI-authored 2D character parts from one anime painting and its See-through layer decomposition: measured parts, weighted-mesh rig specs, verified through rig-c before anything is written. A CLI for agents that cannot see the image.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
"./assembly-reading": "./src/assembly-reading.ts",
|
|
8
|
+
"./cloth-targets.json": "./src/cloth-targets.json",
|
|
8
9
|
"./*": "./*"
|
|
9
10
|
},
|
|
10
11
|
"bin": {
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
},
|
|
75
76
|
"dependencies": {
|
|
76
77
|
"ag-psd": "^31.0.2",
|
|
77
|
-
"@rig-c/core": "3.8.
|
|
78
|
+
"@rig-c/core": "3.8.1"
|
|
78
79
|
},
|
|
79
80
|
"devDependencies": {
|
|
80
81
|
"@esotericsoftware/spine-core": "4.3.13",
|
package/src/behindseams.ts
CHANGED
|
@@ -3,8 +3,8 @@ import { createHash } from 'node:crypto';
|
|
|
3
3
|
import { isAbsolute, join, relative, resolve } from 'node:path';
|
|
4
4
|
import { Plate } from '@rig-c/core/plate';
|
|
5
5
|
import type { AttachmentRest, Frame } from '@rig-c/core/render-shared';
|
|
6
|
-
import { seamGridOf, seamsOf, setupCellReader, type SeamCell, type SeamGrid } from '@rig-c/core/seam';
|
|
7
|
-
import { DRAWN_ALPHA } from '@rig-c/core/passthrough';
|
|
6
|
+
import { carry, seamGridOf, seamsOf, setupCellReader, type SeamCell, type SeamGrid } from '@rig-c/core/seam';
|
|
7
|
+
import { DRAWN_ALPHA, drawnCells, drawsAt } from '@rig-c/core/passthrough';
|
|
8
8
|
import { checkRow } from './checkrow.ts';
|
|
9
9
|
import { seamSourceAttachment, type MotionSeamPair } from './check.ts';
|
|
10
10
|
import type { Problem } from './errors.ts';
|
|
@@ -19,6 +19,9 @@ export const IDLE_STANDING_MOTION_READ_REASON = 'not applicable: motion_opened r
|
|
|
19
19
|
export const IDLE_STANDING_NO_ORACLE_REASON = "idle standing is not measured: idle frames have no recomposite oracle, and the pair's idle reading is motion_opened";
|
|
20
20
|
export const TURN_STANDING_MOTION_READ_REASON = IDLE_STANDING_MOTION_READ_REASON;
|
|
21
21
|
export const TURN_STANDING_NO_ORACLE_REASON = "turn standing is not measured: turn poses have no recomposite oracle, and the pair's turn reading is motion_opened";
|
|
22
|
+
/** Issue #1409: the marker on a pair, frame or turn row whose motion_opened is read from transported setup contact edges. */
|
|
23
|
+
export const CONTACT_MOTION_SUPPORT = 'setup-contact';
|
|
24
|
+
export const CONTACT_LIMITATIONS = '; contact-only pairs (no setup overlap band) read motion from transported setup contact edges, and a frame or pose with lower_bound_cells counts a lower bound';
|
|
22
25
|
|
|
23
26
|
export interface BehindSeams {
|
|
24
27
|
/** Opt in to the rig's declared ranges; never supplies or guesses a range. */
|
|
@@ -54,6 +57,8 @@ export interface BehindSeamsFramesInput {
|
|
|
54
57
|
plantMeasureIdleStanding?: true;
|
|
55
58
|
/** Issue #1412 plant only: measure standing on turn poses without an oracle; production never sets it. */
|
|
56
59
|
plantMeasureTurnStanding?: true;
|
|
60
|
+
/** Issue #1409 plant only: withhold transported setup contact-edge support; production never sets it. */
|
|
61
|
+
plantNoContact?: true;
|
|
57
62
|
}
|
|
58
63
|
export interface BehindSeamsTurnPose {
|
|
59
64
|
name: string;
|
|
@@ -80,8 +85,10 @@ export interface BehindSeamsTurnPair {
|
|
|
80
85
|
sampled_poses: number;
|
|
81
86
|
read_poses: number;
|
|
82
87
|
unmeasured_poses: number;
|
|
83
|
-
motion_opened: { status: BehindSeamsCount['status']; max_px: number };
|
|
88
|
+
motion_opened: { status: BehindSeamsCount['status']; max_px: number; lower_bound_poses?: number };
|
|
84
89
|
standing: { status: BehindSeamsCount['status']; reason?: string; max_px: number };
|
|
90
|
+
/** Issue #1409: present only when motion_opened is read from transported setup contact edges. */
|
|
91
|
+
motion_support?: typeof CONTACT_MOTION_SUPPORT;
|
|
85
92
|
}
|
|
86
93
|
export interface BehindSeamsTurnMeasured {
|
|
87
94
|
status: BehindSeamsCount['status'];
|
|
@@ -110,6 +117,10 @@ export interface BehindSeamsCount {
|
|
|
110
117
|
samples: BehindSeamsSample[];
|
|
111
118
|
/** Issue #1403: present only when the list held more than {@link BEHIND_SAMPLE_CAP} rows; the rows left out. */
|
|
112
119
|
samples_omitted?: number;
|
|
120
|
+
/** Issue #1409, contact-edge motion only: rear-visible cells inside a transported contact-edge sweep, drawn by neither
|
|
121
|
+
* member, that neither member's map carries back onto setup material of the pair. Present only when positive; px is
|
|
122
|
+
* then a lower bound. */
|
|
123
|
+
lower_bound_cells?: number;
|
|
113
124
|
}
|
|
114
125
|
export type BehindSeamsEndpoint = [grid_x: number, grid_y: number, world_x: number, world_y: number, owner: number];
|
|
115
126
|
export interface BehindSeamsUnreadCorridor {
|
|
@@ -118,6 +129,8 @@ export interface BehindSeamsUnreadCorridor {
|
|
|
118
129
|
endpoints: [BehindSeamsEndpoint, BehindSeamsEndpoint];
|
|
119
130
|
cells: Array<[number, number]>;
|
|
120
131
|
cell_count: number;
|
|
132
|
+
/** Issue #1406: present only when the corridor held more than {@link BEHIND_SAMPLE_CAP} cells; the cells left out. */
|
|
133
|
+
cells_omitted?: number;
|
|
121
134
|
}
|
|
122
135
|
export interface BehindSeamsStanding extends BehindSeamsCount {
|
|
123
136
|
/** Present when standing is SKIP: at setup without --parts, or on every idle frame and turn pose. */
|
|
@@ -139,6 +152,8 @@ export interface BehindSeamsFrame {
|
|
|
139
152
|
grid: SeamGrid | null;
|
|
140
153
|
motion_opened: BehindSeamsCount;
|
|
141
154
|
standing: BehindSeamsStanding;
|
|
155
|
+
/** Issue #1409: present only when this frame's motion_opened is read from transported setup contact edges. */
|
|
156
|
+
motion_support?: typeof CONTACT_MOTION_SUPPORT;
|
|
142
157
|
}
|
|
143
158
|
export interface BehindSeamsHit {
|
|
144
159
|
index: number;
|
|
@@ -160,6 +175,8 @@ export interface BehindSeamsReading {
|
|
|
160
175
|
max_run: { frames: number; seconds: number };
|
|
161
176
|
max_spatial_run_cells: number;
|
|
162
177
|
max_spatial_run_world: number;
|
|
178
|
+
/** Issue #1409, motion_opened of a contact-edge pair only: frames whose count is a lower bound; present only when positive. */
|
|
179
|
+
lower_bound_frames?: number;
|
|
163
180
|
}
|
|
164
181
|
export interface BehindSeamsPair {
|
|
165
182
|
animation: 'idle';
|
|
@@ -176,6 +193,8 @@ export interface BehindSeamsPair {
|
|
|
176
193
|
sampled_frames?: number;
|
|
177
194
|
read_frames?: number;
|
|
178
195
|
unmeasured_frames?: number;
|
|
196
|
+
/** Issue #1409: present only when motion_opened is read from transported setup contact edges. */
|
|
197
|
+
motion_support?: typeof CONTACT_MOTION_SUPPORT;
|
|
179
198
|
}
|
|
180
199
|
export interface BehindSeamsMeasured {
|
|
181
200
|
status: 'PASS' | 'FAIL' | 'SKIP';
|
|
@@ -362,6 +381,112 @@ function overWhite(data: Uint8Array, q: number, c: number): number {
|
|
|
362
381
|
return Math.round((data[q + c] * data[q + 3]) / 255 + 255 * (1 - data[q + 3] / 255));
|
|
363
382
|
}
|
|
364
383
|
|
|
384
|
+
type Point = [number, number];
|
|
385
|
+
type ContactSupport = { cells: Set<number>; uncounted: Set<number> } | { hole: string } | null;
|
|
386
|
+
|
|
387
|
+
/** The convex hull of `points`, counter-clockwise, collinear points dropped (core's own rule in its seam module). */
|
|
388
|
+
function hullOf(points: Point[]): Point[] {
|
|
389
|
+
const sorted = [...points].sort((p, q) => p[0] - q[0] || p[1] - q[1]);
|
|
390
|
+
const turn = (o: Point, a: Point, b: Point): number => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]);
|
|
391
|
+
const half = (list: Point[]): Point[] => {
|
|
392
|
+
const out: Point[] = [];
|
|
393
|
+
for (const p of list) {
|
|
394
|
+
while (out.length >= 2 && turn(out[out.length - 2], out[out.length - 1], p) <= 0) out.pop();
|
|
395
|
+
out.push(p);
|
|
396
|
+
}
|
|
397
|
+
return out;
|
|
398
|
+
};
|
|
399
|
+
if (sorted.length <= 1) return sorted;
|
|
400
|
+
return [...half(sorted).slice(0, -1), ...half([...sorted].reverse()).slice(0, -1)];
|
|
401
|
+
}
|
|
402
|
+
/** Whether (qx, qy) lies in the hull, boundary included; a two-point hull is its segment. */
|
|
403
|
+
function inHull(h: readonly Point[], qx: number, qy: number): boolean {
|
|
404
|
+
if (h.length === 0) return false;
|
|
405
|
+
if (h.length === 1) return h[0][0] === qx && h[0][1] === qy;
|
|
406
|
+
if (h.length === 2) {
|
|
407
|
+
const [[x0, y0], [x1, y1]] = h;
|
|
408
|
+
if ((x1 - x0) * (qy - y0) - (qx - x0) * (y1 - y0) !== 0) return false;
|
|
409
|
+
return qx >= Math.min(x0, x1) && qx <= Math.max(x0, x1) && qy >= Math.min(y0, y1) && qy <= Math.max(y0, y1);
|
|
410
|
+
}
|
|
411
|
+
for (let i = 0; i < h.length; i++) {
|
|
412
|
+
const [x0, y0] = h[i], [x1, y1] = h[(i + 1) % h.length];
|
|
413
|
+
if ((x1 - x0) * (qy - y0) - (qx - x0) * (y1 - y0) < 0) return false;
|
|
414
|
+
}
|
|
415
|
+
return true;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/**
|
|
419
|
+
* Issue #1409: motion support for a pair whose two drawings share no cell at half opacity at setup (no overlap band).
|
|
420
|
+
* A setup contact edge is the shared edge between a cell only `a` draws and a cell only `b` draws at 128/255 or more
|
|
421
|
+
* (core's `drawnCells`). Each edge's two corners are carried to the frame through BOTH members' attachment maps (core's
|
|
422
|
+
* `carry`); the hull of the four images is that edge's sweep. A frame cell is support when its centre lies in a sweep,
|
|
423
|
+
* neither member draws it, and either member's map carries it back onto setup material of `a` or `b` (core's `drawsAt`,
|
|
424
|
+
* the same either-view rule as core's gap). A sweep cell drawn by neither and carried back by neither is `uncounted`:
|
|
425
|
+
* where it shows rear, the count is a lower bound. Null when there is no contact edge and no faint overlap; a named
|
|
426
|
+
* `hole` when a member draws more than one fragment, a clip cuts a member, or the members overlap only below 128/255.
|
|
427
|
+
*/
|
|
428
|
+
function contactSupport(api: BehindSeamsApi, pair: MotionSeamPair, setup: Frame, frame: Frame, input: BehindSeamsFramesInput, grid: SeamGrid, label: string): ContactSupport {
|
|
429
|
+
for (const [where, f] of [['at setup', setup], [`on ${label}`, frame]] as const) for (const slot of [pair.a, pair.b]) {
|
|
430
|
+
const n = f.pieces.filter(p => p.slot === slot).length;
|
|
431
|
+
if (n !== 1) return { hole: `setup contact support requires one drawn fragment per pair member: pair "${pair.pair}" member "${slot}" draws ${n} fragments ${where}; 1 is required; motion-opened is not measured` };
|
|
432
|
+
}
|
|
433
|
+
const piece = (f: Frame, slot: string) => f.pieces.find(p => p.slot === slot)!;
|
|
434
|
+
// A clipped piece's `world` is the clipper's cut, not its attachment's vertices, so the rest triangles cannot index it
|
|
435
|
+
// (core's stock seam refuses the same drawing by name). Checked here, not left to a refusal upstream.
|
|
436
|
+
for (const [where, f] of [['at setup', setup], [`on ${label}`, frame]] as const) for (const slot of [pair.a, pair.b]) {
|
|
437
|
+
const p = piece(f, slot);
|
|
438
|
+
if (p.kind === 'mesh' && p.source !== undefined) return { hole: `setup contact support requires unclipped pair members: pair "${pair.pair}" member "${slot}" is cut by a clip ${where}, so its drawing is no longer its attachment's and cannot be carried through its attachment map; motion-opened is not measured` };
|
|
439
|
+
}
|
|
440
|
+
const sa = piece(setup, pair.a), sb = piece(setup, pair.b), fa = piece(frame, pair.a), fb = piece(frame, pair.b);
|
|
441
|
+
const restOf = (slot: string) => {
|
|
442
|
+
const attachment = frame.attachments?.find(a => a.slot === slot)?.attachment;
|
|
443
|
+
return input.rest.find(r => r.slot === slot && r.attachment === attachment);
|
|
444
|
+
};
|
|
445
|
+
const ra = restOf(pair.a), rb = restOf(pair.b);
|
|
446
|
+
if (ra === undefined || rb === undefined || setup.attachments === undefined) return null;
|
|
447
|
+
const sg = seamGridOf({ a: pair.a, b: pair.b }, input.rest, { ...setup, attachments: setup.attachments }, input.pages);
|
|
448
|
+
if (sg === null) return null;
|
|
449
|
+
const page = (p: Frame['pieces'][number]): Plate => api.pageFor(input.pages, p);
|
|
450
|
+
const sv = sg.viewport, W = sv.width;
|
|
451
|
+
const dA = drawnCells(sa, page(sa), sv), dB = drawnCells(sb, page(sb), sv);
|
|
452
|
+
const own = (k: number): number => (dA[k] ? 1 : 0) | (dB[k] ? 2 : 0);
|
|
453
|
+
const X = (x: number): number => sv.minX + x * sg.cell, Y = (y: number): number => sv.maxY - y * sg.cell;
|
|
454
|
+
const edges: Array<[Point, Point]> = [];
|
|
455
|
+
for (let y = 0; y < sv.height; y++) for (let x = 0; x < W; x++) {
|
|
456
|
+
const k = y * W + x, o = own(k);
|
|
457
|
+
if (o !== 1 && o !== 2) continue;
|
|
458
|
+
if (x + 1 < W) { const q = own(k + 1); if ((q === 1 || q === 2) && q !== o) edges.push([[X(x + 1), Y(y)], [X(x + 1), Y(y + 1)]]); }
|
|
459
|
+
if (y + 1 < sv.height) { const q = own(k + W); if ((q === 1 || q === 2) && q !== o) edges.push([[X(x), Y(y + 1)], [X(x + 1), Y(y + 1)]]); }
|
|
460
|
+
}
|
|
461
|
+
if (edges.length === 0) {
|
|
462
|
+
const faintA = new Uint8Array(sv.width * sv.height), project = api.projector(sv);
|
|
463
|
+
api.rasterisePiece(page(sa), sa, project, sv, (x, y, _r, _g, _b, alpha) => { if (alpha > 0) faintA[y * W + x] = 1; });
|
|
464
|
+
let faint = 0;
|
|
465
|
+
api.rasterisePiece(page(sb), sb, project, sv, (x, y, _r, _g, _b, alpha) => { if (alpha > 0 && faintA[y * W + x] === 1) { faintA[y * W + x] = 2; faint++; } });
|
|
466
|
+
if (faint === 0) return null;
|
|
467
|
+
return { hole: `pair "${pair.pair}" has no overlap band and no setup contact edge: its members overlap only below ${DRAWN_ALPHA}/255 at setup (${faint} cell(s) drawn by both at positive alpha, none by both at ${DRAWN_ALPHA}/255 or more, and no cell drawn by one member alone borders a cell drawn by the other alone); motion-opened is not measured` };
|
|
468
|
+
}
|
|
469
|
+
const sweeps: Point[][] = [];
|
|
470
|
+
for (const [p, q] of edges) {
|
|
471
|
+
const images = [carry(ra.triangles, ra.vertices, fa.world, -1, p[0], p[1]), carry(ra.triangles, ra.vertices, fa.world, -1, q[0], q[1]),
|
|
472
|
+
carry(rb.triangles, rb.vertices, fb.world, -1, p[0], p[1]), carry(rb.triangles, rb.vertices, fb.world, -1, q[0], q[1])];
|
|
473
|
+
if (images.some(v => v === null)) return { hole: `pair "${pair.pair}": a setup contact edge cannot be carried to ${label} because every triangle of a member has collapsed; motion-opened is not measured` };
|
|
474
|
+
sweeps.push(hullOf(images as Point[]));
|
|
475
|
+
}
|
|
476
|
+
const { viewport: v, cell } = grid, cells = new Set<number>(), uncounted = new Set<number>();
|
|
477
|
+
const nowA = drawnCells(fa, page(fa), v), nowB = drawnCells(fb, page(fb), v);
|
|
478
|
+
const material = (at: Point | null): boolean => at !== null && (drawsAt(sa, page(sa), at[0], at[1], cell) || drawsAt(sb, page(sb), at[0], at[1], cell));
|
|
479
|
+
for (let y = 0; y < v.height; y++) for (let x = 0; x < v.width; x++) {
|
|
480
|
+
const k = y * v.width + x;
|
|
481
|
+
if (nowA[k] || nowB[k]) continue;
|
|
482
|
+
const qx = v.minX + (x + 0.5) * cell, qy = v.maxY - (y + 0.5) * cell;
|
|
483
|
+
if (!sweeps.some(h => inHull(h, qx, qy))) continue;
|
|
484
|
+
if (material(carry(ra.triangles, fa.world, ra.vertices, -1, qx, qy)) || material(carry(rb.triangles, fb.world, rb.vertices, -1, qx, qy))) cells.add(k);
|
|
485
|
+
else uncounted.add(k);
|
|
486
|
+
}
|
|
487
|
+
return { cells, uncounted };
|
|
488
|
+
}
|
|
489
|
+
|
|
365
490
|
function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pair: MotionSeamPair, frame: Frame, setup: boolean,
|
|
366
491
|
stock: BehindSeamsStockPair | undefined, threshold: number, allowance: number, unread: (frame: string, reason: string) => void,
|
|
367
492
|
cache: Map<Frame, Map<string, RasterCache>>, pose?: BehindSeamsTurnPose): BehindSeamsFrame {
|
|
@@ -456,8 +581,10 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
456
581
|
unreadCells.add(at); cells.push(centre(grid, at));
|
|
457
582
|
}
|
|
458
583
|
if (cells.length === 0) continue;
|
|
584
|
+
const kept = evenlySpaced(cells.length, input.sampleCap ?? BEHIND_SAMPLE_CAP).map(i => cells[i]);
|
|
459
585
|
unreadCorridors.push({ ...checkRow('BEHIND_PART_SEAMS.unread_corridors', 'pair', false, [pair.a, pair.b]),
|
|
460
|
-
axis: step === 1 ? 'horizontal' : 'vertical', endpoints: [endpoint(left, a), endpoint(right, b)], cells, cell_count: cells.length
|
|
586
|
+
axis: step === 1 ? 'horizontal' : 'vertical', endpoints: [endpoint(left, a), endpoint(right, b)], cells: kept, cell_count: cells.length,
|
|
587
|
+
...(cells.length > kept.length ? { cells_omitted: cells.length - kept.length } : {}) });
|
|
461
588
|
continue;
|
|
462
589
|
}
|
|
463
590
|
if (a === b) continue;
|
|
@@ -478,8 +605,19 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
478
605
|
}
|
|
479
606
|
let motionReadable = setup;
|
|
480
607
|
const motionCells = new Map<number, SeamCell>();
|
|
608
|
+
let lowerBound = new Set<number>(), contactRead = false;
|
|
481
609
|
if (!setup) {
|
|
482
|
-
|
|
610
|
+
const complete = stock !== undefined && stock.frames === input.idle.length && stock.drawn === stock.frames;
|
|
611
|
+
const contact = complete && stock.banded === 0 && input.setup !== null && input.plantNoContact !== true
|
|
612
|
+
? contactSupport(api, pair, input.setup, frame, input, grid, label) : null;
|
|
613
|
+
if (contact !== null && 'hole' in contact) unread(label, contact.hole);
|
|
614
|
+
else if (contact !== null) {
|
|
615
|
+
// Like stock gapCovered: support cells have positive rendered alpha from some drawing.
|
|
616
|
+
motionReadable = true;
|
|
617
|
+
contactRead = true;
|
|
618
|
+
for (const k of contact.cells) if (rasters.full.data[k * 4 + 3] !== 0) { const [x, y] = centre(grid, k); motionCells.set(k, { x, y, setupTop: null, setupUnder: null }); }
|
|
619
|
+
lowerBound = contact.uncounted;
|
|
620
|
+
} else if (!complete || stock.banded !== stock.frames) unread(label, `stock transported setup-overlap support is unavailable on every ${pose === undefined ? 'idle frame' : 'named turn pose'}; motion-opened is not measured`);
|
|
483
621
|
else {
|
|
484
622
|
motionReadable = true;
|
|
485
623
|
const hits = stock.gapCovered.filter(h => h.index === frame.index);
|
|
@@ -497,7 +635,7 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
497
635
|
}
|
|
498
636
|
}
|
|
499
637
|
}
|
|
500
|
-
const targets = new Set([...corridors.keys(), ...motionCells.keys()]);
|
|
638
|
+
const targets = new Set([...corridors.keys(), ...motionCells.keys(), ...lowerBound]);
|
|
501
639
|
const rear = material(n), weights = new Map<number, Map<string, number>>();
|
|
502
640
|
const surviving = new Set<number>(), underflow = new Set<number>();
|
|
503
641
|
for (const piece of frame.pieces) api.rasterisePiece(api.pageFor(input.pages, piece), piece, project, viewport, (x, y, r, g, b, alpha) => {
|
|
@@ -574,6 +712,8 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
574
712
|
if (rear.alpha[k] <= 0 || underflow.has(k)) { motionReadable = false; unread(label, 'positive symbolic rear contribution underflowed its numeric colour weight'); continue; }
|
|
575
713
|
motionHits.add(k);
|
|
576
714
|
}
|
|
715
|
+
let uncounted = 0;
|
|
716
|
+
for (const k of lowerBound) if (rasters.hidden.data[k * 4 + 3] === 0 && rasters.full.data[k * 4 + 3] !== 0 && surviving.has(k) && rear.alpha[k] > 0) uncounted++;
|
|
577
717
|
// Motion-opened rows carry no distance; keep evenly spaced rows, built only for what is kept.
|
|
578
718
|
const hitCells = [...motionHits];
|
|
579
719
|
row.motion_opened.samples = evenlySpaced(hitCells.length, cap).map(i => sample(hitCells[i], null, true));
|
|
@@ -582,6 +722,8 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
582
722
|
row.motion_opened.geometric_px = motionHits.size; row.motion_opened.raw_px = motionHits.size;
|
|
583
723
|
counted(row.motion_opened, motionHits, grid, allowance);
|
|
584
724
|
if (!motionReadable) row.motion_opened.status = 'SKIP';
|
|
725
|
+
if (contactRead && motionReadable && uncounted > 0) row.motion_opened.lower_bound_cells = uncounted;
|
|
726
|
+
if (contactRead && motionReadable) row.motion_support = CONTACT_MOTION_SUPPORT;
|
|
585
727
|
if (isIdle && !plantIdleStanding) {
|
|
586
728
|
row.standing = {
|
|
587
729
|
...emptyCount('SKIP'),
|
|
@@ -673,6 +815,9 @@ export function measureBehindSeamFrames(api: BehindSeamsApi, input: BehindSeamsF
|
|
|
673
815
|
const parts: [string, string] = [pair.a, pair.b];
|
|
674
816
|
const motion = reading(frames, 'motion_opened', input.fps, allowance, parts);
|
|
675
817
|
if ((setup === null || setup.motion_opened.status === 'SKIP') && motion.status !== 'FAIL') motion.status = 'SKIP';
|
|
818
|
+
const contactRead = frames.some(f => f.motion_support !== undefined);
|
|
819
|
+
const lowerBoundFrames = frames.filter(f => f.motion_opened.lower_bound_cells !== undefined).length;
|
|
820
|
+
if (lowerBoundFrames > 0) motion.lower_bound_frames = lowerBoundFrames;
|
|
676
821
|
const idleStandingReason = motion.status !== 'SKIP' ? IDLE_STANDING_MOTION_READ_REASON : IDLE_STANDING_NO_ORACLE_REASON;
|
|
677
822
|
const rawStanding = reading(frames, 'standing', input.fps, allowance, parts);
|
|
678
823
|
const standing: BehindSeamsReading = input.plantMeasureIdleStanding === true
|
|
@@ -691,8 +836,10 @@ export function measureBehindSeamFrames(api: BehindSeamsApi, input: BehindSeamsF
|
|
|
691
836
|
const readFrames = frames.filter(f => f.motion_opened.status !== 'SKIP' &&
|
|
692
837
|
!line.unmeasured.some(u => u.pair === pair.pair && u.frame === `idle frame ${f.index}`)).length;
|
|
693
838
|
line.pairs.push({ ...checkRow('BEHIND_PART_SEAMS.pairs', 'pair', failed, parts), animation: 'idle', pair: pair.pair, parts, declared: [...pair.declared], threshold, allowance, setup, frames, motion_opened: motion, standing,
|
|
694
|
-
sampled_frames: input.idle.length, read_frames: readFrames, unmeasured_frames: input.idle.length - readFrames
|
|
839
|
+
sampled_frames: input.idle.length, read_frames: readFrames, unmeasured_frames: input.idle.length - readFrames,
|
|
840
|
+
...(contactRead ? { motion_support: CONTACT_MOTION_SUPPORT } : {}) });
|
|
695
841
|
}
|
|
842
|
+
if (line.pairs.some(p => p.motion_support !== undefined)) line.limitations += CONTACT_LIMITATIONS;
|
|
696
843
|
line.status = problems.length > start ? 'FAIL' : line.pairs.length === 0 || line.pairs.some(p => p.threshold === null || p.setup === null || p.setup.standing.status === 'SKIP' || p.motion_opened.status === 'SKIP') ? 'SKIP' : 'PASS';
|
|
697
844
|
if (declared.turn === true) {
|
|
698
845
|
line.turn = measureBehindTurnFrames(api, input, declared, problems);
|
|
@@ -760,11 +907,14 @@ function measureBehindTurnFrames(api: BehindSeamsApi, input: BehindSeamsFramesIn
|
|
|
760
907
|
// Both clauses overlap on purpose, as in idle readFrames: every path leaving motion_opened SKIP also records turn.unmeasured[].
|
|
761
908
|
const read = rows.filter(row => row.motion_opened.status !== 'SKIP' &&
|
|
762
909
|
!result.unmeasured.some(u => u.pair === pair.pair && u.frame === `turn ${row.pose}`)).length;
|
|
763
|
-
const aggregate = (kind: 'motion_opened' | 'standing'): { status: BehindSeamsCount['status']; max_px: number } => ({
|
|
910
|
+
const aggregate = (kind: 'motion_opened' | 'standing'): { status: BehindSeamsCount['status']; max_px: number; lower_bound_poses?: number } => ({
|
|
764
911
|
status: rows.some(r => r[kind].status === 'FAIL') ? 'FAIL' : complete && rows.length === turn.poses.length && rows.every(r => r[kind].status === 'PASS') ? 'PASS' : 'SKIP',
|
|
765
912
|
max_px: Math.max(0, ...rows.map(r => r[kind].px)),
|
|
766
913
|
});
|
|
767
914
|
const motion = aggregate('motion_opened');
|
|
915
|
+
const lowerBoundPoses = rows.filter(r => r.motion_opened.lower_bound_cells !== undefined).length;
|
|
916
|
+
if (lowerBoundPoses > 0) motion.lower_bound_poses = lowerBoundPoses;
|
|
917
|
+
const turnContactRead = rows.some(r => r.motion_support !== undefined);
|
|
768
918
|
const turnStandingReason = motion.status !== 'SKIP' ? TURN_STANDING_MOTION_READ_REASON : TURN_STANDING_NO_ORACLE_REASON;
|
|
769
919
|
const rawStanding = aggregate('standing');
|
|
770
920
|
const standing: BehindSeamsTurnPair['standing'] = input.plantMeasureTurnStanding === true
|
|
@@ -772,8 +922,9 @@ function measureBehindTurnFrames(api: BehindSeamsApi, input: BehindSeamsFramesIn
|
|
|
772
922
|
: { status: 'SKIP', reason: turnStandingReason, max_px: 0 };
|
|
773
923
|
result.pairs.push({ ...checkRow('BEHIND_PART_SEAMS.turn.pairs', 'pair', motion.status === 'FAIL' || standing.status === 'FAIL' || threshold !== null && read !== turn.poses.length, parts),
|
|
774
924
|
pair: pair.pair, parts, threshold, allowance, frames: rows, sampled_poses: turn.poses.length, read_poses: read, unmeasured_poses: turn.poses.length - read,
|
|
775
|
-
motion_opened: motion, standing });
|
|
925
|
+
motion_opened: motion, standing, ...(turnContactRead ? { motion_support: CONTACT_MOTION_SUPPORT } : {}) });
|
|
776
926
|
}
|
|
927
|
+
if (result.pairs.some(p => p.motion_support !== undefined)) result.limitations += CONTACT_LIMITATIONS;
|
|
777
928
|
if (input.pairs.length === 0) unread(null, 'turn selection', 'no selected seam pair; turn boundary population is unavailable', required);
|
|
778
929
|
result.status = result.pairs.some(p => p.motion_opened.status === 'FAIL' || p.standing.status === 'FAIL') || mandatoryUnread ? 'FAIL'
|
|
779
930
|
: result.pairs.length === 0 || result.pairs.some(p => p.motion_opened.status === 'SKIP') ? 'SKIP' : 'PASS';
|
|
@@ -1037,14 +1188,16 @@ export function behindSeamLines(line: BehindSeamsMeasured | null): string[] {
|
|
|
1037
1188
|
if (r.reason !== undefined) {
|
|
1038
1189
|
return `${BEHIND_SEAM_LINE}: pair "${p.pair}" ${kind} ${r.status} — ${r.reason}; threshold ${p.threshold === null ? 'undeclared' : p.threshold}, allowance ${p.allowance}`;
|
|
1039
1190
|
}
|
|
1040
|
-
|
|
1191
|
+
const support = kind === 'motion_opened' && p.motion_support !== undefined
|
|
1192
|
+
? `; support ${p.motion_support}${r.lower_bound_frames === undefined ? '' : `, lower bound on ${r.lower_bound_frames} frame(s)`}` : '';
|
|
1193
|
+
return `${BEHIND_SEAM_LINE}: pair "${p.pair}" ${kind} ${r.status} — ${r.hit_frames}/${p.frames.length} idle hit frames, sampled/read/unmeasured ${p.sampled_frames ?? p.frames.length}/${p.read_frames ?? 0}/${p.unmeasured_frames ?? 0}, max_px ${r.max_px}, max_run ${r.max_run.frames} frames (${r.max_run.seconds} s), max_spatial_run_cells ${r.max_spatial_run_cells} (${r.max_spatial_run_world} world units), earliest worst ${w === null ? 'none' : `frame ${w.index} t ${w.time}, cell ${w.cell}, box [${w.box.join(', ')}]`}; threshold ${p.threshold === null ? 'undeclared' : p.threshold}, allowance ${p.allowance}${support}`;
|
|
1041
1194
|
};
|
|
1042
1195
|
const setupStanding = setup === null ? '' : setup.standing.reason !== undefined ? `${setup.standing.status} (${setup.standing.reason}), ${setup.standing.px} cells` : setup.standing.px > 0 && setup.standing.status === 'SKIP' ? `${setup.standing.px} cells` : `${setup.standing.status}, ${setup.standing.px} cells`;
|
|
1043
1196
|
return [summary('motion_opened'), summary('standing'), `${BEHIND_SEAM_LINE}: pair "${p.pair}" setup ${setup === null ? 'SKIP — HOLE: setup not read' : `standing ${setupStanding}; motion_opened ${setup.motion_opened.status}, ${setup.motion_opened.px} cells; behind [${setup.behind_slots.join(', ')}]`}`];
|
|
1044
1197
|
}),
|
|
1045
1198
|
...(line.turn === undefined ? [] : [
|
|
1046
1199
|
`${BEHIND_SEAM_LINE}: turn ${line.turn.status} — ${line.turn.poses.length} preselected endpoint/corner pose(s); ${line.turn.limitations}`,
|
|
1047
|
-
...line.turn.pairs.flatMap(p => p.frames.map(f => `${BEHIND_SEAM_LINE}: pair "${p.pair}" turn ${f.pose} — motion_opened ${f.motion_opened.status}, ${f.motion_opened.px} cells; standing ${f.standing.reason !== undefined ? `${f.standing.status} (${f.standing.reason})` : f.standing.status}, ${f.standing.px} cells; threshold ${p.threshold}, allowance ${p.allowance}`)),
|
|
1200
|
+
...line.turn.pairs.flatMap(p => p.frames.map(f => `${BEHIND_SEAM_LINE}: pair "${p.pair}" turn ${f.pose} — motion_opened ${f.motion_opened.status}, ${f.motion_opened.px} cells${f.motion_support === undefined ? '' : ` (support ${f.motion_support}${f.motion_opened.lower_bound_cells === undefined ? '' : `, lower bound: ${f.motion_opened.lower_bound_cells} uncounted`})`}; standing ${f.standing.reason !== undefined ? `${f.standing.status} (${f.standing.reason})` : f.standing.status}, ${f.standing.px} cells; threshold ${p.threshold}, allowance ${p.allowance}`)),
|
|
1048
1201
|
...line.turn.unmeasured.map(u => `${BEHIND_SEAM_LINE}: ${u.pair === null ? 'rig' : `pair "${u.pair}"`} ${u.frame} SKIP — ${u.reason}`),
|
|
1049
1202
|
]),
|
|
1050
1203
|
...line.unmeasured.map(u => {
|