diff --git a/frontend/js/labs/stereo.js b/frontend/js/labs/stereo.js index 20d9585..b495f0d 100644 --- a/frontend/js/labs/stereo.js +++ b/frontend/js/labs/stereo.js @@ -769,7 +769,7 @@ class StereoSim { topRing.position.y = h; this._figGroup.add(topRing); - // edges: two vertical lines + center + // edges: vertical generators + center axis const n = 8; for (let i = 0; i < n; i++) { const angle = (i / n) * Math.PI * 2; @@ -780,6 +780,13 @@ class StereoSim { this._vertices.push({ pos: new THREE.Vector3(0, 0, 0), label: 'O₁' }); this._vertices.push({ pos: new THREE.Vector3(0, h, 0), label: 'O₂' }); this._edges.push({ from: new THREE.Vector3(0, 0, 0), to: new THREE.Vector3(0, h, 0) }); + // base/top circle arc segments (for point-picking) + const arcN = 32; + for (let i = 0; i < arcN; i++) { + const a1 = (i / arcN) * Math.PI * 2, a2 = ((i + 1) / arcN) * Math.PI * 2; + this._edges.push({ from: new THREE.Vector3(r * Math.cos(a1), 0, r * Math.sin(a1)), to: new THREE.Vector3(r * Math.cos(a2), 0, r * Math.sin(a2)) }); + this._edges.push({ from: new THREE.Vector3(r * Math.cos(a1), h, r * Math.sin(a1)), to: new THREE.Vector3(r * Math.cos(a2), h, r * Math.sin(a2)) }); + } this._addEdges(0.4); this._addVerticesAndLabels(); @@ -814,6 +821,15 @@ class StereoSim { this._edges.push({ from: new THREE.Vector3(x, 0, z), to: apex }); } this._edges.push({ from: new THREE.Vector3(0, 0, 0), to: apex }); + // base circle as arc segments (for point-picking) + const arcN = 32; + for (let i = 0; i < arcN; i++) { + const a1 = (i / arcN) * Math.PI * 2, a2 = ((i + 1) / arcN) * Math.PI * 2; + this._edges.push({ + from: new THREE.Vector3(r * Math.cos(a1), 0, r * Math.sin(a1)), + to: new THREE.Vector3(r * Math.cos(a2), 0, r * Math.sin(a2)), + }); + } this._addEdges(0.4); this._addVerticesAndLabels(); @@ -851,6 +867,13 @@ class StereoSim { to: new THREE.Vector3(r * Math.cos(angle), h, r * Math.sin(angle)), }); } + // circle arc segments for point-picking on both bases + const arcN = 32; + for (let i = 0; i < arcN; i++) { + const a1 = (i / arcN) * Math.PI * 2, a2 = ((i + 1) / arcN) * Math.PI * 2; + this._edges.push({ from: new THREE.Vector3(R * Math.cos(a1), 0, R * Math.sin(a1)), to: new THREE.Vector3(R * Math.cos(a2), 0, R * Math.sin(a2)) }); + this._edges.push({ from: new THREE.Vector3(r * Math.cos(a1), h, r * Math.sin(a1)), to: new THREE.Vector3(r * Math.cos(a2), h, r * Math.sin(a2)) }); + } this._addEdges(0.4); this._addVerticesAndLabels();