fix(stereo3d): ревью метода следов — центрирование следа, фикс скрытия сечения
- _traceLine: p0 = основание перпендикуляра из начала координат (след рисуется у фигуры, а не у далёкого пересечения с осью) - фикс: после сброса/смены фигуры в пошаговом режиме step мог стать 0 → сечение скрыто и шаги не рисуются; нормализация step≥1 в _drawSection3P - подпись шага обновляется сразу после 3-го клика (в step-режиме) - bump stereo.js?v=10 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -583,7 +583,9 @@ class StereoSim {
|
||||
clearSection3P() {
|
||||
this._section3PPicks = [];
|
||||
this._section3PData = null;
|
||||
this._section3PStep = 0;
|
||||
// keep step ≥1 while in step mode, else a re-pick would hide the section
|
||||
this._section3PStep = this._section3PStepBy ? 1 : 0;
|
||||
this._stepCaption = '';
|
||||
this._clearGroup(this._section3PGroup);
|
||||
this._notify();
|
||||
}
|
||||
@@ -2265,6 +2267,9 @@ class StereoSim {
|
||||
|
||||
if (!data || picks.length < 3) return;
|
||||
|
||||
// In step mode the step counter must be ≥1 (any reset path may have zeroed it),
|
||||
// otherwise the section would be hidden and no step drawn.
|
||||
if (this._section3PStepBy && this._section3PStep < 1) this._section3PStep = 1;
|
||||
// In step-by-step mode the finished section is hidden until step ≥ 5 so the
|
||||
// trace construction builds up; otherwise (or at the end) show it in full.
|
||||
const showFull = !this._section3PStepBy || this._section3PStep >= 5;
|
||||
@@ -2353,11 +2358,11 @@ class StereoSim {
|
||||
// when the cutting plane is (nearly) parallel to the base (trace at infinity).
|
||||
_traceLine(data) {
|
||||
const a = data.normal.x, b = data.normal.z, D = data.D;
|
||||
if (Math.abs(a) < 1e-6 && Math.abs(b) < 1e-6) return null; // parallel to base
|
||||
const denom = a * a + b * b;
|
||||
if (denom < 1e-12) return null; // plane parallel to base
|
||||
const dir = new THREE.Vector3(-b, 0, a).normalize();
|
||||
let p0;
|
||||
if (Math.abs(a) >= Math.abs(b)) p0 = new THREE.Vector3(-D / a, 0, 0);
|
||||
else p0 = new THREE.Vector3(0, 0, -D / b);
|
||||
// foot of perpendicular from origin → keeps the drawn trace near the figure
|
||||
const p0 = new THREE.Vector3(-D * a / denom, 0, -D * b / denom);
|
||||
return { p0, dir };
|
||||
}
|
||||
|
||||
@@ -4299,6 +4304,10 @@ class StereoSim {
|
||||
|
||||
// Live readout overlay (section type/area/perimeter, last measurement)
|
||||
_stereoUpdateReadout(info);
|
||||
|
||||
// Keep the trace-method caption in sync (e.g. right after the 3rd pick),
|
||||
// but only in step mode so the "Кликните 3 точки" instruction is preserved.
|
||||
if (stereoSim && stereoSim._section3PStepBy) _stereoStepHint();
|
||||
}
|
||||
|
||||
function _stereoUpdateReadout(info) {
|
||||
|
||||
+1
-1
@@ -4819,7 +4819,7 @@
|
||||
<script src="/js/labs/flask.js"></script>
|
||||
<script src="/js/labs/redox.js"></script>
|
||||
<script src="/js/labs/ionexchange.js"></script>
|
||||
<script src="/js/labs/stereo.js?v=9"></script>
|
||||
<script src="/js/labs/stereo.js?v=10"></script>
|
||||
<script src="/js/notifications.js"></script>
|
||||
<script src="/js/search.js"></script>
|
||||
<script src="/js/mobile.js"></script>
|
||||
|
||||
Reference in New Issue
Block a user