From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 15 Mar 2026 16:19:35 -0400 Subject: refactor: packages/ --- packages/math/line.ts | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 packages/math/line.ts (limited to 'packages/math/line.ts') diff --git a/packages/math/line.ts b/packages/math/line.ts new file mode 100644 index 0000000..bcb4f6d --- /dev/null +++ b/packages/math/line.ts @@ -0,0 +1,38 @@ +import { pointFrom } from "./point"; +import type { GlobalPoint, Line, LocalPoint } from "./types"; + +/** + * Create a line from two points. + * + * @param points The two points lying on the line + * @returns The line on which the points lie + */ +export function line
(a: P, b: P): Line
{ + return [a, b] as Line
;
+}
+
+/**
+ * Determines the intersection point (unless the lines are parallel) of two
+ * lines
+ *
+ * @param a
+ * @param b
+ * @returns
+ */
+export function linesIntersectAt