Add visual debug support for arc

This commit is contained in:
Mark Tolmacs 2024-10-03 14:09:44 +02:00
parent 85611b8754
commit 2ec3374333
No known key found for this signature in database
3 changed files with 67 additions and 4 deletions

View file

@ -1,4 +1,4 @@
import type { Segment } from "../math";
import type { Arc, Segment } from "../math";
import { isSegment, segment, pointFrom, type GlobalPoint } from "../math";
import { isBounds } from "./element/typeChecks";
import type { Bounds } from "./element/types";
@ -15,10 +15,24 @@ declare global {
export type DebugElement = {
color: string;
data: Segment<GlobalPoint>;
data: Segment<GlobalPoint> | Arc<GlobalPoint>;
permanent: boolean;
};
export const debugDrawArc = (
a: Arc<GlobalPoint>,
opts?: {
color?: string;
permanent?: boolean;
},
) => {
addToCurrentFrame({
color: opts?.color ?? "blue",
permanent: !!opts?.permanent,
data: a,
});
};
export const debugDrawLine = (
segment: Segment<GlobalPoint> | Segment<GlobalPoint>[],
opts?: {