UNPKG

@fleet-frontend/mower-maps

Version:

a mower maps in google maps

76 lines 2.52 kB
/** * 几何计算工具函数 */ export interface Point { x: number; y: number; } export interface Polygon { points: Point[]; } /** * 判断点是否在多边形内部(射线法) * @param point 待检测的点 * @param polygon 多边形顶点数组 * @returns 是否在多边形内部 */ export declare function isPointInPolygon(point: Point, polygon: Point[]): boolean; /** * 计算点到线段的最短距离 * @param point 点 * @param lineStart 线段起点 * @param lineEnd 线段终点 * @returns 最短距离 */ export declare function pointToLineDistance(point: Point, lineStart: Point, lineEnd: Point): number; /** * 计算点到多边形的最短距离 * @param point 点 * @param polygon 多边形顶点数组 * @returns 最短距离 */ export declare function pointToPolygonDistance(point: Point, polygon: Point[]): number; /** * 判断两条线段是否相交 * @param line1Start 线段1起点 * @param line1End 线段1终点 * @param line2Start 线段2起点 * @param line2End 线段2终点 * @returns 是否相交 */ export declare function lineSegmentsIntersect(line1Start: Point, line1End: Point, line2Start: Point, line2End: Point): boolean; /** * 判断两个多边形是否相交(包括边界相交、部分重叠、完全包含等所有情况) * @param polygon1 多边形1 * @param polygon2 多边形2 * @returns 是否相交 */ export declare function doPolygonsIntersect(polygon1: Point[], polygon2: Point[]): boolean; /** * 判断多边形是否被另一个多边形切割(有交点但不完全包含) * @param polygon1 多边形1 * @param polygon2 多边形2 * @returns 是否被切割 */ export declare function isPolygonCutByPolygon(polygon1: Point[], polygon2: Point[]): boolean; /** * 计算多边形到多边形的最短距离 * @param polygon1 多边形1 * @param polygon2 多边形2 * @returns 最短距离 */ export declare function polygonToPolygonDistance(polygon1: Point[], polygon2: Point[]): number; /** * 判断两个多边形是否完全分离(不相交、不相切、不包含) * @param polygon1 多边形1 * @param polygon2 多边形2 * @returns 是否完全分离 */ export declare function arePolygonsDisjoint(polygon1: Point[], polygon2: Point[]): boolean; /** * 将坐标数组转换为Point数组 * @param coordinates 坐标数组 [[x, y], ...] * @returns Point数组 */ export declare function coordinatesToPoints(coordinates?: number[][]): Point[]; //# sourceMappingURL=geometryUtils.d.ts.map