fix: добавить дуги оснований конуса/цилиндра в _edges для постановки точек

This commit is contained in:
Maxim Dolgolyov
2026-04-14 14:02:22 +03:00
parent fff22f7331
commit 74fe2c4179
+24 -1
View File
@@ -769,7 +769,7 @@ class StereoSim {
topRing.position.y = h; topRing.position.y = h;
this._figGroup.add(topRing); this._figGroup.add(topRing);
// edges: two vertical lines + center // edges: vertical generators + center axis
const n = 8; const n = 8;
for (let i = 0; i < n; i++) { for (let i = 0; i < n; i++) {
const angle = (i / n) * Math.PI * 2; 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, 0, 0), label: 'O₁' });
this._vertices.push({ pos: new THREE.Vector3(0, h, 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) }); 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._addEdges(0.4);
this._addVerticesAndLabels(); 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(x, 0, z), to: apex });
} }
this._edges.push({ from: new THREE.Vector3(0, 0, 0), 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._addEdges(0.4);
this._addVerticesAndLabels(); this._addVerticesAndLabels();
@@ -851,6 +867,13 @@ class StereoSim {
to: new THREE.Vector3(r * Math.cos(angle), h, r * Math.sin(angle)), 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._addEdges(0.4);
this._addVerticesAndLabels(); this._addVerticesAndLabels();