Arc tests

This commit is contained in:
Mark Tolmacs 2024-09-25 14:22:32 +02:00
parent f79fb899fc
commit 3fe73e79a6
No known key found for this signature in database
9 changed files with 80 additions and 76 deletions

View file

@ -1,8 +1,10 @@
import { invariant } from "../excalidraw/utils";
import {
isPoint,
pointCenter,
pointFromVector,
pointRotateRads,
pointsEqual,
} from "./point";
import type { GenericPoint, Segment, Radians } from "./types";
import { PRECISION } from "./utils";
@ -21,6 +23,11 @@ import {
* @returns The line segment delineated by the points
*/
export function segment<P extends GenericPoint>(a: P, b: P): Segment<P> {
invariant(
!pointsEqual(a, b),
"The start and end points of the segment cannot match",
);
return [a, b] as Segment<P>;
}