@rig-c/core 2.69.0 → 2.70.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.
@@ -97,6 +97,8 @@ export { choosePosers, pairRefusal, regionKey };
97
97
 
98
98
  /** Opaque, and light: both of rung 3's parts are dark slate, so is every ground. */
99
99
  export const BACKGROUND: RGBA = [232, 232, 232, 255];
100
+ /** Transparent canvas for `render --sheet`, leaving diagnostic `f####.png` and `contact.png` on `BACKGROUND`. */
101
+ export const TRANSPARENT_BACKGROUND: RGBA = [0, 0, 0, 0];
100
102
  /** Padding around the union bounding box, as a fraction of its long side. */
101
103
  export const PAD = 0.04;
102
104
  /**
@@ -221,6 +223,23 @@ export interface FrameSet {
221
223
  plates: number;
222
224
  moving: Array<{ under: string; over: string; frames: number; most: { index: number; px: number } }>;
223
225
  };
226
+ /**
227
+ * The spritesheet export, when `render --sheet` asked for it (issue #1560):
228
+ * the set's manifest file, the table format, the page-edge policy, how many
229
+ * pages were written, how many frames were packed, and how many of them were
230
+ * empty (`1x1` transparent sentinel).
231
+ *
232
+ * ⭐ Absent unless asked for, for `skin`'s reason in `FramesSidecar`: a render
233
+ * without the flag stays the bytes it always was.
234
+ */
235
+ sheet?: {
236
+ manifest: string;
237
+ format: 'json-hash';
238
+ pageEdges: 'pot' | 'free';
239
+ pages: number;
240
+ frames: number;
241
+ emptyFrames: number;
242
+ };
224
243
  }
225
244
 
226
245
  export interface FramesSidecar {
package/src/seam.ts CHANGED
@@ -290,7 +290,7 @@ function weightsIn(triangles: readonly number[], xy: ArrayLike<number>, t: numbe
290
290
  * the triangle the point is least outside of (the largest smallest weight, the
291
291
  * lowest index on a tie). `null` when every triangle has collapsed in `from`.
292
292
  */
293
- function carry(triangles: readonly number[], from: ArrayLike<number>, to: ArrayLike<number>, id: number, qx: number, qy: number): [number, number] | null {
293
+ export function carry(triangles: readonly number[], from: ArrayLike<number>, to: ArrayLike<number>, id: number, qx: number, qy: number): [number, number] | null {
294
294
  let best = id;
295
295
  let w = id >= 0 ? weightsIn(triangles, from, id, qx, qy) : null;
296
296
  if (w === null) {
@@ -309,7 +309,11 @@ function carry(triangles: readonly number[], from: ArrayLike<number>, to: ArrayL
309
309
  }
310
310
  if (w === null || best < 0) return null;
311
311
  const [a, b, c] = [triangles[3 * best], triangles[3 * best + 1], triangles[3 * best + 2]];
312
- return [w[0] * to[2 * a] + w[1] * to[2 * b] + w[2] * to[2 * c], w[0] * to[2 * a + 1] + w[1] * to[2 * b + 1] + w[2] * to[2 * c + 1]];
312
+ // #1568: stationary and translated pieces must carry without barycentric round-trip drift.
313
+ const dxa = to[2 * a] - from[2 * a], dya = to[2 * a + 1] - from[2 * a + 1];
314
+ const dxb = to[2 * b] - from[2 * b], dyb = to[2 * b + 1] - from[2 * b + 1];
315
+ const dxc = to[2 * c] - from[2 * c], dyc = to[2 * c + 1] - from[2 * c + 1];
316
+ return [qx + dxc + w[0] * (dxa - dxc) + w[1] * (dxb - dxc), qy + dyc + w[0] * (dya - dyc) + w[1] * (dyb - dyc)];
313
317
  }
314
318
 
315
319
  /** The convex hull of `points`, counter-clockwise, collinear points dropped (Andrew's monotone chain). */