jeudi 4 octobre 2012

Les pâtes alimentaires façon PSTricks - 5 : Bucatini et Stelline

Pour dessiner le contour des pâtes il faut modifier le fichier pst-solides3d.pro en désactivant quelques lignes :
ajouter des % aux lignes indiquées :

/proj-pst-courbeR2 {
   l@pl@n plangetrange aload pop
   setyrange setxrange
%   newpath
%      xmin ymin l@pl@n pointplan smoveto
%      xmin ymax l@pl@n pointplan slineto
%      xmax ymax l@pl@n pointplan slineto
%      xmax ymin l@pl@n pointplan slineto
%      xmin ymin l@pl@n pointplan slineto
%      planprojpst projpath
%   clip
%   solidlinewidth setlinewidth
   newpath
      linecolor
      range aload pop { function cvx exec } CourbeR2_
      gere_pstricks_proj_opt
} def

/proj-pst-courbe {
   l@pl@n plangetrange aload pop
   setyrange setxrange
%   newpath
%      xmin ymin l@pl@n pointplan smoveto
%      xmin ymax l@pl@n pointplan slineto
%      xmax ymax l@pl@n pointplan slineto
%      xmax ymin l@pl@n pointplan slineto
%      xmin ymin l@pl@n pointplan slineto
%      planprojpst projpath
%   clip
   solidlinewidth setlinewidth
   newpath
      linecolor
      range aload pop {} { function cvx exec } Courbeparam_
      gere_pstricks_proj_opt
} def

Les fichiers sont dans le sous-dossier "bucati-stellini" :


Le listing :

