samedi 21 mai 2016

Le triangle de Reuleaux - 2 (version trajet un peu plus long)




\documentclass{article}
\usepackage[a4paper,hmargin=1cm]{geometry}
\usepackage{pst-plot,pstricks,pst-node}
% manuel.luque27@gmail.com
\usepackage{animate}
\begin{document}

\begin{center}
\def\triangleReuleauxA{
\pnode(!0 3  sqrt 3 div){A}
\pnode(!-0.5 3 sqrt 6 div neg){B}
\pnode(!0.5 3 sqrt 6 div neg){C}
\pspolygon[showpoints,linecolor=magenta](A)(B)(C)
\psline(A)\psline(B)\psline(C)
\pscustom[fillstyle=solid,fillcolor={[rgb]{0 0.5 0}},opacity=0.6]{%
\psarc(A){1}{240}{300}
\psarc(B){1}{0}{60}
\psarc(C){1}{120}{180}\closepath}%
\psdot[linecolor=red](0,0)
}%
\def\triangleReuleauxB{
\pnode(!0 1){A}
\pnode(!3 sqrt -2 div 0.5){B}
\pnode(0,0){C}
\pnode(! 3 sqrt 6 div neg 0.5){G}
\pspolygon[showpoints,linecolor=magenta](A)(B)(C)
\psline(G)(A)\psline(G)(B)\psline(G)(C)
\pscustom[fillstyle=solid,fillcolor={[rgb]{0 0.5 0}},opacity=0.6]{
\psarc(A){1}{210}{270}
\psarc(B){1}{-30}{30}
\psarc(C){1}{90}{150}\closepath}
\psdot[linecolor=red](G)}%
\begin{animateinline}[controls,palindrome,
                     begin={\begin{pspicture}(-4,-3)(14,4)},
                     end={\end{pspicture}}]{10}% 10 images/s
\multiframe{60}{i=30+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{/psxyG {/alpha exch def
         alpha DegtoRad alpha sin 3 sqrt div sub     % x
         3 sqrt 3 div alpha cos 3 sqrt div sub       % y
     } def
     /dGA 1 3 sqrt div def
     }%
\rput{!\i}(!\i\space neg psxyG){\psset{linecolor=blue}\triangleReuleauxA}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{\i\space neg}{t DegtoRad t sin 3 sqrt div sub 3 sqrt 3 div t cos 3 sqrt div sub}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{\i\space neg}{/xG t DegtoRad t sin 3 sqrt div sub def
                                                  /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                                   dGA t sin mul xG add
                                                   dGA t cos mul yG add}
}%
\newframe
\multiframe{61}{i=0+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{
     /xG1 3.14159 6 div 1 2 3 sqrt mul div sub def
     /yG1 3 sqrt 3 div 0.5 sub def
     /xC1 3.15159 6 div def
     /yC1 3 sqrt 3 div 1 sub def
     /d12 xC1 xG1 sub dup mul yC1 yG1 sub dup mul add sqrt def
     /dGA 1 3 sqrt div def
     }%
\rput{\i}(!xC1 yC1){\psset{linecolor=blue}\triangleReuleauxB}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 yC1){!d12}{120}{!\i\space 120 add}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                        /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                         dGA t sin mul xG add
                                         dGA t cos mul yG add}
\psarcn[linecolor=magenta](!xC1 yC1){1}{90}{!\i\space 90 add}
}%
\newframe
\multiframe{61}{i=30+-1,I=0+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{/psxyG {/alpha exch def
         alpha DegtoRad alpha sin 3 sqrt div sub     % x
         3 sqrt 3 div alpha cos 3 sqrt div sub       % y
     } def
     /xG1 3.14159 6 div 1 2 3 sqrt mul div sub def
     /yG1 3 sqrt 3 div 0.5 sub def
     /xC1 3.15159 6 div def
     /yC1 3 sqrt 3 div 1 sub def
     /d12 xC1 xG1 sub dup mul yC1 yG1 sub dup mul add sqrt def
     /dGA 1 3 sqrt div def
     }%
\rput{!\i}(!\i\space neg psxyG exch xC1 2 mul add exch){\psset{linecolor=blue}\triangleReuleauxA}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 yC1){!d12}{120}{60}
\parametricplot[linecolor=red]{-30}{\i\space neg}{t DegtoRad t sin 3 sqrt div sub xC1 2 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                        /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                         dGA t sin mul xG add
                                         dGA t cos mul yG add}
