From fe6df8fb983b30b04840ae93a252194a75e77034 Mon Sep 17 00:00:00 2001 From: Maxim Dolgolyov Date: Wed, 24 Jun 2026 10:49:33 +0300 Subject: [PATCH] =?UTF-8?q?feat(trigcircle):=20=D0=A4=D0=B0=D0=B7=D0=B0=20?= =?UTF-8?q?4=20=E2=80=94=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D0=B0=20?= =?UTF-8?q?=D0=B7=D0=BD=D0=B0=D1=87=D0=B5=D0=BD=D0=B8=D0=B9=20(=D0=BE?= =?UTF-8?q?=D1=81=D0=BE=D0=B1=D1=8B=D0=B5=20=D1=83=D0=B3=D0=BB=D1=8B,=20Ka?= =?UTF-8?q?TeX)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Тумблер «Таблица значений» → компактная таблица первой четверти (0/30/45/60/90°) с точными sin/cos/tg/ctg на KaTeX (строится один раз). Строка опорного острого угла текущего положения подсвечивается (150° → подсвечена строка 30°). По симметрии/приведению (Фаза 2) это покрывает все 16 углов. Glue: _trigBuildValueTable (один раз) + trigToggleTable; подсветка строки в _trigUpdateUI по refDeg. Панель: тумблер + #trig-table. Verified: node --check; headless-смоук 10/10 (5 строк, заголовки, значения 30/45/90, tg «не опр.», toggle показ/скрытие). Эмодзи нет. Co-Authored-By: Claude Opus 4.8 (1M context) --- frontend/js/labs/trigcircle.js | 34 ++++++++++++++++++++++++++++++++++ frontend/labs-bodies.html | 9 +++++++++ 2 files changed, 43 insertions(+) diff --git a/frontend/js/labs/trigcircle.js b/frontend/js/labs/trigcircle.js index 66406e8..0af8ea6 100644 --- a/frontend/js/labs/trigcircle.js +++ b/frontend/js/labs/trigcircle.js @@ -1169,6 +1169,31 @@ if (typeof window !== 'undefined') window.TrigCircleSim = TrigCircleSim; } function trigEqKey(e) { if (e && (e.key === 'Enter' || e.keyCode === 13)) trigSolve(); } + /* ── Таблица значений (первая четверть) — строится один раз, KaTeX ── */ + function _trigBuildValueTable() { + const el = document.getElementById('trig-table'); + if (!el || el.dataset.built) return; + const cols = [['sin', '#EF476F'], ['cos', '#06D6E0'], ['tg', '#FFD166'], ['ctg', '#7BF5A4']]; + const head = 'α' + + cols.map(([n, c]) => `${n}`).join('') + ''; + const body = [0, 30, 45, 60, 90].map(deg => { + const a = deg * Math.PI / 180, sn = Math.sin(a), cs = Math.cos(a); + const tn = Math.abs(cs) > 1e-9 ? sn / cs : undefined; + const ct = Math.abs(sn) > 1e-9 ? cs / sn : undefined; + const cell = v => `${_tex(_latexVal(v))}`; + return `${deg}°${cell(sn)}${cell(cs)}${cell(tn)}${cell(ct)}`; + }).join(''); + el.innerHTML = `${head}${body}
`; + el.dataset.built = '1'; + } + function trigToggleTable(rowEl) { + const on = rowEl.classList.toggle('active'); + const el = document.getElementById('trig-table'); + if (!el) return; + if (on) { _trigBuildValueTable(); el.style.display = ''; if (trigSim) _trigUpdateUI(trigSim.stats()); } + else el.style.display = 'none'; + } + function _trigUpdateUI(s) { const _f = v => { if (v === undefined) return '—'; @@ -1247,6 +1272,15 @@ if (typeof window !== 'undefined') window.TrigCircleSim = TrigCircleSim; } } + // Подсветка строки таблицы значений (по опорному острому углу) + const tbl = document.getElementById('trig-table'); + if (tbl && tbl.dataset.built && typeof tbl.querySelectorAll === 'function') { + const beta = Math.round(s.refDeg); + tbl.querySelectorAll('tr[data-deg]').forEach(tr => { + tr.style.background = (Number(tr.dataset.deg) === beta) ? 'rgba(155,93,229,0.18)' : ''; + }); + } + // Stats bar — значения тоже KaTeX (дроби/корни) document.getElementById('trigbar-angle').textContent = degStr; setMathVal('trigbar-sin', s.sin); diff --git a/frontend/labs-bodies.html b/frontend/labs-bodies.html index 9dcffdd..f736cc1 100644 --- a/frontend/labs-bodies.html +++ b/frontend/labs-bodies.html @@ -599,6 +599,15 @@
+ + + +
Табличные углы