\documentclass{article}
\usepackage[a4paper,margin=2cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage{pst-plot,pst-solides3d}
\usepackage{pst-text}
\title{Les pâtes alimentaires façon PSTricks - 5 :\\ Bucatoni et Stelline}
\date{5 octobre 2012}
\begin{document}
\maketitle

\begin{center}
%Bucatini

\begin{pspicture}(-4,-1)(4,10)
\psset{lightsrc=100 20 50 rtp2xyz,viewpoint=100 0 60 rtp2xyz,Decran=20}
\pstVerb{/iface 0 store
         /BLEU {0.2 0.2 1 setrgbcolor} def}%
\psSolid[object=grille,base=-48 0 -8 8,ngrid=2. 2.,RotY=90,grid,
 fcol=0 16 368 { /i exch def
 0 2 6 {/j exch def
 j i add (cyan)
 j i 1 add add (BLEU)
 } for
 } for
 8 16 352 { /i exch def
 0 2 6 {/j exch def
 j i add (BLEU)
 j i 1 add add (cyan)
 } for
 } for
](-1,0,0)
{\psset{solidmemory}
\psSolid[object=plan,
    definition=normalpoint,
    args={-1 0 40 [1 0 0]},
    action=none,name=panneau,
    base=-1 1 -2 2]
\psProjection[object=texte,
    fontsize=150,linecolor=red,
    plan=panneau,phi=180,
    text=Bucatini](16,5)%
\composeSolid}
\psSolid[object=prisme,h=50,grid,%ngrid=18 1,
incolor={[hsb]{0.118 1 1}},
fillcolor={[hsb]{0.118 1 1}},
base=0 2 360 {
/angle ED
 1.25 angle cos mul
 1.25 angle sin mul
} for
360 -2 0 {
/angle ED
0.75 angle cos mul
0.75 angle sin mul
} for
](0,0,0)
%% definition du plan de projection
\psset{solidmemory}
\defFunction[algebraic]{cercle1}(t){1.25*cos(t)}{1.25*sin(t)}{}
\defFunction[algebraic]{cercle2}(t){0.75*cos(t)}{0.75*sin(t)}{}
\psSolid[object=plan,
   definition=equation,
   args={[0 0 1 -50]},
   base=-4 4 -4 4,
   action=none,
   name=monplan
]
\psset{plan=monplan}
\psProjection[object=courbeR2,
   linewidth=0.02,linecolor={[rgb]{0.4 0 0}},
   range=0 2 Pi mul,resolution=360,
   function=cercle2
]
\psProjection[object=courbeR2,
   linewidth=0.02,linecolor={[rgb]{0.4 0 0}},
   range=0 2 Pi mul,resolution=360,
   function=cercle1
]
\composeSolid
\end{pspicture}
\end{center}

\begin{center}
\begin{pspicture}(-4,-3)(4,4)
\psset{unit=0.4}
\pscustom[linestyle=none]{
\parametricplot[plotpoints=720,algebraic]{0}{6.283185}{%
(5+1.*sin(5*t))*cos(t)|(5+1.*sin(5*t))*sin(t)}
\parametricplot[plotpoints=720,algebraic]{6.283185}{0}{
2*cos(t)|2*sin(t)}
\fill[fillstyle=solid,fillcolor={[hsb]{0.118 1 1}}]
}
\parametricplot[plotpoints=720,algebraic]{0}{6.283185}{%
(5+1.*sin(5*t))*cos(t)|(5+1.*sin(5*t))*sin(t)}
\parametricplot[plotpoints=720,algebraic]{6.283185}{0}{%
2*cos(t)|2*sin(t)}
\end{pspicture}
\begin{pspicture}(-4,-3)(4,3)
\psset{lightsrc=viewpoint,viewpoint=40 70 50 rtp2xyz,Decran=16}
\pstVerb{/iface 0 store
         /BLEU {0.2 0.2 1 setrgbcolor} def}%
\psSolid[object=grille,base=-8 8 -8 8,ngrid=2. 2.,grid,
 fcol=0 16 48 { /i exch def
 0 2 6 {/j exch def
 j i add (cyan)
 j i 1 add add (BLEU)
 } for
 } for
 8 16 56 { /i exch def
 0 2 6 {/j exch def
 j i add (BLEU)
 j i 1 add add (cyan)
 } for
 } for
](0,0,0)
\defFunction[algebraic]{etoile}(t){(5+1.*sin(5*t))*cos(t)}{(5+1.*sin(5*t))*sin(t)}{}
\defFunction[algebraic]{cercle}(t){2*cos(t)}{2*sin(t)}{}
\psset{solidmemory}
\psSolid[object=plan,
   definition=equation,
   args={[0 0 1 0]},
   base=-4 4 -4 4,
   action=none,
   name=planTexte
]
\psProjection[object=texte,
    fontsize=75,linecolor=red,
    plan=planTexte,phi=180,
    text=Stelline](0,-7)%
\psSolid[object=plan,
   definition=equation,
   args={[0 0 1 -1]},
   base=-4 4 -4 4,
   action=none,
   name=monplan
]
\psset{plan=monplan}
\psSolid[object=prisme,h=1,grid,
algebraic,
%ngrid=9,
incolor={[hsb]{0.118 1 1}},
fillcolor={[hsb]{0.118 1 1}},
base=0 1 360 {
/angle ED
5 5 angle mul sin add angle cos mul
5 5 angle mul sin add angle sin mul
} for
360 -1 0 {
/angle ED
2 angle cos mul
2 angle sin mul
} for
](0,0,0)
\psProjection[object=courbeR2,%visibility,
   linewidth=0.02,linecolor={[rgb]{0.4 0 0}},
   range=0 2 Pi mul,resolution=720,
   function=cercle
]
\psProjection[object=courbeR2,%visibility,
   linewidth=0.02,linecolor={[rgb]{0.4 0 0}},
   range=0 2 Pi mul,resolution=720,
   function=etoile
]
\composeSolid
\end{pspicture}
\end{center}
\end{document}
Modifier ainsi pst-solides3d.pro :

/proj-pst-courbeR2 {
   l@pl@n plangetrange aload pop
   setyrange setxrange
%   newpath
%      xmin ymin l@pl@n pointplan smoveto
%      xmin ymax l@pl@n pointplan slineto
%      xmax ymax l@pl@n pointplan slineto
%      xmax ymin l@pl@n pointplan slineto
%      xmin ymin l@pl@n pointplan slineto
%      planprojpst projpath
%   clip
%   solidlinewidth setlinewidth
   newpath
      linecolor
      range aload pop { function cvx exec } CourbeR2_
      gere_pstricks_proj_opt
} def

/proj-pst-courbe {
   l@pl@n plangetrange aload pop
   setyrange setxrange
%   newpath
%      xmin ymin l@pl@n pointplan smoveto
%      xmin ymax l@pl@n pointplan slineto
%      xmax ymax l@pl@n pointplan slineto
%      xmax ymin l@pl@n pointplan slineto
%      xmin ymin l@pl@n pointplan slineto
%      planprojpst projpath
%   clip
   solidlinewidth setlinewidth
   newpath
      linecolor
      range aload pop {} { function cvx exec } Courbeparam_
      gere_pstricks_proj_opt
} def

Aucun commentaire:

Publier un commentaire