summaryrefslogtreecommitdiff
path: root/tools/mq_editor/viewer.js
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-18 18:44:21 +0100
committerskal <pascal.massimino@gmail.com>2026-02-18 18:44:21 +0100
commiteff75e6d15eaebccec814b37504a6eeff53fb9e8 (patch)
tree6b57a7336bd40be09f58d3ef4a9fcf6e3aedfc05 /tools/mq_editor/viewer.js
parent9b1439582853c24d240d1e62290f33809097bbe8 (diff)
feat(mq_editor): switch curve interpolation to Lagrange through all control points
Replace cubic Bezier with Lagrange interpolation so P1/P2 are actual points on the curve. Eval uses stored t1/t2 as arbitrary knot positions. fitBezier keeps least-squares but with Lagrange basis at u=1/3,2/3. Remove endpoint companion drag (no longer tangent handles). TODO: support arbitrary number of inner control points. handoff(Claude): Lagrange interpolation replaces Bezier in mq_editor curve eval/fit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools/mq_editor/viewer.js')
-rw-r--r--tools/mq_editor/viewer.js13
1 files changed, 1 insertions, 12 deletions
diff --git a/tools/mq_editor/viewer.js b/tools/mq_editor/viewer.js
index c69d9e7..d7b5ac1 100644
--- a/tools/mq_editor/viewer.js
+++ b/tools/mq_editor/viewer.js
@@ -626,14 +626,8 @@ class SpectrogramViewer {
if (this.selectedPartial >= 0 && this.selectedPartial < this.partials.length) {
const ptIdx = this.hitTestControlPoint(x, y, this.partials[this.selectedPartial]);
if (ptIdx >= 0) {
- const curve = this.partials[this.selectedPartial].freqCurve;
- let companionOff = null;
- if (ptIdx === 0)
- companionOff = { dt: curve.t1 - curve.t0, dv: curve.v1 - curve.v0 };
- else if (ptIdx === 3)
- companionOff = { dt: curve.t2 - curve.t3, dv: curve.v2 - curve.v3 };
if (this.onBeforeChange) this.onBeforeChange();
- this.dragState = { pointIndex: ptIdx, companionOff };
+ this.dragState = { pointIndex: ptIdx };
canvas.style.cursor = 'grabbing';
e.preventDefault();
return;
@@ -655,11 +649,6 @@ class SpectrogramViewer {
const i = this.dragState.pointIndex;
partial.freqCurve['t' + i] = t;
partial.freqCurve['v' + i] = v;
- if (this.dragState.companionOff) {
- const off = this.dragState.companionOff;
- if (i === 0) { partial.freqCurve.t1 = t + off.dt; partial.freqCurve.v1 = v + off.dv; }
- else { partial.freqCurve.t2 = t + off.dt; partial.freqCurve.v2 = v + off.dv; }
- }
this.render();
e.preventDefault();
return;