Retour

anim.tex

Télécharger le fichier
Image PNG
\documentclass[a4paper]{article}
\usepackage[dvipsnames,svgnames]{pstricks}
\usepackage{pst-node,pst-plot,pst-eucl}
\usepackage{multido}
\usepackage{pst-solides3d}
\usepackage[margin=1cm]{geometry}
\usepackage[nomessages]{fp}
 
\makeatletter
 
\def\cartesianIIID@coor#1,#2,#3,#4\@nil{\edef\pst@coor{#1 #2 #3 }}
\def\NormalIIIDCoor{%
  \def\pst@@getcoor##1{\pst@expandafter\cartesianIIID@coor{##1}, ,\@nil}%
  \def\psput@##1{\pst@@getcoor{##1}\leavevmode\psput@cartesian}%
}%
 
\def\pstThreeDLine{\NormalIIIDCoor\pst@object{lineIIID}}
\def\lineIIID@i{%
  \pst@killglue%
  \pst@getarrows{%
    \begin@OpenObj%
      \pst@getcoors[\lineIIID@ii%
  }%
}
\def\lineIIID@ii{%
  \addto@pscode{%
    \tx@optionssolides
    SolidesDict begin
   counttomark
  /n exch def /n3 n 3 div cvi def
  n3 {
    n -3 roll
      3dto2d
    /n n 1 sub def
  } repeat
    end
    \pst@cp\space \psline@iii\space \tx@Line
  }%
  \end@OpenObj%
  \ignorespaces%
  \SpecialCoor%
}
 
\def\pstThreePolygon{\NormalIIIDCoor\pst@object{polygonIIID}}
\def\polygonIIID@i{%
  \pst@killglue%
  \pst@getarrows{%
    \begin@ClosedObj%
      \pst@getcoors[\polygonIIID@ii%
  }%
}
\def\polygonIIID@ii{%
  \addto@pscode{%
    \tx@optionssolides
    SolidesDict begin
   counttomark
  /n exch def /n3 n 3 div cvi def
  n3 {
    n -3 roll
      3dto2d
    /n n 1 sub def
  } repeat
    end
    \pst@cp\space \psline@iii\space \tx@Polygon
  }%
  \end@ClosedObj%
  \ignorespaces%
  \SpecialCoor%
}
 
% macros d\'{e}j\`{a} pr\'{e}sentes dans pst-solides3d.tex
%
% transformation d'un point
% \pstransformIIID[RotX=,...](x y z)(CX,CY,CZ)
% Rotation d'un point(x y z)
% autour des axes Ox, Oy et Oz
% suivie
% de la translation au point (CX,CY,CZ)
\def\pstransformPoint{\def\pst@par{}\pst@object{pstransformPoint}}
\def\pstransformPoint@i(#1)(#2,#3,#4)#5{{% coordonnees cartesiennes
  \begin@SpecialObj
\pnode(!
    \tx@optionssolides
    SolidesDict begin
    #1 RotX RotY RotZ rotateOpoint3d
    #2 #3 #4 translatepoint3d
   3dto2d cm_1 exch cm_1 exch
   end){#5}%
   \end@SpecialObj
  }\ignorespaces}
 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \psPoint
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% placer un point en particulier
% \psPoint[options du point de vue](x y z)
\def\psPoint{\def\pst@par{}\pst@object{psPoint}}
\def\psPoint@i(#1,#2,#3)#4{{% coordonnees cartesiennes
    \begin@SpecialObj
\pnode(!
    \tx@optionssolides
    SolidesDict begin
    #1 #2 #3
   3dto2d cm_1 exch cm_1 exch
   end){#4}%
   \end@SpecialObj
  }\ignorespaces%
}
\makeatother
 
\pagestyle{empty}
 
\begin{document}
 
\psset{unit=3}
 
\def\deux{
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0,0,-1)(0.1,0.1,-1)(0.1,0.9,-1)(0,1,-1)(0,0,-1)%lu
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](1.3,1.1,-1)(1.2,1.2,-1)(1.2,2,-1)(1.3,2.1,-1)(1.3,1.1,-1)%ro
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,-0.05,-1)(1.25,-0.05,-1)(1.13,0.07,-1)(0.17,0.07,-1)(0.05,-0.05,-1)%u
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,2.16,-1)(1.25,2.16,-1)(1.13,2.05,-1)(0.17,2.05,-1)(0.05,2.16,-1)%o
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,1.05,-1)(0.12,0.98,-1)(1.18,0.98,-1)(1.25,1.05,-1)(1.18,1.12,-1)(0.12,1.12,-1)(0.05,1.05,-1)%m
}
 
 
\def\sept{
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](1.3,0,-0.50)(1.2,0.1,-0.50)(1.2,0.9,-0.50)(1.3,1,-0.50)(1.3,0,-0.50)%ru
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](1.3,1.1,-0.50)(1.2,1.2,-0.50)(1.2,2,-0.50)(1.3,2.1,-0.50)(1.3,1.1,-0.50)%ro
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,2.16,-0.50)(1.25,2.16,-0.50)(1.13,2.05,-0.50)(0.17,2.05,-0.50)(0.05,2.16,-0.50)%o
}
 
\def\neuf{
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0,1.1,0)(0.1,1.2,0)(0.1,2,0)(0,2.1,0)(0,1.1,0)%lo
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](1.3,0,0)(1.2,0.1,0)(1.2,0.9,0)(1.3,1,0)(1.3,0,0)%ru
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](1.3,1.1,0)(1.2,1.2,0)(1.2,2,0)(1.3,2.1,0)(1.3,1.1,0)%ro
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,-0.05,0)(1.25,-0.05,0)(1.13,0.07,0)(0.17,0.07,0)(0.05,-0.05,0)%u
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,2.16,0)(1.25,2.16,0)(1.13,2.05,0)(0.17,2.05,0)(0.05,2.16,0)%o
\pstThreePolygon[linewidth=1pt,fillstyle=solid,fillcolor=black](0.05,1.05,0)(0.12,0.98,0)(1.18,0.98,0)(1.25,1.05,0)(1.18,1.12,0)(0.12,1.12,0)(0.05,1.05,0)%m
}
 
\def\myFigure{%
\psset{SphericalCoor,viewpoint=40 -\ai\space \ai\space,Decran=20}
 
\rput(0,0){%
\psSolid[object=cube,a=4,action=draw*,fillcolor=gray!50,linewidth=1pt]}
%\rput[lt](0,0){\sept}
\rput[lt](0,0){\neuf}
\rput[lt](0,0){\deux}
}
 
\FPdiv{\myDeltaA}{220}{90}%
\def\ai{20}%
\FPdiv{\myDeltaB}{360}{90}%
\def\bi{40}%
\FPdiv{\myDeltaC}{90}{90}%
\def\ci{1}%
 
\multido{\i=1+1}{90}{%
 \begin{pspicture}(-2,-1)(2,1.5)
    \myFigure%
 \end{pspicture}    
 \newpage
 \FPadd{\ai}{\ai}{\myDeltaA}
 \FPadd{\bi}{\bi}{\myDeltaB}
 \FPadd{\ci}{\ci}{\myDeltaC}
}
 
\end{document}