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:
1 parent
4284f2533b
commit
a39122c504
12 files changed
+1491
No files matched your search
@@ -0,0 +1,3 @@
|
||||
<script lang="ts"></script>
|
||||
|
||||
<h1>Scrap Tracer</h1>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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;
|
||||
};
|
||||
@@ -0,0 +1,4 @@
|
||||
import { mount } from 'svelte';
|
||||
import App from './App.svelte';
|
||||
|
||||
mount(App, { target: document.getElementById('app')! });
|
||||
Reference in new issue
Block a user