Skip to content

Types

Point

A point is a pair of coordinates in the plane.

ts
type Point = { x: number; y: number }

Line

A line is the implicit equation ax + by + c = 0.

ts
type Line = { a: number; b: number; c: number }

The three coefficients cover all line orientations without special-casing verticals. A few common forms:

Equationabc
y = x1−10
y = 2x + 12−11
x = 310−3
y = 401−4

The direction vector of the line is (−b, a) and the normal is (a, b).

Partial declarations

When a line is declared with some parameters left open (e.g. line l = (1,) — slope known, intercept unknown), the missing coefficients are null during solving and filled in as constraints are applied or canonical defaults are chosen.

~tilde — geometric language