GCodeOverlay/src/types.ts
sjat d1577dd569 fix: make calibration resolution-independent (normalized image coords)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-08 22:45:29 +02:00

40 lines
1 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

export type Vec2 = [number, number];
/** Row-major 3×3 matrix. */
export type Mat3 = [number, number, number, number, number, number, number, number, number];
export type MoveKind = 'cut' | 'rapid';
/** A polyline in millimetres (machine coordinates before per-job alignment). */
export interface Segment {
kind: MoveKind;
points: Vec2[];
}
/** Per-job placement: rotate the work coordinates by `rot`, then translate by (tx,ty). mm / radians. */
export interface Alignment {
tx: number;
ty: number;
rot: number;
}
export interface Calibration {
/** Calibration points in normalized [0,1] camera-frame coordinates. */
imagePoints: Vec2[];
/** Corresponding machine coordinates, mm. */
machinePoints: Vec2[];
/** machine-mm → normalized [0,1] image coords. */
homography: Mat3;
}
export interface RenderStyle {
cutColor: string;
rapidColor: string;
lineWidth: number;
}
export interface AppConfig {
streamUrl: string;
calibration: Calibration | null;
renderDefaults: RenderStyle;
}