[pstricks] example for the gallery page
mathias legrand
legrand.mathias at gmail.com
Sun Aug 8 19:15:37 CEST 2010
Hi,
also, you may be interested by the following example for the gallery
page : http://tug.org/PSTricks/main.cgi?file=Examples/Gallery/Gallery
nothing very fancy and tricky, but still nice. It may be improved I guess.
\documentclass[fleqn,10pt]{book}
\usepackage[top=2.5cm,left=3cm,right=3cm,bottom=2.5cm,a4paper]{geometry}
\usepackage{pstricks-add}
\begin{document}
\begin{figure}[h!]\centering
\psset{xunit=1cm,yunit=1cm,runit=1cm}
\def\rE{1.6 }
\def\rI{0.8 }
\def\nfrE{25 }
\def\nfrI{12 }
\def\nfL{12 }
\def\lF{0.4 }
\def\pi{3.141592653589 }
\psset{arrowsize=3pt,arrowlength=2,arrowinset=0}
\begin{pspicture}(-3,-2)(8,2)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure de gauche
\pscircle[linewidth=1.5pt,fillstyle=vlines,hatchwidth=0.1pt](0,0){\rE}
\pscircle[linewidth=1.5pt,fillstyle=solid,fillcolor=white](0,0){\rI}
\multido{\i=0+1}{\nfrE}{%
\cnode*(!\rE dup 360 \nfrE \space div \i\space 1 sub mul cos mul
exch 360 \nfrE \space div \i\space 1 sub mul sin mul){0pt}{A}%
\cnode*(!\rE\space \lF\space add dup 360 \nfrE \space div \i\space
1 sub mul cos mul exch 360 \nfrE \space div \i\space 1 sub mul sin
mul){0pt}{B}%
\psline[linewidth=1pt]{->}(B)(A)%
}
\cnode*(!0 dup){0pt}{A}%
\cnode*(!\rI dup \space 14.3 cos mul exch 14.3 sin mul){0pt}{B}%
\psline[linewidth=0.5pt]{->}(A)(B)
\cnode*(!0 dup){0pt}{A}%
\cnode*(!\rE dup \space 228 cos mul exch 228 sin mul){0pt}{B}%
\psline[linewidth=0.5pt]{->}(A)(B)
\cnode*(!0 dup){0pt}{A}%
\cnode*(!1.2 dup \space 131.6 cos mul exch 131.6 sin mul){0pt}{B}%
\psline[linewidth=0.5pt]{->}(A)(B)
\multido{\i=0+1}{\nfrI}{%
\cnode*(!\rI dup 360 \nfrI \space div \i\space 1 sub mul cos mul
exch 360 \nfrI \space div \i\space 1 sub mul sin mul){0pt}{A}%
\cnode*(!\rI\space \lF\space sub dup 360 \nfrI \space div \i\space
1 sub mul cos mul exch 360 \nfrI \space div \i\space 1 sub mul sin
mul){0pt}{B}%
\psline[linewidth=1pt]{->}(B)(A)
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% figure de droite
\psframe[linewidth=1.5pt,fillstyle=vlines,hatchwidth=0.1pt](3,-1.6)(7,1.6)
\psframe[linewidth=1pt,fillstyle=solid,fillcolor=white](3,-0.8)(7,0.8)
\multido{\i=0+1}{\nfL}{%
% pression extérieure
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rE
\space mul){0pt}{A}%
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rE
\space \lF\space add mul){0pt}{B}%
\psline[linewidth=1pt]{->}(B)(A)
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rE
\space neg mul){0pt}{A}%
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rE
\space neg \lF\space sub mul){0pt}{B}%
\psline[linewidth=1pt]{->}(B)(A)
% pression intérieure
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch 0.4
\space mul){0pt}{A}%
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rI
\space mul){0pt}{B}%
\psline[linewidth=1pt]{->}(A)(B)
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch 0.4
\space neg mul){0pt}{A}%
\cnode*(!1 dup 4 \nfL \space 1 sub div \i\space mul 3 add mul exch \rI
\space neg mul){0pt}{B}%
\psline[linewidth=1pt]{->}(A)(B)
}
\psset{arrowsize=2pt,arrowlength=2,arrowinset=0}
\psarc{<->}(0,0){1.2}{72}{108}
\psline{<->}(0,0.9)(0,1.5)
\psline{<->}(5.15,0.9)(5.15,1.5)
\psframe[linewidth=0.5pt,fillstyle=solid,fillcolor=lightgray](5,1.1)(5.3,1.3)
\pscustom[linewidth=0.5pt,fillstyle=solid,fillcolor=lightgray]{%
\psarc(0,0){1.1}{82}{98}
\psarcn(0,0){1.3}{98}{82}}
\cnode*(!1.1 dup 82 cos mul exch 82 sin mul){0pt}{A}%
\cnode*(!1.3 dup 82 cos mul exch 82 sin mul){0pt}{B}%
\psline[linewidth=0.5pt](A)(B)
\psarc(0,0){1.2}{126}{138}
\psline[linewidth=0.2pt,linestyle=dashed](-3,0)(8,0)
\end{pspicture}
\end{figure}
\end{document}
More information about the PSTricks
mailing list