From 120fb04b6d79c80fd66a12e2c9ffa98ae1ccfb05 Mon Sep 17 00:00:00 2001 From: ChenX Date: Thu, 14 Feb 2019 16:55:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=87=BD=E6=95=B0=E5=88=A4?= =?UTF-8?q?=E6=96=AD1=E7=BB=B4=E7=BA=BF=E6=AE=B5=E4=BA=A4=E9=9B=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Geometry/GeUtils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/Geometry/GeUtils.ts b/src/Geometry/GeUtils.ts index 3145ae9b0..76518a60d 100644 --- a/src/Geometry/GeUtils.ts +++ b/src/Geometry/GeUtils.ts @@ -7,6 +7,14 @@ export const cXAxis = new Vector3(1, 0, 0); export const cYAxis = new Vector3(0, 1, 0); export const cZAxis = new Vector3(0, 0, 1); +/** + * 判断一维线段a和b是否存在交集 + */ +function isIntersect(amin: number, amax: number, bmin: number, bmax: number, eps = 0) +{ + return Math.max(amin, bmin) + eps < Math.min(amax, bmax); +} + /** * 旋转一个点,旋转中心在原点 *