Ajout d'une option traits dans la représentation des solides créés par révolution.
authorChristophe Poulain <cp@Debian.(none)>
Mon, 17 Oct 2011 16:25:29 +0000 (18:25 +0200)
committerChristophe Poulain <cp@Debian.(none)>
Mon, 17 Oct 2011 16:25:29 +0000 (18:25 +0200)
mp-solid.mp

index 49d35fa..11f5294 100644 (file)
@@ -1,32 +1,26 @@
-%% =============================================================================
-%% Fichier : mp-solid.mp
-%% =============================================================================
-%% Le fichier spatial d'Anthony Phan m'a permis de mettre certaines choses au
-%% clair. ;-)
-%% 14/08/2008
-
+%Le fichier spatial d'Anthony Phan m'a permis de mettre certaines choses au clair. ;-)
+%v1
+%14/08/2008
 prologues:=2;
 
 prologues:=2;
 
-%% Constantes ------------------------------------------------------------------
-u  := 1cm;
-pi := 3.141592654;
-c  := 57.29578;                               % conversion d'un radian en degrés
-
-color rouge, vert, bleu, jaune, noir, blanc, orange, rose, violet, ciel,
-   cielfonce, orangevif, gris, marron;
-rouge     = (1,0,0);
-bleu      = (0,0,1);
-noir      = (0,0,0);
-blanc     = (1,1,1);
-orange    = (1,0.5,0);
-violet    = blanc-vert;
-rose      = (1,0.7,0.7);
-cielfonce = 0.9*(0.25,1,1);
-ciel      = bleu+vert;
-orangevif = (1,0.25,0.1);
-vert      = (0,1,0);
-jaune     = blanc-bleu;
-gris      = 0.8*white;
+%Constantes
+u:=1cm;
+pi:=3.141592654;
+c:=57.29578; % conversion d'un radian en degrés
+color rouge,vert,bleu,jaune,noir,blanc,orange,rose,violet,ciel,cielfonce,orangevif,gris,marron;
+rouge=(1,0,0);
+bleu=(0,0,1);
+noir=(0,0,0);
+blanc=(1,1,1);
+orange=(1,0.5,0);
+violet=blanc-vert;
+rose=(1,0.7,0.7);
+cielfonce=0.9*(0.25,1,1);
+ciel=bleu+vert;
+orangevif=(1,0.25,0.1);
+vert=(0,1,0);
+jaune=blanc-bleu;
+gris=0.8*white;
 
 input format;
 input marith;
 
 input format;
 input marith;
@@ -37,7 +31,7 @@ input objets;
 
 color Sommet[];
 
 
 color Sommet[];
 
-%Anthony Phan
+%Anthony Phan
 vardef Norm primary z =
   abs (abs(Xpart z, Ypart z), Zpart z)
 enddef;
 vardef Norm primary z =
   abs (abs(Xpart z, Ypart z), Zpart z)
 enddef;
@@ -48,7 +42,7 @@ let Zpart = bluepart;
 %
 
 string typerepre,pointilles;
 %
 
 string typerepre,pointilles;
-typerepre := "persp";
+typerepre:="persp";
 
 vardef Initialisation(expr r,t,p,d)=
   Rho:=r;
 
 vardef Initialisation(expr r,t,p,d)=
   Rho:=r;
@@ -685,10 +679,20 @@ vardef Sparam(expr fn,umin,umax,upas,vmin,vmax,vpas)=%fonction
        if arcenciel: lumin(cpt[k])*Hsvtorgb((floor((cpt[k]/apj)*360),satu,lum))
        else: lumin(cpt[k])*outcolor fi
       else:lumin(cpt[k])*incolor fi;
        if arcenciel: lumin(cpt[k])*Hsvtorgb((floor((cpt[k]/apj)*360),satu,lum))
        else: lumin(cpt[k])*outcolor fi
       else:lumin(cpt[k])*incolor fi;
-      draw for l=1 upto 4:
-       Projette(Fc[cpt[k]][l])--
-      endfor
-      cycle;
+      if traits=true:
+       draw for l=1 upto 4:
+           Projette(Fc[cpt[k]][l])--
+       endfor
+       cycle;
+      else:
+       draw for l=1 upto 4:
+           Projette(Fc[cpt[k]][l])--
+       endfor
+       cycle withcolor if Vue[cpt[k]]:
+           if arcenciel: lumin(cpt[k])*Hsvtorgb((floor((cpt[k]/apj)*360),satu,lum))
+         else: lumin(cpt[k])*outcolor fi
+       else:lumin(cpt[k])*incolor fi;
+      fi;
     endfor;
     );
   Spar:=false;
     endfor;
     );
   Spar:=false;

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.