minor code cleanup

This commit is contained in:
azykov@mail.ru 2026-05-23 09:44:38 +03:00
parent 7d3b8ca232
commit e751d2c5dd
No known key found for this signature in database
1 changed files with 5 additions and 20 deletions

View File

@ -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;
}