Retour

anim.tex

Télécharger le fichier
Image PNG
\documentclass{article}
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-node,pst-plot,pst-eucl}
\usepackage{graphicx}
\usepackage{pst-solides3d}
\usepackage{multido}
\usepackage[nomessages]{fp}
 
\parindent=0pt
\definecolor{orange}{rgb}{1,.65,0}
\makeatletter
\define@key[psset]{pst-solides3d}{dPHI}{\def\pst@solides@dPHI{#1}} % hauteur du ruban
\psset[pst-solides3d]{dPHI=5} % hauteur du ruban en degr\'{e}s
\define@key[psset]{pst-solides3d}{spires}{\def\pst@solides@spires{#1}} %
\psset[pst-solides3d]{spires=10} % nombre de spires d'un ruban
 
\def\psSphericalSpiral{\pst@object{psSphericalSpiral}}
%% usage : \psSphericalSpiral[options]
\def\psSphericalSpiral@i{\@ifnextchar({\psSphericalSpiral@ii}{\psSphericalSpiral@ii(0,0,0)}}
\def\psSphericalSpiral@ii(#1,#2,#3){%
  \pst@killglue%
  \begingroup%
  \use@par%
\pstVerb{%
         /Rayon \pst@solides@R\space def
         /spires \pst@solides@spires\space def
         /dPHI \pst@solides@dPHI\space def
         /THETA {PHI spires 2 mul mul} def
         /x {Rayon THETA cos mul PHI cos mul} def
         /y {Rayon THETA sin mul PHI cos mul} def
         /z {Rayon PHI sin mul} def
         /dt {180 \pst@solides@resolution\space div} bind def
         /PHI -90 def
         x y z /x0 x def /y0 y def /z0 z def % S1
         /tableau_des_sommets [
          -90 dt 90 dPHI sub{/t exch def
                    /PHI t def /THETA0 THETA def
                     x y z
                     /PHI t dt add def /THETA1 THETA def
                     x y z /x1 x def /y1 y def /z1 z def % S2
                     /PHI PHI dPHI add def
%                     x1 y1 z                             % S3
                     Rayon THETA1 cos mul PHI cos mul
                     Rayon THETA1 sin mul PHI cos mul
                     z
                     /PHI PHI dt sub def
                     Rayon THETA0 cos mul PHI cos mul
                     Rayon THETA0 sin mul PHI cos mul
                     z  % S4
                  } for
                  ]
           def
         /Sommets {tableau_des_sommets aload pop} def
         /NbrePoints tableau_des_sommets length 3 div cvi def
        /Faces  {0 4 NbrePoints 4 sub {
                 /Ni exch def
               [ Ni Ni 1 add  Ni 2 add Ni 3 add]
                                     } for
              } def
        /Faces_internes {0 4 NbrePoints 4 sub {
                 /Ni exch def
               [Ni 3 add Ni 2 add Ni 1 add Ni]
                                     } for
             } def
}%
\codejps{
/ruban_exterieur {
/S [
  Sommets
  ] def
/F [
  Faces
  ] def
  S F generesolid
    RotX RotY RotZ add add abs 0 gt {
        dup {RotX RotY RotZ rotateOpoint3d} solidtransform
               } if
   #1 #2 #3 add add abs 0 gt {
      dup {#1 #2 #3 translatepoint3d} solidtransform
              } if
 solidhue  {
      dup solidputhuecolors
   }
   {
      dup (fillcolor) outputcolors
   } ifelse
} def
%
/ruban_interieur {
/S [
  Sommets
  ] def
/F [
  Faces_internes
  ] def
  S F generesolid
  dup {RotX RotY RotZ rotateOpoint3d} solidtransform
      {#1 #2 #3 translatepoint3d} solidtransform
  dup
 (fillincolor) outputcolors
  } def
ruban_interieur drawsolid**
ruban_exterieur drawsolid**}%
  \endgroup%
  \ignorespaces%
}
\makeatother
\pagestyle{empty}
\begin{document}
 
 
 
\begin{center}
\psset{unit=0.75}
\multido{\i=0+1}{100}{%
\begin{pspicture}(-5,-5)(5,5)
\psframe*(-5,-5)(5,5)
\psset{SphericalCoor,viewpoint=50 20 30,Decran=50,resolution=360,lightsrc=40 15 25}
\psSphericalSpiral[incolor=yellow!20,R=4,fillcolor=orange!\i,grid,dPHI=10](0,0,0)
\end{pspicture}
\newpage}
\end{center}
\end{document}