feat: scaffold Svelte app with shared types and scale calculation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
immortaly007andClaude Opus 5.5 committed 2026-10-15 14:38:22 +02:00
1 parent 4284f2533b
commit a39122c504
12 files changed
+1491

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
import type { Point } from './types';
export function scaleFromLine(a: Point, b: Point, lengthMm: number): number | null {
const lengthPx = Math.hypot(b.x - a.x, b.y - a.y);
if (!(lengthMm > 0) || lengthPx < 1) return null;
return lengthPx / lengthMm;
}
+15
View File
@@ -0,0 +1,15 @@
export type Point = { x: number; y: number };
/** A piece outline: one outer ring plus hole rings. Units depend on the pipeline stage (px or mm). */
export type Shape = { outer: Point[]; holes: Point[][] };
/** RGBA pixels, structurally compatible with ImageData. */
export type RasterImage = { width: number; height: number; data: Uint8ClampedArray<ArrayBuffer> };
export type DetectParams = {
threshold: number;
invert: boolean;
seed: Point | null;
/** Negative shrinks the piece (and grows holes). */
marginPx: number;
};