Développé de principe : hauteurs de découpe non validées pour la fabrication.
| Repère | Longueur génératrice (mm) |
|---|
| Mesure | Moteur principal (mm) | Moteur expérimental (mm) |
|---|---|---|
| Référence 0 | 72.500 | 64.469 |
| Référence 3 | 70.451 | 62.600 |
| Référence 6 | 65.240 | 66.380 |
Historique V86, dimensions D1=89, D2=114, H=50, X=40, Y=30, n=12. Correspondances géométriques non validées.
// V79 : dépliage par triangles isométriques, sans toucher au gabarit SVG historique.
(function(){
const original=window.calculY;
const d=(a,b)=>Math.hypot(...a.map((v,i)=>v-b[i]));
const add=(a,b)=>[a[0]+b[0],a[1]+b[1]];
const sub=(a,b)=>[a[0]-b[0],a[1]-b[1]];
const mul=(a,t)=>a.map(v=>v*t);
const norm=a=>Math.hypot(...a);
function third(A,B,ra,rb,sign){
const v=sub(B,A), L=norm(v);
if(L<1e-9 || ra+rb<L-1e-6 || Math.abs(ra-rb)>L+1e-6)throw Error('Triangle impossible');
const ex=mul(v,1/L), x=(ra*ra-rb*rb+L*L)/(2*L);
const h=Math.sqrt(Math.max(0,ra*ra-x*x));
return add(add(A,mul(ex,x)),[-sign*ex[1]*h,sign*ex[0]*h]);
}
function bezierPath(points){
if(points.length<2)return '';
let z='M'+points[0].join(' ');
for(let i=0;i<points.length-1;i++){
const p0=points[Math.max(0,i-1)],p1=points[i],p2=points[i+1],p3=points[Math.min(points.length-1,i+2)];
const k=.16;
const c1=add(p1,mul(sub(p2,p0),k)),c2=sub(p2,mul(sub(p3,p1),k));
z+=' C'+c1.join(' ')+' '+c2.join(' ')+' '+p2.join(' ');
}
return z;
}
function render(){
const out=document.getElementById('v79-result'),svg=document.getElementById('v79-svg');
if(!svg)return;
try{
const D1=Number(document.getElementById('D1brut').value)+2*Number(document.getElementById('iso').value);
const D2=Number(document.getElementById('D2brut').value)+2*Number(document.getElementById('iso').value);
const H=Number(document.getElementById('Hcalc').value),X=Number(document.getElementById('Xcalc').value),Y=Number(document.getElementById('Ycalc').value);
const n=Math.round(Number(document.getElementById('ncalc').value));
if(![D1,D2,H,X,Y,n].every(Number.isFinite)||D1<=0||D2<=0||H<=0||n<6||n>120)throw Error('Paramètres invalides');
const m=Math.floor(n/2),t=Math.PI/n;
const top=k=>[X+D1/2*Math.cos(k*t),Y+D1/2*Math.sin(k*t),H];
const bot=k=>[D2/2*Math.cos(k*t),D2/2*Math.sin(k*t),0];
const P=[[0,0]],Q=[[0,d(top(0),bot(0))]];
for(let k=0;k<m;k++){
// Premier triangle P[k], Q[k], P[k+1] ; second P[k+1],Q[k],Q[k+1].
const nextP=third(P[k],Q[k],d(top(k),top(k+1)),d(bot(k),top(k+1)),-1);
const nextQ=third(Q[k],nextP,d(bot(k),bot(k+1)),d(top(k+1),bot(k+1)),1);
P.push(nextP);Q.push(nextQ);
}
let maxErr=0;
for(let k=0;k<=m;k++)maxErr=Math.max(maxErr,Math.abs(d(P[k],Q[k])-d(top(k),bot(k))));
for(let k=0;k<m;k++)maxErr=Math.max(maxErr,Math.abs(d(P[k],P[k+1])-d(top(k),top(k+1))),Math.abs(d(Q[k],Q[k+1])-d(bot(k),bot(k+1))),Math.abs(d(Q[k],P[k+1])-d(bot(k),top(k+1))));
const all=P.concat(Q),xs=all.map(p=>p[0]),ys=all.map(p=>p[1]);
const minx=Math.min(...xs),maxx=Math.max(...xs),miny=Math.min(...ys),maxy=Math.max(...ys);
const scale=Math.min(720/Math.max(1,maxx-minx),340/Math.max(1,maxy-miny));
const cv=p=>[(p[0]-minx)*scale+40,(p[1]-miny)*scale+40];
const pp=P.map(cv),qq=Q.map(cv);
const ns='http://www.w3.org/2000/svg';svg.replaceChildren();
const line=(a,b,stroke='#64748b')=>{let e=document.createElementNS(ns,'line');for(const [k,v] of Object.entries({x1:a[0],y1:a[1],x2:b[0],y2:b[1],stroke,'stroke-width':1}))e.setAttribute(k,v);svg.append(e)};
for(let k=0;k<=m;k++)line(pp[k],qq[k]);
for(let k=0;k<m;k++)line(qq[k],pp[k+1],'#b0b0b0');
for(const arr of [pp,qq]){const e=document.createElementNS(ns,'path');e.setAttribute('d',bezierPath(arr));e.setAttribute('stroke','#111');e.setAttribute('stroke-width','2');e.setAttribute('fill','none');svg.append(e)}
out.innerHTML='<strong>Triangles recalculés :</strong> '+(2*m)+' · <strong>Écart maximal des longueurs contrôlées :</strong> '+maxErr.toFixed(6)+' mm.<br><strong>Attention :</strong> les courbes de Bézier sont lissées entre les points calculés ; leur longueur d’arc n’est pas encore validée. Le sens géométrique de X et Y doit être confirmé avant fabrication.';
}catch(e){svg.replaceChildren();out.textContent='Contrôle impossible : '+e.message}
}
const old=window.calculY;
window.calculY=function(){if(typeof old==='function')old.apply(this,arguments);render()};
for(const id of ['D1brut','D2brut','iso','Hcalc','Xcalc','Ycalc','ncalc'])document.getElementById(id)?.addEventListener('input',render);
render();
})();