Each flag construction is expressed as a composition of geometric and rendering primitives. Only geometric steps contribute to the “cost” reported on every flag page.
Geometric steps compute new points from existing ones using straight-edge and compass operations. Each step counts as one unit of construction cost. Lines are infinite in length.
Given two lines (each defined by a pair of points), finds their unique point of intersection. Errors when lines are parallel or if any line has length zero.
((p₁, p₂), (p₃, p₄)) → Point
Given a line (two points) and a circle (centre + edge point), finds both points where the line crosses the circle. Errors if line does not intersect circle, if line has length zero, or circle has radius zero.
((p₁, p₂), (centre, edge)) → (Point, Point)
Given two circles (each as centre + edge point), finds both points of intersection. Errors if circles do not intersect, or if either radius is zero.
((centre₁, edge₁), (centre₂, edge₂)) → (Point, Point)
Computes the k-th vertex of a regular n-gon inscribed in a given circle (centre + first vertex). Always marks flag as non-constructible, so only use for n values that can’t be constructed with simpler primitives (e.g. n = 7, 9, 11 …).
index → size → (centre, firstVertex) → Point
Rendering steps produce coloured shapes from already-computed points. They do not count toward construction cost.
Draws a solid-colour triangle from three points.
(p₁, p₂, p₃) → Drawing
Draws a solid-colour filled disc. The radius is derived from the Euclidean distance between the centre and an edge point, so no explicit radius value is needed.
(centre, edgePoint) → Drawing
Composites one drawing on top of another using a mask or clip. In mask mode, the mask drawing defines transparent regions. In clip mode, only the area inside the clip shapes is preserved.
maskMode → (content :: Drawing, mask :: Drawing) → Drawing
Composites an external SVG file (e.g. an emblem or coat of arms) on top of the generated flag. The overlay is positioned and scaled using a centre point and an edge point. The contents of the overlay are not further analysed.
filePath → (centre, edgePoint) → Drawing