graphic-pixi/lib/utils/IntersectUtils.d.ts
2023-12-14 13:07:43 +08:00

120 lines
3.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { IPointData, Rectangle } from 'pixi.js';
/**
* 根据点到直线的垂直距离计算碰撞
* @param pa 线段a端坐标
* @param pb 线段b端坐标
* @param p 点坐标
* @param lineWidth 线宽
* @param exact 是否精确使用给定线宽否则线宽会设置为8
* @returns
*/
export declare function linePoint(pa: IPointData, pb: IPointData, p: IPointData, lineWidth: number, exact?: boolean): boolean;
/**
* 折线与点碰撞
* @param points 折线端点列表
* @param p 点座标
* @param lineWidth 线宽
*/
export declare function polylinePoint(points: IPointData[], p: IPointData, lineWidth: number): boolean;
/**
* 线线碰撞检测
* @param pa 线段1a端坐标
* @param pb 线段1b端坐标
* @param p1 线段2a端坐标
* @param p2 线段2b端坐标
* @returns
*/
export declare function lineLine(pa: IPointData, pb: IPointData, p1: IPointData, p2: IPointData): boolean;
/**
* 点和矩形碰撞检测
* @param p 点作弊
* @param rect 矩形
* @returns
*/
export declare function pointBox(p: IPointData, rect: Rectangle): boolean;
/**
* 线和矩形碰撞检测
* @param pa 线段a端坐标
* @param pb 线段b端坐标
* @param rect 矩形
* @returns
*/
export declare function lineBox(pa: IPointData, pb: IPointData, rect: Rectangle): boolean;
/**
* 多线段和矩形碰撞检测
* @param points
* @param rect
* @returns false / 碰撞的线段序号
*/
export declare function polylineBox(points: IPointData[], rect: Rectangle): boolean;
/**
* 两点碰撞检测
* @param p1
* @param p2
* @param tolerance
* @returns
*/
export declare function pointPoint2(p1: IPointData, p2: IPointData, tolerance: number): boolean;
/**
* 两点碰撞检测
* @param x1
* @param y1
* @param x2
* @param y2
* @param tolerance 容忍度/两点半径和
* @returns
*/
export declare function pointPoint(x1: number, y1: number, x2: number, y2: number, tolerance: number): boolean;
/**
* 两点距离
* @param x1
* @param y1
* @param x2
* @param y2
* @returns
*/
export declare function distance(x1: number, y1: number, x2: number, y2: number): number;
/**
* 两点距离
* @param p1
* @param p2
* @returns
*/
export declare function distance2(p1: IPointData, p2: IPointData): number;
/**
* 圆和点的碰撞检测
* @param x1 圆心x
* @param y1 圆心y
* @param r1 圆半径
* @param x2 点x
* @param y2 点y
* @returns
*/
export declare function circlePoint(x1: number, y1: number, r1: number, x2: number, y2: number): boolean;
/**
* 圆和点的碰撞检测--不包括圆内部
*/
export declare function circlePoint2(x1: number, y1: number, r1: number, x2: number, y2: number, tolerance: number): boolean;
/**
* 点和多边形碰撞检测
*/
export declare function pointPolygon(p: IPointData, points: IPointData[], lineWidth: number): boolean;
/**
* 线和多边形碰撞检测
* @param p1
* @param p2
* @param points
* @param tolerance 多边形包围线宽
* @returns
*/
export declare function linePolygon(p1: IPointData, p2: IPointData, points: IPointData[], lineWidth: number, polygonWidth: number): boolean;
/**
* 多边线与多边形碰撞检测
* @param polylinePoints 多边线所有点坐标
* @param polygonPoints 多边形所有点坐标
* @param polylineWidth 多边线的线宽
* @param polygonWidth 多边形线宽
* @returns
*/
export declare function polylinePolygon(polylinePoints: IPointData[], polygonPoints: IPointData[], polylineWidth: number, polygonWidth: number): boolean;