import type { Point, Rect } from './types.js'; /** A 32-bit FNV-1a hash of a string: the seed of every jitter. */ export declare function hashString(s: string): number; /** A deterministic generator of numbers in [0, 1) seeded by `seed` * (mulberry32). */ export declare function seededRandom(seed: number): () => number; export declare const dist: (a: Point, b: Point) => number; export declare const add: (a: Point, b: Point) => Point; export declare const sub: (a: Point, b: Point) => Point; export declare const scale: (a: Point, k: number) => Point; export declare const lerp: (a: Point, b: Point, t: number) => Point; export declare const norm: (a: Point) => Point; /** `a` turned a quarter turn (to the left in page coordinates, y down). */ export declare const perp: (a: Point) => Point; export declare function rectOf(x: number, y: number, width: number, height: number): Rect; export declare function rectCentre(r: Rect): Point; export declare function unionRect(a: Rect | undefined, b: Rect): Rect; export declare function boundsOf(points: readonly Point[]): Rect; export declare function rectsOverlap(a: Rect, b: Rect, margin?: number): boolean; export declare function rectOverlapArea(a: Rect, b: Rect): number; export declare function pointInRect(p: Point, r: Rect, margin?: number): boolean; /** Signed area of a polygon (positive when clockwise on a y-down page). */ export declare function signedArea(poly: readonly Point[]): number; /** Whether `p` lies inside the convex polygon `poly` (either winding). */ export declare function pointInConvex(p: Point, poly: readonly Point[]): boolean; /** A convex polygon with each edge moved inward by `d` (clipped by the * half-planes of the moved edges). Empty when it vanishes. */ export declare function insetConvex(poly: readonly Point[], d: number): Point[]; /** The part of `poly` on the side of the line through `p` that `n` points * to (Sutherland–Hodgman, one edge). */ export declare function clipHalfPlane(poly: readonly Point[], p: Point, n: Point): Point[]; /** The part of a convex `poly` inside the rectangle `r`. */ export declare function clipToRect(poly: readonly Point[], r: Rect): Point[]; /** Where the ray from `o` along `dir` first leaves the polygon (the * distance along `dir`, normalised), or undefined. */ export declare function rayExit(o: Point, dir: Point, poly: readonly Point[]): number | undefined; /** Distance along `dir` (unit) from `o` to segment `ab`, or undefined. */ export declare function raySegment(o: Point, dir: Point, a: Point, b: Point): number | undefined; /** Whether segments `ab` and `cd` cross. */ export declare function segmentsCross(a: Point, b: Point, c: Point, d: Point): boolean; /** Distance between segments `ab` and `cd` (0 when they cross). */ export declare function segmentDistance(a: Point, b: Point, c: Point, d: Point): number; /** Whether segment `ab` crosses rect `r` (or lies inside it). */ export declare function segmentHitsRect(a: Point, b: Point, r: Rect): boolean; /** The point of the polygon's boundary nearest to `p`. */ export declare function nearestOnPolygon(p: Point, poly: readonly Point[]): Point; /** One command of a path in page px: M L C Z only. */ export interface PathCmd { op: 'M' | 'L' | 'C' | 'Z'; pts: Point[]; } /** SVG path data of commands (two decimals). */ export declare function pathData(cmds: readonly PathCmd[]): string; /** Commands moved by (dx, dy). */ export declare function translateCmds(cmds: readonly PathCmd[], dx: number, dy: number): PathCmd[]; /** A closed polygon (straight segments). */ export declare function polygonCmds(points: readonly Point[]): PathCmd[]; /** A closed smooth curve through `points` (Catmull-Rom turned into cubic * Beziers). */ export declare function smoothClosedCmds(points: readonly Point[]): PathCmd[]; /** An open smooth curve through `points` (Catmull-Rom, ends clamped), as * `C` commands that continue from `points[0]`. */ export declare function smoothOpenCmds(points: readonly Point[]): PathCmd[]; /** A circle as four cubic arcs. */ export declare function circleCmds(c: Point, r: number): PathCmd[]; /** A rectangle with corners rounded by `radius` (cubic arcs). */ export declare function roundedRectCmds(r: Rect, radius: number): PathCmd[]; /** Length of the closed polygon through `points`. */ export declare function perimeter(points: readonly Point[]): number; /** Points at `count` equal steps of arc length along the closed polygon * `points` (starting at `points[0]`, shifted by `phase` steps), each with * the polygon's outward normal there (`cw`: the polygon runs clockwise on * the page). */ export declare function resampleClosed(points: readonly Point[], count: number, phase?: number): { p: Point; n: Point; }[]; //# sourceMappingURL=geom.d.ts.map