\psarcn[linecolor=magenta](!xC1 yC1){1}{90}{30}
\parametricplot[linecolor=magenta]{-30}{\i\space neg}{/xG t DegtoRad t sin 3 sqrt div sub def
                                          /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                           0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add
                                           -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add}
}%
\newframe
\multiframe{61}{i=0+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{
     /xG1 3.14159 6 div 1 2 3 sqrt mul div sub def
     /yG1 3 sqrt 3 div 0.5 sub def
     /xC1 3.15159 6 div def
     /yC1 3 sqrt 3 div 1 sub def
     /d12 xC1 xG1 sub dup mul yC1 yG1 sub dup mul add sqrt def
     /dGA 1 3 sqrt div def
     }%
\rput{\i}(!xC1 3 mul yC1){\psset{linecolor=blue}\triangleReuleauxB}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 yC1){!d12}{120}{60}
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub xC1 2 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 3 mul yC1){!d12}{120}{!\i\space 120 add}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                        /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                         dGA t sin mul xG add
                                         dGA t cos mul yG add}
\psarcn[linecolor=magenta](!xC1 yC1){1}{90}{30}
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                         /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                          0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add
                                          -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add}
                                          }%
\newframe
\multiframe{61}{i=30+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{/psxyG {/alpha exch def
         alpha DegtoRad alpha sin 3 sqrt div sub     % x
         3 sqrt 3 div alpha cos 3 sqrt div sub       % y
     } def
     /xG1 3.14159 6 div 1 2 3 sqrt mul div sub def
     /yG1 3 sqrt 3 div 0.5 sub def
     /xC1 3.15159 6 div def
     /yC1 3 sqrt 3 div 1 sub def
     /d12 xC1 xG1 sub dup mul yC1 yG1 sub dup mul add sqrt def
     /dGA 1 3 sqrt div def
     }%
\rput{!\i}(!\i\space neg psxyG exch xC1 4 mul add exch){\psset{linecolor=blue}\triangleReuleauxA}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 yC1){!d12}{120}{60}
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub xC1 2 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 3 mul yC1){!d12}{120}{60}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                        /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                         dGA t sin mul xG add
                                         dGA t cos mul yG add}
\psarcn[linecolor=magenta](!xC1 yC1){1}{90}{30}
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                          /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                           0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add
                                           -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add}
\parametricplot[linecolor=red]{-30}{\i\space neg}{t DegtoRad t sin 3 sqrt div sub xC1 4 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
\parametricplot[linecolor=magenta]{30}{\i\space}{/xG t DegtoRad t sin 3 sqrt div sub def
                                          /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                          /xP1 0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add def
                                          /yP1 -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add def
                                          6 xC1 mul xP1 sub
                                          yP1
                                          }
}%
\newframe
\multiframe{61}{i=0+-1}{
\psset{unit=4}
\rput(0,-0.02264973070){%
      \psframe*[linecolor=yellow!20,unit=0.1](-7,-5)(35,7)
      \psgrid[subgriddiv=0,gridcolor=blue,griddots=5,gridlabels=0pt,unit=0.1](-7,-5)(35,7)
                        }%
\pstVerb{
     /xG1 3.14159 6 div 1 2 3 sqrt mul div sub def
     /yG1 3 sqrt 3 div 0.5 sub def
     /xC1 3.15159 6 div def
     /yC1 3 sqrt 3 div 1 sub def
     /d12 xC1 xG1 sub dup mul yC1 yG1 sub dup mul add sqrt def
     /dGA 1 3 sqrt div def
     }%
\rput{\i}(!xC1 5 mul yC1){\psset{linecolor=blue}\triangleReuleauxB}
%\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div 0.02 add)
%\psline(!-0.7 3  sqrt 3 div)(!2.8 3  sqrt 3 div)
\psframe[linestyle=none,fillstyle=hlines,hatchwidth=.6pt,hatchsep=2pt](!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1.02 sub)
\psline(!-0.7 3  sqrt 3 div 1 sub)(!3.5 3 sqrt 3 div 1 sub)
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 yC1){!d12}{120}{60}
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub xC1 2 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 3 mul yC1){!d12}{120}{60}
\parametricplot[linecolor=red]{-30}{30}{t DegtoRad t sin 3 sqrt div sub xC1 4 mul add  3 sqrt 3 div t cos 3 sqrt div sub}
\psarcn[linecolor=red](!xC1 5 mul yC1){!d12}{120}{!\i\space 120 add}
% lieu du sommet A
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                        /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                         dGA t sin mul xG add
                                         dGA t cos mul yG add}
\psarcn[linecolor=magenta](!xC1 yC1){1}{90}{30}
\parametricplot[linecolor=magenta]{-30}{30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                            /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                            0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add
                                            -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add}
\parametricplot[linecolor=magenta]{30}{-30}{/xG t DegtoRad t sin 3 sqrt div sub def
                                          /yG 3 sqrt 3 div t cos 3 sqrt div sub def
                                          /xP1 0.5 t cos mul 3 sqrt 6 div neg t sin mul add xG xC1 2 mul add add def
                                          /yP1 -0.5 t sin mul 3 sqrt 6 div neg t cos mul add yG add def
                                          6 xC1 mul xP1 sub
                                          yP1}
\psarcn[linecolor=magenta](!xC1 5 mul yC1){1}{150}{!\i\space 150 add}
}%
\end{animateinline}
\end{center}
\end{document}

Aucun commentaire:

Enregistrer un commentaire