intersect.d.ts 738 B

123456789101112131415161718
  1. import type { DisplayObject } from '../../../shapes';
  2. import { getBounds } from './bounds';
  3. /**
  4. * Detect whether line-line collision.
  5. * From: https://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect
  6. */
  7. declare function lineToLine(line1: number[], line2: number[]): boolean;
  8. declare function intersectBoxLine(box: number[] /** 八个顶点 */, line: number[]): boolean;
  9. export declare const IntersectUtils: {
  10. lineToLine: typeof lineToLine;
  11. intersectBoxLine: typeof intersectBoxLine;
  12. getBounds: typeof getBounds;
  13. };
  14. /**
  15. * 检测两个 DisplayObject 是否相交
  16. */
  17. export declare function intersect(a: DisplayObject<any>, b: DisplayObject<any>, margin?: number[]): boolean;
  18. export {};