From e751d2c5dd2458df5e2d5940beefe4fd6e647798 Mon Sep 17 00:00:00 2001 From: "azykov@mail.ru" Date: Sat, 23 May 2026 09:44:38 +0300 Subject: [PATCH] minor code cleanup --- .../src/helpers/circularFrustumIntersect.ts | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/client/src/helpers/circularFrustumIntersect.ts b/client/src/helpers/circularFrustumIntersect.ts index 2c66f5d..df928d4 100644 --- a/client/src/helpers/circularFrustumIntersect.ts +++ b/client/src/helpers/circularFrustumIntersect.ts @@ -166,14 +166,13 @@ export class CircularFrustumIntersection { } }; - // 1. Test vertices + // step 1: test vertices tryPoint(tri.a); tryPoint(tri.b); tryPoint(tri.c); - // 2. For each edge, find the point closest to the frustum axis ray, - // and also the point closest to the apex. - // This catches triangles that straddle the cone surface. + // step 2: edges for a triangle that straddle the cone surface + // for each edge, find the point closest to the frustum axis ray, and also the point closest to the apex. const edges: [THREE.Vector3, THREE.Vector3][] = [ [tri.a, tri.b], [tri.b, tri.c], @@ -205,10 +204,9 @@ export class CircularFrustumIntersection { tryPoint(a.clone().addScaledVector(edge, tApex)); } - // 3. Closest point on triangle face to the apex (using THREE.Triangle, not ExtendedTriangle) - const threeTri = new THREE.Triangle(tri.a, tri.b, tri.c); + // step 3: closest point on triangle face to the apex const closestOnFace = new THREE.Vector3(); - threeTri.closestPointToPoint(localFrustum.apex, closestOnFace); + tri.closestPointToPoint(localFrustum.apex, closestOnFace); if (!isNaN(closestOnFace.x)) tryPoint(closestOnFace); @@ -228,19 +226,6 @@ export class CircularFrustumIntersection { return false; }, }); - // } else { - // // ── Fallback: bounding box only ─────────────────────────────────── - // if (!geometry.boundingBox) - // geometry.computeBoundingBox(); - // const worldBox = geometry.boundingBox!.clone().applyMatrix4(mesh.matrixWorld); - // const boxResult = this.intersectsBox(worldBox.clone()); - // if (boxResult !== NOT_INTERSECTED) { - // const center = new THREE.Vector3(); - // worldBox.getCenter(center); - // const depth = this.frustum.axis.dot(center.clone().sub(this.frustum.apex)); - // results.push({ object: mesh, point: center, depth }); - // } - // } return results; }