@expofp/floorplan
Version:
Interactive floor plan library for expos and events
11 lines • 762 B
TypeScript
import { type PolygonVertex } from "../types";
/** Convex polygon area via fan triangulation from vertex[0]. */
export declare function computePolygonArea(polygon: readonly PolygonVertex[]): number;
/**
* Area-based point-in-polygon test with 1% relative tolerance. Convex polygons only.
* Inside ⇒ sum of (point, vertex_i, vertex_{i+1}) triangle areas equals polygon area; outside ⇒ larger.
* Tolerance includes points sitting fractionally outside the polygon (editor/float imprecision).
* Pass `polygonArea` from {@link computePolygonArea} to skip recomputation in hot loops.
*/
export declare function pointInPolygon(point: PolygonVertex, polygon: readonly PolygonVertex[], polygonArea?: number): boolean;
//# sourceMappingURL=pointInPolygon.d.ts.map