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
\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\psSpiralRing{\pst@object{psSpiralRing}}
%% usage : \psSpiralRing[options]
\def\psSpiralRing@i{\@ifnextchar({\psSpiralRing@ii}{\psSpiralRing@ii(0,0,0)}}
\def\psSpiralRing@ii(#1,#2,#3){%
  \pst@killglue%
  \begingroup%
  \use@par%
\pstVerb{%
         /ri \pst@solides@rO\space def % rayon int\'{e}rieur
         /rm \pst@solides@rI\space def % rayon moyen
         /spires \pst@solides@spires\space def
         /dPHI \pst@solides@dPHI\space def
         /THETA {PHI spires 2 mul mul} def
         /x {rm ri THETA cos mul add PHI cos mul} def
         /y {rm ri THETA cos mul add PHI sin mul} def
         /z {ri THETA sin mul} def
         /dt {360 \pst@solides@resolution\space div} bind def
         /PHI 0 def
         x y z /x0 x def /y0 y def /z0 z def % S1
         /tableau_des_sommets [
          0 dt 360 dt 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
                     rm ri THETA1 cos mul add PHI cos mul
                     rm ri THETA1 cos mul add PHI sin mul
                     ri THETA1 sin mul
                     /PHI PHI dt sub def
                     rm ri THETA0 cos mul add PHI cos mul
                     rm ri THETA0 cos mul add PHI sin mul
                     ri THETA0 sin mul  % 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
    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
  dup
 (fillincolor) outputcolors
  } def
ruban_interieur drawsolid**
ruban_exterieur drawsolid**}%
  \endgroup%
  \ignorespaces%
}
\makeatother
 
\pagestyle{empty}
\begin{document}
\psset{viewpoint=20 20 60,Decran=20,lightsrc=10 20 5,resolution=360}
 
\def\myFigure{%
\psSpiralRing[incolor=yellow,r1=5,r0=1,fillcolor=blue,grid,dPHI=\ai,spires=10](0,0,0)
}
 
\FPdiv{\myDeltaA}{10}{60}%
\def\ai{1}%
\FPdiv{\myDeltaB}{360}{60}%
\def\bi{0}%
\multido{\i=1+1}{60}{%
 \begin{pspicture}(-5,-2)(5,2)
  \myFigure %
 \end{pspicture}
 \newpage
 \FPadd{\ai}{\ai}{\myDeltaA}
 \FPadd{\bi}{\bi}{\myDeltaB}
}
\end{document}