diff --git a/frontend/js/labs/trigcircle.js b/frontend/js/labs/trigcircle.js index 0af8ea6..8d7db74 100644 --- a/frontend/js/labs/trigcircle.js +++ b/frontend/js/labs/trigcircle.js @@ -54,6 +54,7 @@ class TrigCircleSim { this.snapToNotable = true; this.animating = false; this.eq = null; // режим уравнения: { fn:'sin'|'cos'|'tg', a:Number, sols:[рад] } | null + this.showParity = false; // показать зеркальную точку −α (чётность/нечётность) this._cx = 0; this._cy = 0; this._r = 0; this._gx = 0; this._gw = 0; this._gh = 0; this._gy = 0; @@ -98,6 +99,7 @@ class TrigCircleSim { this._drawBg(c); this._drawCircle(c); if (this.eq) this._drawEquation(c); + if (this.showParity) this._drawParity(c); if (this.showGraph) { this._drawDivider(c); this._drawGraph(c); } this._drawParticles(c); if (window.LabFX) LabFX.particles.draw(c); @@ -153,6 +155,22 @@ class TrigCircleSim { c.restore(); } + /* Зеркальная точка −α (отражение через ось Ox): наглядно чётность cos и нечётность sin. */ + _drawParity(c) { + const cx = this._cx, cy = this._cy, r = this._r, a = this.angle; + const px = cx + r * Math.cos(a), py = cy - r * Math.sin(a); + const mx = cx + r * Math.cos(-a), my = cy - r * Math.sin(-a); + c.save(); + c.strokeStyle = _tcRgba(_TC.violet, 0.4); c.setLineDash([4, 4]); c.lineWidth = 1; + c.beginPath(); c.moveTo(px, py); c.lineTo(mx, my); c.stroke(); c.setLineDash([]); + c.strokeStyle = _TC.violet; c.lineWidth = 2; c.fillStyle = 'rgba(155,93,229,0.15)'; + c.beginPath(); c.arc(mx, my, 6, 0, Math.PI * 2); c.fill(); c.stroke(); + c.font = 'bold 11px Manrope,sans-serif'; c.fillStyle = _TC.violet; + c.textAlign = 'center'; c.textBaseline = 'middle'; + c.fillText('-α', mx + (Math.cos(-a) >= 0 ? 14 : -14), my); + c.restore(); + } + goToAngle(rad) { this._animTarget = this._norm(rad); if (!this.animating) this._startAnim(); @@ -1194,6 +1212,25 @@ if (typeof window !== 'undefined') window.TrigCircleSim = TrigCircleSim; else el.style.display = 'none'; } + /* ── Чётность/нечётность + периоды (статический KaTeX-блок, строится один раз) ── */ + function trigToggleParity(rowEl) { + if (!trigSim) return; + const on = rowEl.classList.toggle('active'); + trigSim.showParity = on; + trigSim.draw(); + const pEl = document.getElementById('trig-parity'); + if (!pEl) return; + pEl.style.display = on ? '' : 'none'; + if (on && !pEl.dataset.built) { + pEl.innerHTML = + `