import { invariant } from "../excalidraw/utils"; import type { GenericPoint, Rectangle } from "./types"; export function rectangle

( a: P, b: P, c: P, d: P, ): Rectangle

{ return [a, b, c, d] as Rectangle

; } export function rectangleFromQuad

( quad: [a: P, b: P, c: P, d: P], ): Rectangle

{ return quad as Rectangle

; } export function rectangleFromArray

( pointArray: P[], ): Rectangle

{ invariant( pointArray.length === 4, "Point array contains more or less points to create a rectangle from", ); return pointArray as Rectangle

; }