@rig-c/parts 2.47.0 → 2.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/AUTHORING.md +9 -9
- package/docs/STABILITY.md +11 -0
- package/package.json +1 -1
- package/src/behindseams.ts +67 -2
package/docs/AUTHORING.md
CHANGED
|
@@ -9539,18 +9539,18 @@ Internal `SeamSupport.drawings` never enters check JSON. Named requirement
|
|
|
9539
9539
|
| `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | `ANIMATIONS_DO_NOT_FOLD.declared_not_folding` | part when the supplied mapping resolves a piece; otherwise rig | finding | resolved piece for e.slot; otherwise [] | [check.ts:3697](../src/check.ts#L3697) |
|
|
9540
9540
|
| `ANIMATIONS_DO_NOT_FOLD.folding` | `ANIMATIONS_DO_NOT_FOLD.folding` | part when the supplied mapping resolves a piece; otherwise rig | finding when entry === undefined; otherwise evidence | resolved piece for slot; otherwise [] | [check.ts:3659](../src/check.ts#L3659) |
|
|
9541
9541
|
| `ART_JOINT_DISTANCE.joints` | `ART_JOINT_DISTANCE.joints` | 'rig' | finding when status === 'FAIL'; otherwise evidence | [] | [artjoints.ts:86](../src/artjoints.ts#L86) |
|
|
9542
|
-
| `BEHIND_PART_SEAMS.contributors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples[].contributors`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:
|
|
9543
|
-
| `BEHIND_PART_SEAMS.hits` | `BEHIND_PART_SEAMS.pairs[].motion_opened.frames`; `BEHIND_PART_SEAMS.pairs[].standing.frames`; `BEHIND_PART_SEAMS.pairs[].motion_opened.worst`; `BEHIND_PART_SEAMS.pairs[].standing.worst` | 'pair' | finding when r.px > allowance; otherwise evidence | parts | [behindseams.ts:
|
|
9544
|
-
| `BEHIND_PART_SEAMS.pairs` | `BEHIND_PART_SEAMS.pairs` | 'pair' | finding when failed; otherwise evidence | parts | [behindseams.ts:
|
|
9542
|
+
| `BEHIND_PART_SEAMS.contributors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples[].contributors`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples[].contributors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples[].contributors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:454](../src/behindseams.ts#L454) |
|
|
9543
|
+
| `BEHIND_PART_SEAMS.hits` | `BEHIND_PART_SEAMS.pairs[].motion_opened.frames`; `BEHIND_PART_SEAMS.pairs[].standing.frames`; `BEHIND_PART_SEAMS.pairs[].motion_opened.worst`; `BEHIND_PART_SEAMS.pairs[].standing.worst` | 'pair' | finding when r.px > allowance; otherwise evidence | parts | [behindseams.ts:521](../src/behindseams.ts#L521) |
|
|
9544
|
+
| `BEHIND_PART_SEAMS.pairs` | `BEHIND_PART_SEAMS.pairs` | 'pair' | finding when failed; otherwise evidence | parts | [behindseams.ts:598](../src/behindseams.ts#L598) |
|
|
9545
9545
|
| `BEHIND_PART_SEAMS.pairs[].frames` | `BEHIND_PART_SEAMS.pairs[].frames` | | | | |
|
|
9546
9546
|
| `BEHIND_PART_SEAMS.pairs[].setup` | `BEHIND_PART_SEAMS.pairs[].setup` | | | | |
|
|
9547
|
-
| `BEHIND_PART_SEAMS.samples` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:
|
|
9548
|
-
| `BEHIND_PART_SEAMS.spans` | `BEHIND_PART_SEAMS.pairs[].motion_opened.spans`; `BEHIND_PART_SEAMS.pairs[].standing.spans` | 'pair' | evidence | parts | [behindseams.ts:
|
|
9549
|
-
| `BEHIND_PART_SEAMS.turn.pairs` | `BEHIND_PART_SEAMS.turn.pairs` | 'pair' | finding when required; otherwise evidence; finding when motion.status === 'FAIL' || standing.status === 'FAIL' || threshold !== null && read !== turn.poses.length; otherwise evidence | [pair.a, pair.b]; parts | [behindseams.ts:
|
|
9547
|
+
| `BEHIND_PART_SEAMS.samples` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.samples`; `BEHIND_PART_SEAMS.turn.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].setup.standing.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].motion_opened.samples`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.samples` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:453](../src/behindseams.ts#L453) |
|
|
9548
|
+
| `BEHIND_PART_SEAMS.spans` | `BEHIND_PART_SEAMS.pairs[].motion_opened.spans`; `BEHIND_PART_SEAMS.pairs[].standing.spans` | 'pair' | evidence | parts | [behindseams.ts:529](../src/behindseams.ts#L529) |
|
|
9549
|
+
| `BEHIND_PART_SEAMS.turn.pairs` | `BEHIND_PART_SEAMS.turn.pairs` | 'pair' | finding when required; otherwise evidence; finding when motion.status === 'FAIL' || standing.status === 'FAIL' || threshold !== null && read !== turn.poses.length; otherwise evidence | [pair.a, pair.b]; parts | [behindseams.ts:628](../src/behindseams.ts#L628), [behindseams.ts:670](../src/behindseams.ts#L670) |
|
|
9550
9550
|
| `BEHIND_PART_SEAMS.turn.pairs[].frames` | `BEHIND_PART_SEAMS.turn.pairs[].frames` | | | | |
|
|
9551
|
-
| `BEHIND_PART_SEAMS.turn.unmeasured` | `BEHIND_PART_SEAMS.turn.unmeasured` | pair === null ? 'rig' : 'pair' | finding when mandatory; otherwise evidence | pair === null ? [] : [pair.a, pair.b] | [behindseams.ts:
|
|
9552
|
-
| `BEHIND_PART_SEAMS.unmeasured` | `BEHIND_PART_SEAMS.unmeasured` | pair === null ? 'rig' : 'pair'; 'rig' | finding when required; otherwise evidence; finding | pair === null ? [] : [pair.a, pair.b]; [] | [behindseams.ts:
|
|
9553
|
-
| `BEHIND_PART_SEAMS.unread_corridors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:
|
|
9551
|
+
| `BEHIND_PART_SEAMS.turn.unmeasured` | `BEHIND_PART_SEAMS.turn.unmeasured` | pair === null ? 'rig' : 'pair' | finding when mandatory; otherwise evidence | pair === null ? [] : [pair.a, pair.b] | [behindseams.ts:620](../src/behindseams.ts#L620) |
|
|
9552
|
+
| `BEHIND_PART_SEAMS.unmeasured` | `BEHIND_PART_SEAMS.unmeasured` | pair === null ? 'rig' : 'pair'; 'rig' | finding when required; otherwise evidence; finding | pair === null ? [] : [pair.a, pair.b]; [] | [behindseams.ts:542](../src/behindseams.ts#L542), [behindseams.ts:871](../src/behindseams.ts#L871), [behindseams.ts:903](../src/behindseams.ts#L903) |
|
|
9553
|
+
| `BEHIND_PART_SEAMS.unread_corridors` | `BEHIND_PART_SEAMS.turn.pairs[].frames[].standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].setup.standing.unread_corridors`; `BEHIND_PART_SEAMS.pairs[].frames[].standing.unread_corridors` | 'pair' | evidence | [pair.a, pair.b] | [behindseams.ts:377](../src/behindseams.ts#L377) |
|
|
9554
9554
|
| `BOUNDARY_COLOUR_STEP.over` | `BOUNDARY_COLOUR_STEP.over` | 'pair' | finding | r.parts | [boundarycolour.ts:221](../src/boundarycolour.ts#L221) |
|
|
9555
9555
|
| `BOUNDARY_COLOUR_STEP.unmeasured` | `BOUNDARY_COLOUR_STEP.unmeasured` | part when the supplied mapping resolves a piece; otherwise rig | evidence | resolved piece for r.slot; otherwise [] | [boundarycolour.ts:222](../src/boundarycolour.ts#L222) |
|
|
9556
9556
|
| `CLOTH_SETTLES.rows` | `CLOTH_SETTLES.rows` | 'rig' | finding when speeds.length > 0 && s < speeds.length; otherwise evidence | [] | [check.ts:6144](../src/check.ts#L6144) |
|
package/docs/STABILITY.md
CHANGED
|
@@ -1588,6 +1588,17 @@ motion support, boundary population or verified render evidence is a HOLE,
|
|
|
1588
1588
|
not a zero PASS. Existing render/sidecar refusals remain refusals. The standing
|
|
1589
1589
|
bracketed-run definition does not certify curved or diagonal openings.
|
|
1590
1590
|
|
|
1591
|
+
Per-cell samples are a bounded diagnostic sample; the counts are the
|
|
1592
|
+
measurement (issue #1403). Each `samples[]` list (standing and motion-opened,
|
|
1593
|
+
at setup, on every idle frame and on every turn pose) holds at most 64 rows.
|
|
1594
|
+
A list that measured more holds 64 and gains `samples_omitted`, the number of
|
|
1595
|
+
rows left out; a list of 64 or fewer has no such field and is written as before.
|
|
1596
|
+
Standing keeps its 64 worst rows: counted first, then the larger of the two
|
|
1597
|
+
distances' minimum, then the earlier measured row. Motion-opened rows carry no
|
|
1598
|
+
distance and keep rows floor(j · n / 64), j = 0 … 63, of the n measured. Kept
|
|
1599
|
+
rows stay in measured order. Every count, `px`, `box`, hit, span, run and status
|
|
1600
|
+
is computed from all cells.
|
|
1601
|
+
|
|
1591
1602
|
Issue #1323 adds `behind_seams.turn: true` as an explicit opt-in. It references
|
|
1592
1603
|
existing emitted turn slider ranges, never a second range declaration. Without
|
|
1593
1604
|
this key no turn rows are written and existing `check.json` bytes are unchanged.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rig-c/parts",
|
|
3
|
-
"version": "2.47.
|
|
3
|
+
"version": "2.47.1",
|
|
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": {
|
package/src/behindseams.ts
CHANGED
|
@@ -39,6 +39,8 @@ export interface BehindSeamsFramesInput {
|
|
|
39
39
|
stock: readonly BehindSeamsStockPair[] | null;
|
|
40
40
|
fps: number;
|
|
41
41
|
turn?: BehindSeamsTurnInput;
|
|
42
|
+
/** Issue #1403 plant only: the samples[] cap; production never sets it ({@link BEHIND_SAMPLE_CAP}). */
|
|
43
|
+
sampleCap?: number;
|
|
42
44
|
}
|
|
43
45
|
export interface BehindSeamsTurnPose {
|
|
44
46
|
name: string;
|
|
@@ -93,6 +95,8 @@ export interface BehindSeamsCount {
|
|
|
93
95
|
box: [number, number, number, number] | null;
|
|
94
96
|
max_spatial_run_cells: number;
|
|
95
97
|
samples: BehindSeamsSample[];
|
|
98
|
+
/** Issue #1403: present only when the list held more than {@link BEHIND_SAMPLE_CAP} rows; the rows left out. */
|
|
99
|
+
samples_omitted?: number;
|
|
96
100
|
}
|
|
97
101
|
export type BehindSeamsEndpoint = [grid_x: number, grid_y: number, world_x: number, world_y: number, owner: number];
|
|
98
102
|
export interface BehindSeamsUnreadCorridor {
|
|
@@ -215,6 +219,60 @@ export function behindSeamsProblems(value: unknown, at: string): Problem[] {
|
|
|
215
219
|
return problems;
|
|
216
220
|
}
|
|
217
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Issue #1403: the most `samples[]` rows one count writes. Per-cell samples are
|
|
224
|
+
* a bounded diagnostic sample; the counts are the measurement. Every count,
|
|
225
|
+
* `px`, `box`, hit, span, run and status is computed from all cells before the
|
|
226
|
+
* list is cut, and a list at or under the cap is written as it was.
|
|
227
|
+
*/
|
|
228
|
+
export const BEHIND_SAMPLE_CAP = 64;
|
|
229
|
+
|
|
230
|
+
/** One standing candidate: its measured ordinal, cell, chosen distances, whether it qualified, and the smaller distance. */
|
|
231
|
+
interface StandingCandidate { ord: number; k: number; d: [number, number]; q: boolean; m: number }
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* Whether standing candidate `a` ranks worse than `b`. The gate counts a cell
|
|
235
|
+
* when both rear-to-front distances exceed the threshold (`qualifies`), so the
|
|
236
|
+
* smaller of the two is the margin the threshold is compared against: a counted
|
|
237
|
+
* cell ranks first, then the larger smaller-distance, then the earlier measured
|
|
238
|
+
* ordinal. No two candidates tie, so the kept set is one set.
|
|
239
|
+
*/
|
|
240
|
+
export function standingWorse(a: Pick<StandingCandidate, 'ord' | 'q' | 'm'>, b: Pick<StandingCandidate, 'ord' | 'q' | 'm'>): boolean {
|
|
241
|
+
if (a.q !== b.q) return a.q;
|
|
242
|
+
if (a.m !== b.m) return a.m > b.m;
|
|
243
|
+
return a.ord < b.ord;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* The {@link BEHIND_SAMPLE_CAP} worst standing candidates seen so far, without
|
|
248
|
+
* keeping the others: at most `cap` entries live at once.
|
|
249
|
+
*/
|
|
250
|
+
export class WorstStanding {
|
|
251
|
+
readonly kept: StandingCandidate[] = [];
|
|
252
|
+
seen = 0;
|
|
253
|
+
constructor(readonly cap: number = BEHIND_SAMPLE_CAP) {}
|
|
254
|
+
offer(k: number, d: [number, number], q: boolean): void {
|
|
255
|
+
const c: StandingCandidate = { ord: this.seen++, k, d, q, m: d[0] < d[1] ? d[0] : d[1] };
|
|
256
|
+
if (this.kept.length < this.cap) { this.kept.push(c); return; }
|
|
257
|
+
let weakest = 0;
|
|
258
|
+
for (let i = 1; i < this.kept.length; i++) if (standingWorse(this.kept[weakest], this.kept[i])) weakest = i;
|
|
259
|
+
if (standingWorse(c, this.kept[weakest])) this.kept[weakest] = c;
|
|
260
|
+
}
|
|
261
|
+
/** The kept candidates in measured order. */
|
|
262
|
+
inOrder(): StandingCandidate[] { return [...this.kept].sort((x, y) => x.ord - y.ord); }
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* The positions kept from a list of `n` rows that carry no magnitude: all of
|
|
267
|
+
* them at or under `cap`, otherwise floor(j · n / cap) for j = 0 … cap − 1 —
|
|
268
|
+
* `cap` distinct, increasing positions spread across the list, the first row
|
|
269
|
+
* always among them.
|
|
270
|
+
*/
|
|
271
|
+
export function evenlySpaced(n: number, cap: number = BEHIND_SAMPLE_CAP): number[] {
|
|
272
|
+
if (n <= cap) return Array.from({ length: n }, (_, i) => i);
|
|
273
|
+
return Array.from({ length: cap }, (_, j) => Math.floor((j * n) / cap));
|
|
274
|
+
}
|
|
275
|
+
|
|
218
276
|
const emptyCount = (status: BehindSeamsCount['status'] = 'SKIP'): BehindSeamsCount => ({ status, boundary_cells: 0, geometric_px: 0, raw_px: 0, px: 0, box: null, max_spatial_run_cells: 0, samples: [] });
|
|
219
277
|
type RGB = [number, number, number];
|
|
220
278
|
interface Material { alpha: Float64Array; base: Float64Array; delta: Float64Array }
|
|
@@ -397,6 +455,7 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
397
455
|
};
|
|
398
456
|
const standingHits = new Set<number>(), motionHits = new Set<number>();
|
|
399
457
|
let standingUnderflow = false;
|
|
458
|
+
const cap = input.sampleCap ?? BEHIND_SAMPLE_CAP, worstStanding = new WorstStanding(cap);
|
|
400
459
|
for (const [k, corridor] of corridors) {
|
|
401
460
|
if (!surviving.has(k)) continue;
|
|
402
461
|
if (rear.alpha[k] <= 0 || underflow.has(k)) { unread(label, 'positive symbolic rear contribution underflowed its numeric colour weight'); standingUnderflow = true; continue; }
|
|
@@ -410,8 +469,10 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
410
469
|
}
|
|
411
470
|
if (raw) row.standing.raw_px++;
|
|
412
471
|
if (qualifies) standingHits.add(k);
|
|
413
|
-
|
|
472
|
+
worstStanding.offer(k, chosen as [number, number], qualifies);
|
|
414
473
|
}
|
|
474
|
+
row.standing.samples = worstStanding.inOrder().map(c => sample(c.k, c.d, c.q));
|
|
475
|
+
if (worstStanding.seen > cap) row.standing.samples_omitted = worstStanding.seen - cap;
|
|
415
476
|
counted(row.standing, standingHits, grid, allowance);
|
|
416
477
|
// Incomplete coverage cannot certify PASS, but cannot hide a measured failure.
|
|
417
478
|
if (support.size === 0 || unreadCorridors.length > 0 || standingUnderflow) {
|
|
@@ -435,8 +496,12 @@ function readBehindFrame(api: BehindSeamsApi, input: BehindSeamsFramesInput, pai
|
|
|
435
496
|
motionReadable = false; unread(label, 'stock transported setup-overlap support cannot be bound to the actually drawn setup pair strictly in front of the complete rear set'); continue;
|
|
436
497
|
}
|
|
437
498
|
if (rear.alpha[k] <= 0 || underflow.has(k)) { motionReadable = false; unread(label, 'positive symbolic rear contribution underflowed its numeric colour weight'); continue; }
|
|
438
|
-
motionHits.add(k);
|
|
499
|
+
motionHits.add(k);
|
|
439
500
|
}
|
|
501
|
+
// Motion-opened rows carry no distance; keep evenly spaced rows, built only for what is kept.
|
|
502
|
+
const hitCells = [...motionHits];
|
|
503
|
+
row.motion_opened.samples = evenlySpaced(hitCells.length, cap).map(i => sample(hitCells[i], null, true));
|
|
504
|
+
if (hitCells.length > cap) row.motion_opened.samples_omitted = hitCells.length - cap;
|
|
440
505
|
row.motion_opened.boundary_cells = motionCells.size;
|
|
441
506
|
row.motion_opened.geometric_px = motionHits.size; row.motion_opened.raw_px = motionHits.size;
|
|
442
507
|
counted(row.motion_opened, motionHits, grid, allowance);
|