@technobuddha/library
Version:
A large library of useful functions
19 lines (18 loc) • 767 B
TypeScript
import { type Cartesian, type Polygon } from './geometry.ts';
/**
* Determines whether a given point is inside or on the edge of a polygon.
*
* @param point - The point to test, represented as a Cartesian coordinate.
* @param polygon - The polygon to test against, represented as an array of Cartesian coordinates.
* @returns `true` if the point is inside the polygon or on its edge, otherwise `false`.
*
* @remarks
* - The polygon is assumed to be a simple, non-self-intersecting polygon.
* - Points on the edge of the polygon return `true`.
* - Uses ray-casting algorithm with explicit edge detection.
*
* @group Geometry
* @category Polygon
* @category Point
*/
export declare function isPointInPolygon(point: Cartesian, polygon: Polygon): boolean;