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 ​

A line's coefficients can be partly known while solving — a direction known from parallel but no position yet, say. The missing coefficients are null and filled in as constraints are applied or canonical defaults are chosen.