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
\makeatletter
\define@key[psset]{pst-solides3d}{dZ}{\def\pst@solides@dZ{#1}} % hauteur du ruban
\psset[pst-solides3d]{dZ=0.5} % hauteur du ruban
\define@key[psset]{pst-solides3d}{spires}{\def\pst@solides@spires{#1}} %
\psset[pst-solides3d]{spires=2} % nombre de spires d'un ruban
\define@key[psset]{pst-solides3d}{rubans}{\def\pst@solides@rubans{#1}} %
\psset[pst-solides3d]{rubans=1} % nombre de spires d'un ruban
 
\def\pshelices{\pst@object{pshelices}}
%% usage : \pshelices[options]
\def\pshelices@i{\@ifnextchar({\pshelices@ii}{\pshelices@ii(0,0,0)}}
\def\pshelices@ii(#1,#2,#3){%
  \pst@killglue%
  \begingroup%
  \use@par%
\pstVerb{/dz \pst@solides@dZ\space def}%
\pstVerb{%
/initvar_SpiralHelice {
         /rubans \pst@solides@rubans\space def
         /phase {360 rubans div} bind def
         /Rayon \pst@solides@R\space def
         /dz \pst@solides@dZ\space def
         /Hauteur \pst@solides@h\space def
         /PHI 0 def
         /x0 Rayon PHI cos mul def
         /y0 Rayon PHI sin mul def
         /z0 0 def
         /pulsation {6.28319 Hauteur div \pst@solides@spires\space mul} bind def
         /x1 {Rayon t pulsation mul 57.295 mul PHI add cos mul} def
         /y1 {Rayon t pulsation mul 57.295 mul PHI add sin mul} def
         /z1 {t} def
         /dA {Hauteur \pst@solides@resolution\space div} bind def
         /tableau_des_sommets [
             rubans {
          dA dA Hauteur{/t exch def
                     x0 y0 z0
                     x1 y1 z1
                     x1 y1 z1 dz add
                     x0 y0 z0 dz add
                     /x0 x1 def
                     /y0 y1 def
                     /z0 z1 def
                  } for
          /PHI PHI phase add def
          /x0 Rayon PHI cos mul def
          /y0 Rayon PHI sin mul def
          /z0 0 def
          } repeat
                  ]
           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
} def
}%
\codejps{
/ruban_exterieur {
20 dict begin
   initvar_SpiralHelice
/S [
  Sommets
  ] def
/F [
  Faces
  ] def
  S F generesolid
    RotX 0 ne RotY 0 ne or RotZ 0 ne or  {
        dup {RotX RotY RotZ rotateOpoint3d} solidtransform
               } if
   #1 0 ne #2 0 ne or #3 0 ne or  {
      dup {#1 #2 #3 translatepoint3d} solidtransform
              } if
   solidhue length 0 gt {
      dup solidhue 0 get solidhue 1 get solidputhuecolors
   } {
      dup (fillcolor) outputcolors
   } ifelse
end
} def
%
/ruban_interieur {
20 dict begin
   initvar_SpiralHelice
/S [
  Sommets
  ] def
/F [
  Faces_internes
  ] def
  S F generesolid
    RotX 0 ne RotY 0 ne or RotZ 0 ne or  {
        dup {RotX RotY RotZ rotateOpoint3d} solidtransform
               } if
   #1 0 ne #2 0 ne or #3 0 ne or  {
      dup {#1 #2 #3 translatepoint3d} solidtransform
              } if
  dup
 (fillincolor) outputcolors
end
  } def
ruban_interieur drawsolid**
ruban_exterieur drawsolid**}%
  \endgroup%
  \ignorespaces%
}
\makeatother
 
\pagestyle{empty}
\begin{document}
 
\psset{lightsrc=35 5 5,SphericalCoor,viewpoint=50 45 5,Decran=50,resolution=240}
 
\def\myFigure{%
\pstVerb{%
/amplitude \ai\space sin 0.4 mul 1 add 5 mul def
/radius \ai\space sin 0.4 mul 1 add 2 exp neg 1 add 25 mul 4 div pi 2 exp div 100 div 1.5 2 exp add 0.5 exp def
}
\rput(6,0){
\psSolid[object=cylindre,r=1.82,h=0.2,ngrid=1 36](0,0,6)%
\pshelices[incolor=gray!75,R=radius,h=amplitude,hue=0.2 0.5,grid,RotY=180,spires=10,dZ=0.125](0,0,6)
\psSolid[object=cylindre,r=1.2,h=1,ngrid=4 36,fillcolor=blue](0,0,amplitude neg 5 add)
\psPoint(0,0,amplitude neg 6 add){E1}
\psdot(E1)
}
}
 
\FPdiv{\myDeltaA}{720}{60}%
\def\ai{0}%
\multido{\i=1+1}{60}{%
 \begin{pspicture}(-2,-1)(2,6)
  \myFigure%
 \end{pspicture}
 \newpage
 \FPadd{\ai}{\ai}{\myDeltaA}
} 
 
\end{document}