NewMac("facettesCreuses"," [ if %2=Nil then $ep:=0.25, $mode:=0 else ep:=Re(%2)/2, $mode:=Im(%2) fi, if mode=0 then MapBy( [ $A1:=Nil, $A2:=S[0,2],$A3:=S[1,2], $F:=Nil, $aux:= Map3D( [ A1:=A2, A2:=A3, A3:=Z, if A1<>Nil then $u:=normalize(A1-A2), $v:=normalize(A3-A2), $ecart:=angle(u,v)/2, $L:=ep/sin(ecart), Insert(F,A2+L*normalize(u+v)) fi ], $Z, [S[3,0],S[1,2]]), $compt:=0, $B:=Nil, Insert($interieur,[F,jump]), Map3D( [ Inc(compt,1), $A:=B, B:=$Z, if A<>Nil then A,B,F[2*compt-1,2], F[2*compt-3,2],jump fi, ], Z, S), B,Copy(S,1,2),F[1,2],F[2*compt-1,2] ], S, %1, jump), else ep:=2*ep, MapBy( [ $A1:=Nil, $A2:=S[1,2], $F:=Nil, $aux:= Map3D( [ A1:=A2, A2:=Z, if A1<>Nil then $u:=normalize(A2-A1), Insert(F,A1+ep*normalize(u)) fi ], $Z, [S[3,0],S[1,2]]), $compt:=0, $B:=Nil, Insert($interieur,[F,jump]), Map3D( [ Inc(compt,1), $A:=B, B:=$Z, if A<>Nil then B,F[2*compt-1,2], F[2*compt-3,2],jump fi, ], Z, S), Copy(S,1,2),F[1,2],F[2*compt-1,2] ], S, %1, jump), fi, %3:=interieur ]"), {fin macro -facettesCreuses-} background(full,darkblue), theta:=85*deg, phi:=39*deg, P:=Cube([0,0],[5,0]), nb:=15, Y:=[1,1,0], R:=[1,0,0], Build3D( for k from 1 to nb do P:=facettesCreuses(P, 0.3+i, aux), C:=((nb-k)*R+k*Y)/nb, [1,Rgb(C[1],C[2],C[3]) , P], P:=aux, Re(jump)-i od), Display3D()
[ {Cet exemple nécessite la chargemeent de PolyedresII.mac, ainsi que la définition de la macro FacettesCreuses. Ceci est fait dans le fichier source (.teg) ci-joint} background(full, lightskyblue), poly:=Archimede(6, [0,0],[4,0]), {grand rhombicuboctaèdre} FillColor:=gold, FillStyle:=full, DrawPolyNC(FacettesCreuses(poly,0.5),1) ]
[ view(-6,6,-6.5,6), Marges(0,0,0,0), size(12,1), background(full,beige), theta:=30*deg, phi:=99*deg, C:=Cone(M(0,0,-6),10*vecK,4,25), S:=Sphere(Origin,3,25,25), I1:=Clip3D(S,C), I2:=Clip3D(C,S), {<- nécessite scene3d.mod à jour} Build3D( [1,red,I1], [1,blue,I2] ), Display3D(), Width:=8, FillStyle:=full, FillColor:=Rgb(0.74,0.73,1), FillOpacity:=0.2, Color:=blue, Dcone(M(0,0,-6),10*vecK,4,2), Color:=red, FillColor:=Rgb(1,0.73,0.74), Dsphere(Origin,3,2) ]
[ view(-7,7,-7,7), Marges(0,0,0,0), size(12,1), background(full,beige), H:=5, R:=4, a:=2, Plan:=[M(a,0,0),vecI], C1:=cone(Origin, H*vecK,R,45), C2:=cone(Origin, -H*vecK,R,45), L1:=Intersection(Plan,C1), L2:=Intersection(Plan,C2), Asymp1:=getdroite( [M(a,0,0),M(0,R,H)] ), Asymp2:=getdroite( [M(a,0,0),M(0,-R,H)] ), Build3D([1, Rgb(0.74,1,0.73)+0.9*i,getplan(Plan)], [1, Rgb(0.73,0.74,1),C1,C2], [2,darkgreen,12, Asymp1,Asymp2], [2,0,8,axes3d()], ), Display3D(), Color:=red, Width:=8, DrawAretes([L1,L2],0), Color:=black, Arrows:=1, LineStyle:=dotted, Axes3D(0,0,0) ]
[ Fenetre(-1+i,1-i,5+5*i), LineStyle:=noline, L:=7, m:=4, sg:=if mod(m,2)=0 then 1 else -1 fi, P:= (for k from 0 to L do Anp(2*(L-k),L+m)*binom(L,k)*sg,0, sg:=-sg od)/(2^L*fact(L)), Del(P,L-m+2,0), K:=sqrt((2*L+1)*fact(L-abs(m))/(4*pi*fact(L+abs(m)))), NewMac("Plm",["[P:=",P,",T:=P[1], for k from 2 to Nops(P) do T:=x*T+P[k] od, T*(1-sqr(x))^(",m,"/2)]"],x), NewMac("Y",[K,"*Plm(cos(x))*cos(",m,"*y)"],x,y), S:=GetSurface( [z:=0.75+0.25*Y(v,u),z*exp(i*u)*sin(v),z*cos(v)], i*2*pi,i*pi,75+75*i), S1:=SortFacet(S,i), Map( if Re(z)=Re(jump) then {facette} G:=isobar3d(facette), c:=(norm(G)-0.63)/(0.87-0.63), FillColor:=Rgb(1,1-c,0), Ligne3D([facette],1), facette:=Nil else Insert(facette,z) fi, z, S1 ) ]
Ce fichier est inspiré d'un exemple dû à Philippe Ivaldi avec asymptote.
[ S:=GetSurface( [u+i*v, (u/2+v)/(2+cos(u/2)*sin(v))], 10*i,10*i,45+45*i), HideWidth:=8, Dparallelep(Origin,[10,0],[10*i,0],[0,11],0), S1:=SortFacet(S,i), Map( if Re(z)=Re(jump) {fin de facette} then {traiter facette, on découpe aux lignes de niveau: 2, 3, 5, 7.5} f1:=ClipFacet(facette,[0,2,-vecK]), f2:=ClipFacet(facette,[0,2,vecK]), FillColor:=red, Del(f1,Nops(f1),1), Ligne3D([f1,z],1), f1:=ClipFacet(f2,[0,3,-vecK]), f3:=ClipFacet(f2,[0,3,vecK]), FillColor:=blue, Del(f1,Nops(f1),1), Ligne3D([f1,z],1), f1:=ClipFacet(f3,[0,5,-vecK]), f2:=ClipFacet(f3,[0,5,vecK]), FillColor:=green, Del(f1,Nops(f1),1), Ligne3D([f1,z],1), f1:=ClipFacet(f2,[0,7.5,-vecK]), f3:=ClipFacet(f2,[0,7.5,vecK]), FillColor:=yellow, Del(f1,Nops(f1),1), Ligne3D([f1,z],1), FillColor:=orange, Del(f3,Nops(f3),1), Ligne3D([f3,z],1), facette:=Nil, else Insert(facette,z) {c'est un sommet}, fi, z, S1 ), FillStyle:=none, Dparallelep(Origin,[10,0],[10*i,0],[0,11],1) ]
[ $rapport:=4, angle3:=0, courbe:=Nil, $angle1:=arcsin(rapport/(rapport+1)), $angle2:=arcsin(1/(rapport+1)), $H:=6, $R:=H*tan(angle1), $h:=7,$r:=h*tan(angle2), $C1:=cone(Origin,-H*vecK,R,45), $x:=angle1+angle2, $u:=[exp(i*angle3)*sin(x),-cos(x)], $C2:=cone(Origin, h*u,r,30), $A:=h*[sin(angle1),-cos(angle1)]/cos(angle2), for k from 1 to 72 do $angle1':=angle3*rapport, $u:=[exp(i*angle3)*sin(x),-cos(x)], A':=rot3d(A,[Origin,vecK],angle3), A'':=rot3d(A',[Origin,-u],angle1'), Insert(courbe,A''),Inc(angle3,pi/36) od, L:=lineTube(courbe,0.15,12), S:=Sphere(Origin,Norm(A),30,30), Build3D( [1,Rgb(0.74,1,0.73), C1], [1, aliceblue+0.6*i,S], [1,Rgb(0.74,0.73,1), C2], [1,red-i, L] ), Display3D() ]
% Intersection d'un cylindre et d'un conoïde de Plücker. % Dépend du modèle scene3d.mod. [ C:=cylindre(M(0,0,-5),10*vecK,3,50), b:=2, CP:=GetSurface( M(u,v,2*b*u*v/(sqr(u)+sqr(v))),-5+5*i,-5+5*i,30+30*i), L:=curveTube([3*exp(i*t),b*sin(2*t)],0.15,-pi,pi,50,15), Build3D([1, Rgb(0.74,0.73,1), C], [1, Rgb(0.74,1,0.73), CP], [1, red, L] ), Display3D() ]