Retour

anim.tex

Télécharger le fichier Fichier PDF
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{%
         /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
}%
\codejps{
/ruban_exterieur {
/S [
  Sommets
  ] def
/F [
  Faces
  ] def
  S F generesolid
  dup {RotX RotY RotZ rotateOpoint3d} solidtransform
      {#1 #2 #3 translatepoint3d} solidtransform
 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}
 
 
\psset{lightsrc=30 5 17,SphericalCoor,viewpoint=50 45 10,Decran=50,resolution=90}
 
\def\myFigure{%
%\psframe[linewidth=2\pslinewidth](-2,-1)(2,6)
%\psSolid[object=cylindre,r=1.5,h=0.2,ngrid=1 36](0,0,-0.2)%
\pshelices[incolor=red!50,R=1.5,h=\ai,linewidth=0.5\pslinewidth,dZ=0.15,hue,rubans=4](0,0,0)
%\psSolid[object=cylindre,r=1.5,h=0.2,ngrid=1 36](0,0,\nH\space dz add)%
}
 
 
 
\FPdiv{\myDeltaA}{6}{60}%
\def\ai{2}%
\multido{\i=1+1}{60}{
 \begin{pspicture}(-2,-1)(2,6)
  \myFigure%
 \end{pspicture}
 \newpage
 \FPadd{\ai}{\ai}{\myDeltaA}
}
 
\end{document}