Files
2026-07-08 20:35:59 +02:00

21 lines
931 B
JavaScript

const d2 = 12.9, l1 = 85.0, l2 = 110.0;
for(let t1=0; t1<360; t1++){
for(let t2=0; t2<360; t2++){
let th1 = t1 * Math.PI/180; let th2 = t2 * Math.PI/180;
let e1x = -d2 + l1*Math.cos(th1); let e1y = l1*Math.sin(th1);
let e2x = d2 + l1*Math.cos(th2); let e2y = l1*Math.sin(th2);
let dx = e2x - e1x; let dy = e2y - e1y;
let dist = Math.sqrt(dx*dx + dy*dy);
if(dist < 1e-6 || dist > 2*l2) continue;
let a = dist/2; let h = Math.sqrt(Math.max(0, l2*l2 - a*a));
let mx = (e1x+e2x)/2; let my = (e1y+e2y)/2;
let px1 = mx + h*(dy/dist); let py1 = my + h*(-dx/dist);
let px2 = mx - h*(dy/dist); let py2 = my - h*(-dx/dist);
let useFirst = py1 >= py2;
let ex = useFirst ? px1 : px2; let ey = useFirst ? py1 : py2;
if(Math.abs(ex - 114.4) < 1.0 && Math.abs(ey - 112.7) < 1.0){
console.log('Match: t1=' + t1 + ' t2=' + t2 + ' -> ' + ex.toFixed(1) + ', ' + ey.toFixed(1));
}
}
}