GCodeOverlay/src/types.ts

41 lines
982 B
TypeScript
Raw Normal View History

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 {
/** Clicked points in the camera image, pixels. */
imagePoints: Vec2[];
/** Corresponding machine coordinates, mm. */
machinePoints: Vec2[];
/** machine-mm → image-px. */
homography: Mat3;
}
export interface RenderStyle {
cutColor: string;
rapidColor: string;
lineWidth: number;
}
export interface AppConfig {
streamUrl: string;
calibration: Calibration | null;
renderDefaults: RenderStyle;
}