// Coordinates System : SetCoords(361,26,117.00948296359596,true); // Geometry : P1=Point("P1",0.3333063185326073,-3.991129506531477); X=Point("X","[1,0,0]","1"); Y=Point("Y","[0,1,0]","1"); Z=Point("Z","[0,0,1]","1"); S11=Segment("S11",P1,X); S21=Segment("S21",P1,Y); S31=Segment("S31",P1,Z); var cube = function (e,f,g) { // e,f,g sommets coplanaires "consécutifs" var that= {}; that.s1 = e; that.s2= f; that.s3 =g; that.s4= Point("",e+"+"+g+"-"+f,"1"); var areteNormale= Point("","crossProduct("+e+"-"+f+","+g+"-"+f+")","1"); STL(areteNormale,"h:1") var a= Expression("","","","","d("+e+","+f+")","5","5"); STL(a,"h:1") var b = Expression("","","","","1/"+a+"*"+areteNormale,"5","4"); STL(b,"h:1"); areteNormale= Point(b,"1"); STL(areteNormale,"h:1") that.s5= Point("",e+"+"+areteNormale,"1"); that.s6= Point("",f+"+"+areteNormale,"1"); that.s7= Point("",g+"+"+areteNormale,"1"); that.s8= Point("",that.s4+"+"+areteNormale,"1"); STL(that.s4,"h:1"); STL(that.s5,"h:1"); STL(that.s6,"h:1"); STL(that.s7,"h:1"); STL(that.s8,"h:1"); that.getS4 = function () { return that.s4; } that.getS5 = function () { return that.s5; } that.getS6 = function () { return that.s6; } that.getS7 = function () { return that.s7; } that.getS8 = function () { return that.s8; } poly1=Polygon("",that.s1+","+that.s2+","+that.s3+","+that.s4); poly2=Polygon("",that.s1+","+that.s2+","+that.s6+","+that.s5); poly3=Polygon("",that.s2+","+that.s3+","+that.s7+","+that.s6); poly4=Polygon("",that.s3+","+that.s4+","+that.s8+","+that.s7); poly5=Polygon("",that.s4+","+that.s1+","+that.s5+","+that.s8); poly6=Polygon("",that.s5+","+that.s6+","+that.s7+","+that.s8); STL(poly1,"c:#007c7c;o:0.25;s:1;f:30"); STL(poly2,"c:#007c7c;o:0.25;s:1;f:30"); STL(poly3,"c:#007c7c;o:0.25;s:1;f:30"); STL(poly4,"c:#007c7c;o:0.25;s:1;f:30"); STL(poly5,"c:#007c7c;o:0.25;s:1;f:30"); STL(poly6,"c:#007c7c;o:0.25;s:1;f:30"); return that; }; function arbre(o,p,q,n) { if (n>0) { var c= cube(o,p,q); var eno1 = Expression("","","","","(0.5+0.5/Math.sqrt(2))*"+c.getS8()+"+(0.5-0.5/Math.sqrt(2))*"+c.getS7(),"5","3"); STL(eno1,"h:1"); var no1= Point(eno1,"1"); var einter1 = Expression("","","","","(0.5+0.5/Math.sqrt(2))*"+c.getS7()+"+(0.5-0.5/Math.sqrt(2))*"+c.getS8(),"5","3"); STL(einter1,"h:1"); var inter1= Point(einter1,"1"); var enp1= Expression("","","","",no1+"+0.5*("+c.getS6()+"+"+c.getS5()+"-"+c.getS7()+"-"+o+")","5","2"); STL(enp1,"h:1"); var np1= Point(enp1,"1"); var enq1= Expression("","","","",inter1+"+0.5*("+c.getS6()+"+"+c.getS5()+"-"+c.getS7()+"-"+o+")","5","2"); STL(enq1,"h:1"); var nq1= Point(enq1,"1"); var eno2 = Expression("","","","","(0.5+0.5/Math.sqrt(2))*"+c.getS6()+"+(0.5-0.5/Math.sqrt(2))*"+c.getS5(),"5","3"); STL(eno2,"h:1"); var no2= Point(eno2,"1"); STL(no1,"h:1"); STL(inter1,"h:1"); STL(np1,"h:1"); STL(nq1,"h:1"); STL(no2,"h:1"); arbre(no1,np1,nq1,n-1); arbre(no2,nq1,np1,n-1); } } niv=5; arbre(Point("[-1,1,-1]","1"),Point("[1,1,-1]","1"),Point("[1,-1,-1]","1"),niv); // Styles : STL(P1,"c:#0000b2;s:6;f:30;fl:true"); STL(X,"c:#0000b2;o:1;s:4;sn:true;f:24"); STL(Y,"c:#0000b2;o:1;s:4;sn:true;f:24"); STL(Z,"c:#0000b2;o:1;s:4;sn:true;f:24"); STL(S11,"c:#b40000;s:1;f:24"); STL(S21,"c:#b40000;s:1;f:24"); STL(S31,"c:#b40000;s:1;f:24"); SetCoordsStyle("3Dmode:true;isAxis:false;isGrid:true;isOx:true;isOy:true;isLockOx:false;isLockOy:false;centerZoom:true;color:#111111;fontSize:18;axisWidth:1;gridWidth:0.1");