/** A list of segments, four numbers each: where one starts and where it ends. */ export type SegmentList = ArrayLike; /** * The squared distance from a point to the nearest segment of a figure. * * @param segments - The segments, four numbers each. * @param start - The figure's first segment. * @param end - One past its last. * @param x - The point, x. * @param y - The point, y. * @returns The squared distance to the nearest, or infinity where the figure has none. */ export declare function nearestSegment(segments: SegmentList, start: number, end: number, x: number, y: number): number; /** * The convex hull of a figure's segment ends (Andrew's monotone chain), as x y pairs: made once for a figure and kept while the picture holds, then asked of with `areaInHull` at each pointer. * * @param segments - The segments, four numbers each. * @param start - The figure's first segment. * @param end - One past its last. * @returns The hull's corners, x then y for each, round the figure. */ export declare function hullOf(segments: SegmentList, start: number, end: number): number[]; /** * The area of the convex hull of a figure when a point is inside it, or -1 when it is not. A pointer inside a figure (not only on its lines) picks it; where figures overlap, the smaller hull is the one meant. * * @param segments - The segments, four numbers each. * @param start - The figure's first segment. * @param end - One past its last. * @param x - The point, x. * @param y - The point, y. * @returns The hull's area where the point is inside it, else -1. */ export declare function hullAreaAround(segments: SegmentList, start: number, end: number, x: number, y: number): number; /** * The area of a hull when a point is inside it, or -1 when it is not (and for a hull with fewer than three corners). * * @param h - The hull, from `hullOf`. * @param x - The point, x. * @param y - The point, y. * @returns The area where the point is inside, else -1. */ export declare function areaInHull(h: readonly number[], x: number, y: number): number; /** * The visual middle of the part of a figure that is on the picture: the middle of its lines, each counted by its length, taken only where they are inside the picture and not under a body or a place kept clear. Pieces outside the picture, and the parts of a figure that run off it, count for nothing. * * @param segments - The segments, four numbers each. * @param start - The figure's first segment. * @param end - One past its last. * @param width - The picture's width. * @param height - The picture's height. * @param blocked - Whether a point of the picture is on a body or in a place kept clear, or `undefined` where none is. * @param out - Where to write the middle. * @returns True where any of the figure is in view, with `out` written. */ export declare function visibleCentre(segments: SegmentList, start: number, end: number, width: number, height: number, blocked: ((x: number, y: number) => boolean) | undefined, out: { x: number; y: number; }): boolean; /** * Where a box goes: its middle at a point, or the nearest place round the point where it is inside the picture and `free` says it can stand. * * @param x - The wanted middle, x. * @param y - The wanted middle, y. * @param w - The box's width. * @param h - The box's height. * @param width - The picture's width. * @param height - The picture's height. * @param free - Whether a box (left, top, right, bottom) may stand there. * @param out - Where to write the middle of the place found. * @returns True where a place was found. */ export declare function placeBox(x: number, y: number, w: number, h: number, width: number, height: number, free: (l: number, t: number, r: number, b: number) => boolean, out: { x: number; y: number; }): boolean;