Changeset 47

Show
Ignore:
Timestamp:
06/17/08 12:05:21 (6 months ago)
Author:
jpv
Message:

Ajout de la doc sur les sections

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/doc/par-section.tex

    r45 r47  
    1 \section {Sectionner un solide par un plan} 
    2  
     1\section {Intersection d'un plan et d'un solide} 
     2\subsection{Tracer l'intersection d'un plan et d'un solide} 
     3\subsubsection{Les paramètres} 
     4C'est l'option \Cadre{intersectionplan=\{[a b c d]\}} qui permet de tracer l'intersection d'un plan et d'un solide. L'argument entre les crochets contient les paramètres du plan affine ayant pour équation : $ax+by+cz+d=0$. Il est possible de dessiner l'intersection du solide avec plusieurs plans en plaçant à la suite les paramètres de ces plans comme dans l'exemple suivant. 
     5 
     6Le tracé est activé avec \Cadre{intersectiontype=0} ou toute autre valeur $\geq0$. 
     7 
     8La couleur du tracé est choisie dans l'option \Cadre{intersectioncolor=(bleu) (rouge) etc.} et l'épaisseur par \Cadre{intersectionlinewidth=1 2 etc.} On donne successivement dans l'ordre, l'épaisseur de chaque tracé en points. 
     9 
     10Le tracé en traits discontinus des parties cachées sera activé avec \Cadre{action=draw}. 
     11 
     12\begin{LTXexample}[width=6cm] 
     13\begin{pspicture}(-3,-2)(3,7) 
     14\psset{SphericalCoor=true,lightsrc=viewpoint,viewpoint=50 20 20,Decran=50} 
     15%\lightsource 
     16\psSolid[object=cylindre, 
     17   ngrid=1 24, 
     18   r=2, 
     19   fillcolor=yellow!25, 
     20   intersectiontype=0, 
     21   intersectionplan={ 
     22      [0 0 1 -1] 
     23      [0 0 1 -2] 
     24      [0 0 1 -3] 
     25      [0.894 0 0.447 -1.8]}, 
     26   intersectioncolor=(bleu) (rouge) (vert) (rose), 
     27   intersectionlinewidth=1 1.5 1.8 2.2] 
     28\axesIIID(2,2,6)(3,3,7) 
     29\end{pspicture} 
     30\end{LTXexample} 
     31\subsection{Coupes d'un solide} 
     32\subsubsection{Coupe du solide plein} 
     33L'objet étudié est un cylindre. 
     34Le plan qui coupe l'objet sera défini par : 
     35\begin{gbar} 
     36 \begin{verbatim} 
     37  plansepare={[a b c d]} 
     38 \end{verbatim} 
     39\end{gbar} 
     40Les deux parties ne seront pas tracées mais mises en mémoire avec le nom commun \Cadre{name=partiescylindre} : 
     41\begin{gbar} 
     42 \begin{verbatim} 
     43\psset{solidmemory} 
     44\psSolid[object=cylindre, 
     45   r=2,h=6 
     46   ngrid=6 24, 
     47   plansepare={[0.707 0 0.707 0]}, 
     48   name=partiescylindre, 
     49   action=none](0,0,-3) 
     50 \end{verbatim} 
     51\end{gbar} 
     52Puis affichées séparément avec leur indice respectif. C'est le sens de la normale du plan de séparation qui détermine le numérotage des deux parties : \Cadre{0} celle qui est \textit{au-dessus} de la normale et \Cadre{1} celle qui est \textit{au-dessous}. Pour les deux parties, la face de découpe porte le numéro \Cadre{0}. 
     53S'il y a plusieurs faces de découpe, comme dans le cas du tore elles sont numérotées \Cadre{0, 1 etc.} 
     54\begin{gbar} 
     55 \begin{verbatim} 
     56\psSolid[object=load, 
     57   load=partiescylindre1, 
     58   fillcolor={[rgb]{0.7 1 0.7 }}, 
     59   fcol=0 (1 1 0.7 setrgbcolor)] 
     60\psSolid[object=load, 
     61   load=partiescylindre0,RotZ=60, 
     62   fillcolor={[rgb]{0.7 1 0.7 }}, 
     63   fcol=0 (1 1 0.7 setrgbcolor)](0,4,0) 
     64 \end{verbatim} 
     65\end{gbar} 
     66\begin{center} 
     67\begin{pspicture}(-4,-5)(7,4) 
     68\psframe(-4,-5)(7,4) 
     69\psset{SphericalCoor=true,viewpoint=50 -40 10,Decran=50,linecolor=darkgray} 
     70\lightsource 
     71\psSolid[object=grille,action=draw, 
     72   base=-3 5 -3 5, 
     73   linecolor=red](0,0,-3) 
     74\psset{solidmemory} 
     75\psSolid[object=cylindre, 
     76   r=2,h=6, 
     77   ngrid=6 24, 
     78   plansepare={[0.707 0 0.707 0]}, 
     79   name=partiescylindre, 
     80   action=none](0,0,-3) 
     81\psSolid[object=load, 
     82   load=partiescylindre1, 
     83   fillcolor={[rgb]{0.7 1 0.7 }}, 
     84   fcol=0 (1 1 0.7 setrgbcolor)] 
     85\psSolid[object=load, 
     86   load=partiescylindre0,RotZ=90, 
     87   fillcolor={[rgb]{0.7 1 0.7 }}, 
     88   fcol=0 (1 1 0.7 setrgbcolor)](0,4,0) 
     89\psSolid[object=plan,action=draw, 
     90   definition=equation, 
     91   args={[0.707 0 0.707 0] 90}, 
     92   base=-2 2 -3 3,planmarks,showBase] 
     93\axesIIID(0,0,0)(2.5,2.5,3.5) 
     94\end{pspicture} 
     95\end{center} 
     96\subsubsection{Coupe du solide creux} 
     97Les options \Cadre{rm=0,hollow} permettent, l'une d'enlever la face de découpe \Cadre{rm=0} et l'autre, \Cadre{hollow} de voir l'intérieur. 
     98\begin{center} 
     99\begin{pspicture}(-4,-5)(7,4) 
     100\psframe(-4,-5)(7,4) 
     101\psset{SphericalCoor=true,viewpoint=50 -40 10,Decran=50,linecolor=darkgray} 
     102\lightsource 
     103\psSolid[object=grille,action=draw, 
     104   base=-3 5 -3 5, 
     105   linecolor=red](0,0,-3) 
     106\psset{solidmemory} 
     107\psSolid[object=cylindre, 
     108   r=2,h=6, 
     109   ngrid=6 24, 
     110   plansepare={[0.707 0 0.707 0.5]}, 
     111   name=partiescylindre, 
     112   action=none](0,0,-3) 
     113\psSolid[object=load, 
     114   load=partiescylindre1, 
     115   fillcolor={[rgb]{0.7 1 0.7 }}, 
     116   rm=0,hollow, 
     117   incolor={[rgb]{1 1 0.7}}] 
     118\psSolid[object=load, 
     119   load=partiescylindre0,RotZ=90, 
     120   fillcolor={[rgb]{0.7 1 0.7 }}, 
     121   rm=0,hollow, 
     122   incolor={[rgb]{1 1 0.7}}](0,4,0) 
     123\psSolid[object=plan,action=draw, 
     124   definition=equation, 
     125   args={[0.707 0 0.707 0.5] 90}, 
     126   base=-2 2 -3 3,planmarks,showBase] 
     127\composeSolid 
     128\end{pspicture} 
     129\end{center} 
     130\subsection{Tranche d'une pyramide} 
     131\subsubsection{Marquage des lignes de niveau et première découpe} 
     132Cette pyramide est créée comme un \Cadre{object=new} en donnant le liste des coordonnées des sommets et des faces. 
     133\begin{gbar} 
     134 \begin{verbatim} 
     135   sommets= 
     136      0 -2 0 %% 0 
     137      -2 0 0 %% 1 
     138      0 4 0  %% 2 
     139      4 0 0  %% 3 
     140      0 0 5, %% 4 
     141  faces={ 
     142    [3 2 1 0] 
     143    [4 0 3] 
     144    [4 3 2] 
     145    [4 2 1] 
     146  } 
     147 \end{verbatim} 
     148\end{gbar} 
     149Dans une première étape, facultative, on marque les lignes de découpe. 
     150\begin{gbar} 
     151 \begin{verbatim} 
     152   intersectiontype=0, 
     153   intersectionplan={[0 0 1 -1] 
     154                     [0 0 1 -2]}, 
     155   intersectionlinewidth=1 2, 
     156   intersectioncolor=(bleu) (rouge) 
     157 \end{verbatim} 
     158\end{gbar} 
     159Et on coupe la pointe supérieure, en dessinant aussi le plan de coupe. 
     160\begin{gbar} 
     161 \begin{verbatim} 
     162\psSolid[object=new, 
     163   sommets= 
     164      0 -2 0 %% 0 
     165      -2 0 0 %% 1 
     166      0 4 0  %% 2 
     167      4 0 0  %% 3 
     168      0 0 5, %% 4 
     169  faces={ 
     170     [3 2 1 0] 
     171     [4 0 3] 
     172     [4 3 2] 
     173     [4 2 1] 
     174     [4 1 0]}, 
     175   plansepare={[0 0 1 -2]}, 
     176   name=firstSlice, 
     177   action=none] 
     178\psSolid[object=load,action=draw*, 
     179        load=firstSlice1] 
     180\psSolid[object=plan, 
     181       definition=equation, 
     182       args={[0 0 1 -2]}, 
     183       base=-3 5 -3 5,action=draw] 
     184 \end{verbatim} 
     185\end{gbar} 
     186Pour ne pas avoir à chaque fois à réécrire sommets et faces de la pyramide, on enregistre ses données dans les fichiers : 
     187\begin{itemize} 
     188  \item Pyramid-couleurs.dat 
     189  \item Pyramid-faces.dat 
     190  \item Pyramid-sommets.dat 
     191  \item Pyramid-io.dat 
     192\end{itemize} 
     193grâce à la commande \Cadre{action=writesolid} : 
     194\begin{gbar} 
     195 \begin{verbatim} 
     196\psSolid[object=new, 
     197   sommets= 
     198      0 -2 0 %% 0 
     199      -2 0 0 %% 1 
     200      0 4 0  %% 2 
     201      4 0 0  %% 3 
     202      0 0 5, %% 4 
     203  faces={ 
     204     [3 2 1 0] 
     205     [4 0 3] 
     206     [4 3 2] 
     207     [4 2 1] 
     208     [4 1 0] 
     209},file=Pyramid,fillcolor=yellow!50, 
     210  action=writesolid] 
     211 \end{verbatim} 
     212\end{gbar} 
     213Toutes ces lignes pourront alors être supprimées et par la suite, on appellera ces données avec la commande : 
     214\begin{gbar} 
     215 \begin{verbatim} 
     216\psSolid[object=datfile, 
     217         file=Pyramid] 
     218 \end{verbatim} 
     219\end{gbar} 
     220\begin{center} 
     221\psset{unit=0.75} 
     222\begin{pspicture}(-4,-2)(4,7) 
     223\psframe(-5,-2)(5,7) 
     224\psset{SphericalCoor=true,viewpoint=50 20 10,Decran=50} 
     225\lightsource 
     226\psSolid[object=grille, 
     227   base=-3 5 -3 5, 
     228   linecolor=gray] 
     229%% create the pyramid with base area in xy-plane 
     230\psSolid[object=new, 
     231   sommets= 
     232      0 -2 0 %% 0 
     233      -2 0 0 %% 1 
     234      0 4 0  %% 2 
     235      4 0 0  %% 3 
     236      0 0 5, %% 4 
     237faces={ 
     238   [3 2 1 0] 
     239   [4 0 3] 
     240   [4 3 2] 
     241   [4 2 1] 
     242   [4 1 0] 
     243}, action=draw*, 
     244   intersectiontype=0, 
     245   intersectionplan={[0 0 1 -1] 
     246                     [0 0 1 -2]}, 
     247   intersectionlinewidth=1 2, 
     248   intersectioncolor=(bleu) (rouge)] 
     249\axesIIID[linecolor=blue](4,4,5)(5,5,6) 
     250\end{pspicture} 
     251\hfill 
     252\begin{pspicture}(-4,-2)(4,7) 
     253\psframe(-5,-2)(5,7) 
     254\psset{SphericalCoor=true,viewpoint=50 20 10,Decran=50} 
     255\lightsource 
     256\psSolid[object=grille, 
     257   base=-3 5 -3 5, 
     258   linecolor=gray] 
     259\psset{solidmemory} 
     260%% create the pyramid with base area in xy-plane 
     261\psSolid[object=new, 
     262   sommets= 
     263      0 -2 0 %% 0 
     264      -2 0 0 %% 1 
     265      0 4 0  %% 2 
     266      4 0 0  %% 3 
     267      0 0 5, %% 4 
     268faces={ 
     269   [3 2 1 0] 
     270   [4 0 3] 
     271   [4 3 2] 
     272   [4 2 1] 
     273   [4 1 0] 
     274}, 
     275   plansepare={[0 0 1 -2]}, 
     276   name=firstSlice, 
     277   action=none] 
     278\psSolid[object=load,action=draw*, 
     279        load=firstSlice1] 
     280\psSolid[object=plan, 
     281       definition=equation, 
     282       args={[0 0 1 -2]}, 
     283       base=-3 5 -3 5,action=draw] 
     284\axesIIID[linecolor=blue](4,4,2)(5,5,6) 
     285\end{pspicture} 
     286\end{center} 
     287\subsubsection{Deuxième découpe et son insertion dans la pyramide} 
     288Après avoir ôté la partie supérieure \Cadre{firstSlice0} (elle n'apparaît plus), on découpe dans la partie restante \Cadre{firstSlice1}, la base de la pyramide en gardant le haut \Cadre{secondSlice0}, puis on enregistre la tranche de pyramide restante afin de l'insérer dans la pyramide en fil de fer~: 
     289\begin{gbar} 
     290 \begin{verbatim} 
     291\psset{solidmemory} 
     292\psSolid[object=datfile, 
     293         file=Pyramid, 
     294   plansepare={[0 0 1 -2]}, 
     295   name=firstSlice, 
     296   action=none] 
     297\psSolid[object=load, 
     298        load=firstSlice1, 
     299        action=none, 
     300        plansepare={[0 0 1 -1]}, 
     301        name=secondSlice] 
     302\psSolid[object=load,action=draw*, 
     303        load=secondSlice0] 
     304\psSolid[object=load, 
     305       load=secondSlice0, 
     306       file=slicePyramid, 
     307      action=writesolid] 
     308\psSolid[object=datfile,fillcolor=yellow!50, 
     309         file=slicePyramid] 
     310 \end{verbatim} 
     311\end{gbar} 
     312 
     313\begin{center} 
     314\psset{unit=0.75} 
     315\begin{pspicture}(-4,-2)(4,7) 
     316%\psframe(-4,-2)(4,7) 
     317\psset{SphericalCoor=true,viewpoint=50 20 10,Decran=50} 
     318\lightsource 
     319\psSolid[object=grille, 
     320   base=-3 5 -3 5, 
     321   linecolor=gray] 
     322\psset{solidmemory} 
     323%% create the pyramid with base area in xy-plane 
     324%\psSolid[object=new, 
     325%   sommets= 
     326%      0 -2 0 %% 0 
     327%      -2 0 0 %% 1 
     328%      0 4 0  %% 2 
     329%      4 0 0  %% 3 
     330%      0 0 5, %% 4 
     331%  faces={ 
     332%     [3 2 1 0] 
     333%     [4 0 3] 
     334%     [4 3 2] 
     335%     [4 2 1] 
     336%     [4 1 0] 
     337%},file=Pyramid,fillcolor=yellow!50, 
     338%  action=writesolid] 
     339\psSolid[object=datfile, 
     340         file=Pyramid, 
     341   plansepare={[0 0 1 -2]}, 
     342   name=firstSlice, 
     343   action=none] 
     344\psSolid[object=plan, 
     345   definition=equation, 
     346   args={[0 0 1 -1]},action=draw, 
     347   base=-3 5 -3 5] 
     348\psSolid[object=load, 
     349        load=firstSlice1, 
     350        action=none, 
     351        plansepare={[0 0 1 -1]}, 
     352        name=secondSlice] 
     353%\psSolid[object=load,action=draw*, 
     354%        load=secondSlice0] 
     355%\psSolid[object=load, 
     356%       load=secondSlice0, 
     357%       file=slicePyramid, 
     358%      action=writesolid] 
     359\psSolid[object=datfile,fillcolor=yellow!50, 
     360         file=slicePyramid] 
     361\psSolid[object=plan, 
     362       definition=equation, 
     363       args={[0 0 1 -2]}, 
     364       base=-3 5 -3 5,action=draw] 
     365\axesIIID[linecolor=blue](0,0,2)(5,5,6) 
     366\end{pspicture} 
     367\hfill 
     368\begin{pspicture}(-4,-2)(4,7) 
     369\psset{SphericalCoor=true,viewpoint=50 20 10,Decran=50} 
     370\lightsource 
     371\psSolid[object=grille, 
     372   base=-3 5 -3 5, 
     373   linecolor=gray] 
     374\psSolid[object=datfile,fillcolor=yellow!50, 
     375         file=slicePyramid] 
     376\psSolid[object=datfile, 
     377         file=Pyramid,action=draw] 
     378\axesIIID[linecolor=blue](4,4,2)(5,5,6) 
     379\end{pspicture} 
     380\end{center} 
     381\subsection{Coupe d'un octaèdre par un plan parallèle à l'une des faces} 
     382\subsubsection{Voir l'intérieur} 
     383Rappelons que ce sont les options \Cadre{rm=0,hollow} qui permettent, l'une d'enlever la face de découpe \Cadre{rm=0} et l'autre \Cadre{hollow} de voir l'intérieur. 
     384 
     385\begin{LTXexample}[width=7.5cm] 
     386\begin{pspicture}(-3.5,-3)(4.5,5) 
     387\psset{SphericalCoor=true,viewpoint=100 5 10,Decran=80,a=4} 
     388\lightsource 
     389\pstVerb{/distance 0.4 4 mul def % 0.4*a 
     390         /n_x 45 cos 35.2644 cos mul def 
     391         /n_y 45 sin 35.2644 cos mul def 
     392         /n_z 35.2644 sin def 
     393         /xH distance n_x mul def 
     394         /yH distance n_y mul def 
     395         /zH distance n_z mul def 
     396         }% 
     397\psset{solidmemory} 
     398\psSolid[object=octahedron, 
     399         plansepare={ 
     400         [ n_x % a 
     401           n_y % b 
     402           n_z % c 
     403           distance neg % d 
     404         ]}, 
     405         name=part, 
     406         action=none] 
     407\psSolid[object=load, 
     408         rm=0, 
     409         hollow, 
     410         fillcolor={[rgb]{0.7 1 0.7}}, 
     411         incolor={[rgb]{1 1 0.7}}, 
     412        load=part1] 
     413\psPoint(xH,yH,zH){H} 
     414\psPoint(0,0,0){O}\psdot(H) 
     415\psline[linestyle=dashed](O)(H) 
     416\psSolid[object=plan, 
     417       definition=normalpoint, 
     418       args={xH yH zH [n_x n_y n_z 180]}, 
     419       base=-4 4 -4 4,action=draw,showBase] 
     420\psProjection[object=texte, 
     421 fontsize=10,pos=dc,text=H, 
     422 normal=n_x n_y n_z -30](xH,yH,zH) 
     423\axesIIID[linecolor=blue,linewidth=0.4pt](0,0,0)(4,4,4) 
     424\end{pspicture} 
     425\end{LTXexample} 
     426\subsubsection{On considère le solide comme plein} 
     427L'option \Cadre{fcol=0 (YellowOrange)} permet de colorier la face de découpe qui est la face \Cadre{0}. 
     428 
     429\begin{LTXexample}[width=7.5cm] 
     430\begin{pspicture}(-3.5,-3)(4.5,5) 
     431\psset{SphericalCoor=true,viewpoint=100 5 10,Decran=80,a=4} 
     432\lightsource 
     433\pstVerb{/distance 0.4 4 mul def % 0.4*a 
     434         /n_x 45 cos 35.2644 cos mul def 
     435         /n_y 45 sin 35.2644 cos mul def 
     436         /n_z 35.2644 sin def 
     437         /xH distance n_x mul def 
     438         /yH distance n_y mul def 
     439         /zH distance n_z mul def 
     440         }% 
     441\psset{solidmemory} 
     442\psSolid[object=octahedron, 
     443         plansepare={ 
     444         [ n_x % a 
     445           n_y % b 
     446           n_z % c 
     447           distance neg % d 
     448         ]}, 
     449         name=part, 
     450         action=none] 
     451\psSolid[object=load, 
     452         fcol=0 (YellowOrange), 
     453         fillcolor={[rgb]{0.7 1 0.7}}, 
     454        load=part1] 
     455\psPoint(xH,yH,zH){H} 
     456\psPoint(0,0,0){O}\psdot(H) 
     457\psline[linestyle=dashed](O)(H) 
     458\psSolid[object=plan, 
     459       definition=normalpoint, 
     460       args={xH yH zH [n_x n_y n_z 180]}, 
     461       base=-4 4 -4 4,action=draw,showBase] 
     462\psProjection[object=texte, 
     463 fontsize=12,pos=dc,text=H, 
     464 normal=n_x n_y n_z -30](xH,yH,zH) 
     465\axesIIID[linecolor=blue,linewidth=0.4pt](3,3,2)(5,5,5) 
     466\end{pspicture} 
     467\end{LTXexample} 
     468\subsubsection{Les deux parties du solide découpé} 
     469On rappelle que c'est le sens de la normale du plan de séparation qui détermine le numérotage des deux parties : \Cadre{0} celle qui est \textit{au-dessus} de la normale et \Cadre{1} celle qui est \textit{au-dessous}. Pour les deux parties, la face de découpe porte le numéro \Cadre{0}. 
     470S'il y a plusieurs faces de découpe, comme dans le cas du tore elles sont numérotées \Cadre{0, 1 etc.} 
     471 
     472On opère en deux étapes, mise en mémoire des deux parties du solide découpé : 
     473\begin{gbar} 
     474 \begin{verbatim} 
     475 \psset{solidmemory} 
     476\psSolid[object=octahedron, 
     477         plansepare={ 
     478         [ n_x % a 
     479           n_y % b 
     480           n_z % c 
     481           distance neg % d 
     482         ]}, 
     483         name=part, 
     484         action=none] 
     485 \end{verbatim} 
     486\end{gbar} 
     487Puis placement et traitement de chacune des parties : 
     488\begin{gbar} 
     489 \begin{verbatim} 
     490\psSolid[object=load, 
     491         fcol=0 (YellowOrange), 
     492         fillcolor={[rgb]{0.7 1 0.7}}, 
     493        load=part1] 
     494\psSolid[object=load, 
     495         fillcolor={[rgb]{0.7 1 0.7}}, 
     496        load=part0](2 xH mul,2 yH mul,2 zH mul) 
     497\composeSolid 
     498 \end{verbatim} 
     499\end{gbar} 
     500\begin{LTXexample}[width=7.5cm] 
     501\begin{pspicture}(-3.5,-3)(4.5,5) 
     502\psset{SphericalCoor=true,viewpoint=100 5 20,Decran=150,a=2} 
     503\lightsource 
     504\pstVerb{/distance 0.4 2 mul def % 0.4*a 
     505         /n_x 45 cos 35.2644 cos mul def 
     506         /n_y 45 sin 35.2644 cos mul def 
     507         /n_z 35.2644 sin def 
     508         /xH distance n_x mul def 
     509         /yH distance n_y mul def 
     510         /zH distance n_z mul def 
     511         }% 
     512\psset{solidmemory} 
     513\psSolid[object=octahedron, 
     514         plansepare={ 
     515         [ n_x % a 
     516           n_y % b 
     517           n_z % c 
     518           distance neg % d 
     519         ]}, 
     520         name=part, 
     521         action=none] 
     522\psSolid[object=load, 
     523         fcol=0 (YellowOrange), 
     524         fillcolor={[rgb]{0.7 1 0.7}}, 
     525        load=part1] 
     526\psSolid[object=load, 
     527         fillcolor={[rgb]{0.7 1 0.7}}, 
     528        load=part0](2 xH mul,2 yH mul,2 zH mul) 
     529\composeSolid 
     530\end{pspicture} 
     531\end{LTXexample} 
     532\subsection{Coupes d'un cube} 
     533\subsubsection{Marquage de la ligne de découpage} 
     534\begin{LTXexample}[width=8cm] 
     535\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=150} 
     536\begin{pspicture}(-4,-3)(4,5) 
     537\pstVerb{/distance 1.732 def 
     538         /n_x 0.57735 def 
     539         /n_y 0.57735 def 
     540         /n_z 0.57735 def 
     541         /xH distance n_x mul def 
     542         /yH distance n_y mul def 
     543         /zH distance n_z mul def 
     544         }% 
     545\psframe(-4,-3)(4,5) 
     546\psProjection[object=texte, 
     547  fontsize=10,pos=dc,text=H, 
     548  normal=n_x n_y n_z -30](xH,yH,zH) 
     549\Normale[linecolor=red](distance,45,35.2644) 
     550\psSolid[object=cube,a=2,action=draw,intersectiontype=0, 
     551   intersectionplan={ 
     552      [ n_x % a 
     553        n_y % b 
     554        n_z % c 
     555        distance neg]}, 
     556   intersectionlinewidth=2, 
     557   intersectioncolor=(rouge)](1,1,1) 
     558\psPoint(xH,yH,zH){H} 
     559\psPoint(0,0,0){O} 
     560\psline[linestyle=dashed](O)(H) 
     561\psdot(H) 
     562\axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5) 
     563\end{pspicture} 
     564\end{LTXexample} 
     565\subsubsection{Représentation du cube découpé avec une face de découpe hexagonale} 
     566\begin{LTXexample}[width=8cm] 
     567\begin{pspicture}(-4,-3)(4,5) 
     568\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=170} 
     569\lightsource 
     570\pstVerb{/distance 1.732 def 
     571         /n_x 0.57735 def 
     572         /n_y 0.57735 def 
     573         /n_z 0.57735 def 
     574         /xH distance n_x mul def 
     575         /yH distance n_y mul def 
     576         /zH distance n_z mul def 
     577         }% 
     578\psframe(-4,-3)(4,5) 
     579\psset{solidmemory} 
     580% placement du cube dans le trièdre Oxyz 
     581\psSolid[object=cube,a=2, 
     582         plansepare={ 
     583         [ n_x % a 
     584           n_y % b 
     585           n_z % c 
     586           distance neg % d 
     587         ]}, 
     588         name=parts_cube, 
     589         action=none](a 2 div,a 2 div,a 2 div) 
     590\psSolid[object=load, 
     591         load=parts_cube1, 
     592         action=writesolid, 
     593         file=cubeHexagone] 
     594\psSolid[object=datfile, 
     595         fcol=0 (Dandelion), 
     596         fillcolor={[rgb]{0.7 1 0.7}}, 
     597         file=cubeHexagone] 
     598\Normale[linecolor=red](distance,45,35.2644) 
     599\psSolid[object=cube,a=2,action=draw](1,1,1) 
     600\psProjection[object=texte, 
     601  fontsize=10,pos=dc,text=H, 
     602  normal=n_x n_y n_z -30](xH,yH,zH) 
     603\axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5) 
     604\end{pspicture} 
     605\end{LTXexample} 
     606\subsubsection{Cube découpé dans des différentes positions} 
     607Où on utilise l'option permettant de mémoriser un solide pour, après diverses transformations, faire reposer le cube tronqué sur sa face de découpe. 
     608\begin{gbar} 
     609 \begin{verbatim} 
     610\psset{solidmemory} 
     611\psSolid[object=datfile, 
     612         fcol=0 (Dandelion), 
     613         fillcolor={[rgb]{0.7 1 0.7}}, 
     614         name=C1, 
     615         action=none, 
     616         file=cubeHexagone] 
     617 \end{verbatim} 
     618\end{gbar} 
     619 
     620\begin{pspicture}(-3,-3)(3,3) 
     621\psframe(-3,-2)(3,3) 
     622\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=100} 
     623\lightsource 
     624\psSolid[object=grille, 
     625   base=-2 3 -2 3, 
     626   linecolor=gray] 
     627\psSolid[object=datfile, 
     628         fcol=0 (Dandelion), 
     629         fillcolor={[rgb]{0.7 1 0.7}}, 
     630         file=cubeHexagone] 
     631\axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5) 
     632\end{pspicture} 
     633\begin{pspicture}(-2,-3)(4,3) 
     634\psframe(-2,-2)(4,3) 
     635\psset{SphericalCoor=true,viewpoint=100 -30 20,Decran=100} 
     636\lightsource 
     637\psSolid[object=grille, 
     638   base=-2 3 -2 3, 
     639   linecolor=gray] 
     640\psSolid[object=datfile, 
     641         fcol=0 (Dandelion), 
     642         fillcolor={[rgb]{0.7 1 0.7}}, 
     643         file=cubeHexagone] 
     644\axesIIID[linecolor=blue](2,2,2)(2.5,2.5,2.5) 
     645\end{pspicture} 
     646 
     647\begin{pspicture}(-3,-2)(3,3) 
     648\psframe(-3,-2)(3,3) 
     649\psset{SphericalCoor=true,viewpoint=100 225 20,Decran=100} 
     650\lightsource 
     651\psSolid[object=grille, 
     652   base=-2 3 -2 3, 
     653   linecolor=gray] 
     654\psSolid[object=datfile, 
     655         fcol=0 (Dandelion), 
     656         fillcolor={[rgb]{0.7 1 0.7}}, 
     657         file=cubeHexagone] 
     658\axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5) 
     659\end{pspicture} 
     660\begin{pspicture}(-3,-2)(3,3) 
     661\psframe(-3,-2)(3,3) 
     662\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=100} 
     663\lightsource 
     664\psSolid[object=grille, 
     665   base=-2 3 -2 3, 
     666   linecolor=gray] 
     667\psset{solidmemory} 
     668\psSolid[object=datfile, 
     669         fcol=0 (Dandelion), 
     670         fillcolor={[rgb]{0.7 1 0.7}}, 
     671         name=C1, 
     672         action=none, 
     673         file=cubeHexagone] 
     674\codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform 
     675drawsolid** 
     676
     677\axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5) 
     678\end{pspicture} 
     679 
     680\begin{pspicture}(-3,-2)(3,4) 
     681\psframe(-3,-2)(3,3) 
     682\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=100} 
     683\lightsource 
     684\psSolid[object=grille, 
     685   base=-2 3 -2 3, 
     686   linecolor=gray] 
     687\psset{solidmemory} 
     688\psSolid[object=datfile, 
     689         fcol=0 (Dandelion), 
     690         fillcolor={[rgb]{0.7 1 0.7}}, 
     691         name=C1, 
     692         action=none, 
     693         file=cubeHexagone] 
     694\codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform 
     695            {0 0 45 rotateOpoint3d} solidtransform 
     696drawsolid** 
     697
     698%\composeSolid 
     699\axesIIID[linecolor=blue](0,0,0)(2.5,2.5,2.5) 
     700\end{pspicture} 
     701\begin{pspicture}(-3,-2)(3,4) 
     702\psframe(-3,-2)(3,3) 
     703\psset{SphericalCoor=true,viewpoint=100 30 20,Decran=100} 
     704\lightsource 
     705\psSolid[object=grille, 
     706   base=-2 3 -2 3, 
     707   linecolor=gray] 
     708\psset{solidmemory} 
     709\psSolid[object=datfile, 
     710         fcol=0 (Dandelion), 
     711         fillcolor={[rgb]{0.7 1 0.7}}, 
     712         name=C1, 
     713         action=none, 
     714         file=cubeHexagone] 
     715\codejps{C1 {-1.5 -1.5 0 translatepoint3d} solidtransform 
     716            {0 0 45 rotateOpoint3d} solidtransform 
     717            {-35.2644 -90 add 0 0 rotateOpoint3d} solidtransform 
     718drawsolid* 
     719
     720\axesIIID[linecolor=blue](1,2.5,0.5)(2.5,3,2.5) 
     721\end{pspicture} 
     722\subsection{Sections multiples} 
     723\subsubsection{Coupes dans une sphère avec \texttt{PStricks}} 
     724\begin{LTXexample}[width=8cm] 
     725\psset{SphericalCoor=true,viewpoint=100 20 20,Decran=75} 
     726\lightsource 
     727\pstVerb{/coeff 0.75 def /rO 4 def /OH coeff rO mul neg def}% 
     728\psset{solidmemory} 
     729\begin{pspicture}(-4,-4)(4,4) 
     730\psframe(-4,-4)(4,4) 
     731\psSolid[object=sphere, 
     732   r=rO, 
     733   ngrid=9 18, 
     734   plansepare={[1 0 0 OH]}, 
     735   name=part, 
     736   action=none] 
     737\psSolid[object=load, 
     738   load=part1,plansepare={[-1 0 0 OH]},action=none,name=part] 
     739\psSolid[object=load, 
     740   load=part1,plansepare={[0 1 0 OH]},action=none,name=part] 
     741\psSolid[object=load, 
     742   load=part1,plansepare={[0 -1 0 OH]},action=none,name=part] 
     743\psSolid[object=load, 
     744   load=part1,plansepare={[0 0 1 OH]},action=none,name=part] 
     745\psSolid[object=load, 
     746   load=part1,plansepare={[0 0 -1 OH]},action=none,name=part] 
     747\psSolid[object=load,hue=.1 .8 0.5 1, 
     748   load=part1](0,0,0) 
     749\composeSolid 
     750\end{pspicture} 
     751\end{LTXexample} 
     752\subsubsection{Sections multiples d'un parallélépipède} 
     753Les sections multiples gagneront à être exécutées dans une boucle \texttt{postscript}, dans \Cadre{\textbackslash codejps}, c'est plus simple et plus rapide ! 
     754 
     755Dans cet exemple, le solide de départ est un parallélépipède. Troncatures des sommets et chanfreinages des arêtes sont réalisées avec des plans de coupe successifs, d'abord les sommets puis les arêtes. 
     756 
     757\begin{LTXexample}[width=7cm] 
     758\begin{pspicture}(-3.5,-4)(3.5,4) 
     759\psset{SphericalCoor=true,viewpoint=100 -20 10,Decran=100} 
     760\lightsource 
     761\psframe(-3.5,-4)(3.5,4) 
     762\codejps{ 
     7634 4 6 newparallelepiped 
     76445 90 360 { 
     765/iAngle exch def 
     766  /n_x iAngle cos 35.2644 cos mul def 
     767  /n_y iAngle sin 35.2644 cos mul def 
     768  /n_z 35.2644 sin def 
     769  /distance 2 3 add 3 sqrt div neg def 
     770[ n_x n_y n_z distance] 
     771solidplansepare 
     772} for 
     77345 90 360 { 
     774/iAngle exch def 
     775  /n_x iAngle cos 35.2644 cos mul def 
     776  /n_y iAngle sin 35.2644 cos mul def 
     777  /n_z 35.2644 sin neg def 
     778  /distance 2 3 add 3 sqrt div neg def 
     779[ n_x n_y n_z distance] 
     780solidplansepare 
     781} for 
     78245 90 360 { 
     783/iAngle exch def 
     784% plan : ax+by+cz-d=0 
     785[ iAngle cos % a 
     786  iAngle sin % b 
     787  0 % c 
     788  -2.5 % -d 
     789] solidplansepare 
     790} for 
     791dup [.5 .2] solidputhuecolors 
     792solidlightOn 
     793drawsolid*} 
     794\end{pspicture} 
     795\end{LTXexample} 
     796\subsection{Sections d'un tore} 
     797%\begin{pspicture}(-6,-4)(6,4) 
     798%\psSolid[r1=3,r0=1.5, 
     799%         object=tore, 
     800%%         ngrid=18 60, 
     801%         file=tore1860,action=writesolid] 
     802%\end{pspicture} 
     803 
     804\begin{center} 
     805\begin{pspicture}(-6,-4)(6,4) 
     806\pstVerb{/Ampl 3 2 sqrt mul def}% 
     807\defFunction[algebraic]{lemniscate}(t){1.5}{Ampl*sin(t)/(1+cos(t)*cos(t))}{Ampl*sin(t)*cos(t)/(1+cos(t)*cos(t))} 
     808\psset{SphericalCoor=true,viewpoint=50 -10 30,Decran=50} 
     809\lightsource 
     810\psframe[fillstyle=solid,fillcolor=gray!50](-6,-4)(6,4) 
     811%\psset{solidmemory} 
     812%\psSolid[object=datfile,file=tore1860, 
     813%         plansepare={[1 0 0 -1.5]}, 
     814%         name=lemniscate, 
     815%         action=none](0,0,0) 
     816%\psSolid[object=load, 
     817%        load=lemniscate1, 
     818%       file=tore1860lemniscate,action=writesolid](0,0,0) 
     819\psSolid[object=datfile,file=tore1860lemniscate, 
     820        fcol=0 (0.5 0.72 0.5 setrgbcolor) 
     821             1 (0.5 0.72 0.5 setrgbcolor), 
     822        fillcolor=green!30, 
     823        intersectiontype=0, 
     824        intersectionplan={ 
     825        [1 0 0 -1.5]}, 
     826        intersectioncolor=(rouge), 
     827        intersectionlinewidth=2.2] 
     828\psSolid[object=courbe,r=0,linewidth=2pt, 
     829        range=0 6.28, 
     830        linecolor=red, 
     831        function=lemniscate]% 
     832\psSolid[object=plan,action=draw, 
     833   definition=equation, 
     834   args={[1 0 0 -1.5] 90}, 
     835   base=-5 5 -2 2,planmarks,showBase] 
     836%\composeSolid 
     837\end{pspicture} 
     838\end{center} 
     839\begin{center} 
     840\begin{pspicture}(-6,-4)(6,4) 
     841\pstVerb{/Ampl 3 2 sqrt mul def}% 
     842\defFunction[algebraic]{lemniscate}(t){1.5}{Ampl*sin(t)/(1+cos(t)*cos(t))}{Ampl*sin(t)*cos(t)/(1+cos(t)*cos(t))} 
     843\psset{SphericalCoor=true,viewpoint=50 -10 30,Decran=50} 
     844\lightsource 
     845\psframe[fillstyle=solid,fillcolor=gray!50](-6,-4)(6,4) 
     846\psSolid[object=datfile,file=tore1860lemniscate, 
     847        hollow, 
     848        rm=0 1, 
     849        fillcolor=green!30,incolor=yellow!50] 
     850\psSolid[object=courbe,r=0,linewidth=2pt, 
     851        range=0 6.28, 
     852        linecolor=red, 
     853        function=lemniscate]% 
     854\psSolid[object=plan,action=draw, 
     855   definition=equation, 
     856   args={[1 0 0 -1.5] 90}, 
     857   base=-5 5 -2 2,planmarks,showBase] 
     858\end{pspicture} 
     859\end{center} 
     860\subsection{Autres exemples} 
     861\begin{enumerate} 
     862\item Vous trouverez une version codée de ce document en \Cadre{jps} dans la commande \Cadre{\textbackslash codejps} dans le document suivant : 
     863 
     864\centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections}} 
     865\item Une étude des sections coniques sur : 
     866 
     867\centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/sections-cone}} 
     868\item Une étude des sections cylindriques sur : 
     869 
     870\centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/section-cylindre}} 
     871\item Une étude sur les sections du tore : 
     872 
     873\centerline{\url{http://melusine.eu.org/syracuse/mluque/solides3d2007/sections/section-tore}} 
     874\end{enumerate} 
     875\subsection{La commande \textbackslash lightsource} 
     876La macro \Cadre{lightsource} permet de placer la source de lumière au même endroit que le point de vue lorsque les coordonnées sphériques 
     877sont activées : \Cadre{SphericalCoor=true}. 
     878\begin{gbar} 
     879 \begin{verbatim} 
     880\def\lightsource{ 
     881\pstVerb{\pst@solides@viewpoint 
     882/PhI exch def /ThetA exch def /Dist exch def 
     883/Lx Dist ThetA cos mul PhI cos mul def 
     884/Ly Dist ThetA sin mul PhI cos mul def 
     885/Lz Dist PhI sin mul def}% 
     886\psset{lightsrc=Lx Ly Lz} 
     887
     888 \end{verbatim} 
     889\end{gbar} 
     890Elle doit se placer après les coordonnées du point de vue. 
     891\begin{gbar} 
     892 \begin{verbatim} 
     893\psset{SphericalCoor=true,viewpoint=50 -20 10,Decran=50} 
     894\lightsource 
     895 \end{verbatim} 
     896\end{gbar} 
     897 
     898 
  • trunk/doc/par-vecteur.tex

    r45 r47  
    66plus simple, on utilise l'argument \Cadre{[args=$x$ $y$ $z$]} pour 
    77en spécifier les coordonnées. 
    8  
     8Si on a précédemment nommé $u$ un point 
     9$(x, y, z)$ (voir chapitre \textsl{Utilisation avancée\/}), on peut 
     10utiliser l'argument \Cadre{[args=$u$]}. 
    911\begin{multicols}{2} 
    1012 
     
    99101\item \Cadre {[definition=normalize3d]} ;  
    100102\verb+args=+ $\vec u$. 
    101 Renvoie le vecteur $\Vert \vec u\Vert ^{-1} \vec u$. 
     103Renvoie le vecteur $\Vert \vec u\Vert ^{-1} \vec u$ si $\vec u$ est 
     104non nul, $\vec 0$ sinon. 
    102105 
    103106\end{itemize} 
  • trunk/doc/pst-solides3d-doc.tex

    r45 r47  
    1313\usepackage{multicol} 
    1414\usepackage{longtable} 
     15\usepackage{framed} 
    1516\usepackage{array} 
    1617\usepackage{arrayjob} 
     
    9394  \pst@number\psyunit div /#1.y ED 
    9495  \pst@number\psxunit div /#1.x ED } 
     96\def\lightsource{ 
     97\pstVerb{\pst@solides@viewpoint 
     98/PhI exch def /ThetA exch def /Dist exch def 
     99/Lx Dist ThetA cos mul PhI cos mul def 
     100/Ly Dist ThetA sin mul PhI cos mul def 
     101/Lz Dist PhI sin mul def}% 
     102\psset{lightsrc=Lx Ly Lz} 
     103} 
    95104\makeatother 
     105%% Jean-Michel Sarlat et Guillaume Connan 
     106\newenvironment{gbar}{% 
     107  \def\FrameCommand{{\color{red}\vrule width 2pt}\colorbox{yellow!30}}% 
     108  \MakeFramed {\advance\hsize-\width \FrameRestore}}% 
     109{\endMakeFramed} 
    96110%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 
    97111\newcommand\Cadre[1]{\psframebox[fillstyle=solid,fillcolor=yellow,linecolor={[cmyk]{0,0,1,0.1}}]{\texttt{#1}}} 
     
    187201%% \input \datapath par-affinage 
    188202%\input \datapath par-courbeR3 
    189 %\input \datapath par-vecteur 
     203%\input \datapath par-section 
    190204%\input \datapath par-plan 
    191205%\input \datapath par-surfaces 
  • trunk/pst-solides3d.tex

    r46 r47  
    2020\ifx\MultidoLoaded\endinput\else\input multido.tex \fi 
    2121% JPV & ML & AS 
    22 \def\fileversion{3.22
    23 \def\filedate{2008/06/15
     22\def\fileversion{3.23
     23\def\filedate{2008/06/17
    2424\message{`PSTSOLIDESIIID' v\fileversion, \filedate} 
    2525% 
     
    667667\ifPst@SphericalCoor 
    668668    viewpointXYZ /PHI ED /THETA ED /Dobs ED 
    669 %    CoefficientsMT 
    670 %% pour la 3D conventionnelle 
    671 %% Dony : graphisme scientifique : page 187 
    672 %% Editeur : Masson 
    673 /XpointVue {Dobs Cos1Cos2 mul} bind def 
    674 /YpointVue {Dobs Sin1Cos2 mul} bind def 
    675 /ZpointVue {Dobs Sin2 mul} bind def 
    676     \else 
     669    %    CoefficientsMT 
     670    %% pour la 3D conventionnelle 
     671    %% Dony : graphisme scientifique : page 187 
     672    %% Editeur : Masson 
     673    /XpointVue {Dobs Cos1Cos2 mul} bind def 
     674    /YpointVue {Dobs Sin1Cos2 mul} bind def 
     675    /ZpointVue {Dobs Sin2 mul} bind def 
     676    XpointVue YpointVue ZpointVue /viewpoint defpoint3d 
     677\else 
    677678    viewpointXYZ /ZpointVue ED /YpointVue ED /XpointVue ED 
    678679    /THETA {YpointVue XpointVue atan} bind def 
     
    680681    /Dobs  {XpointVue dup mul YpointVue dup mul add ZpointVue dup mul add sqrt} bind def 
    681682%    CoefficientsMT 
     683    XpointVue YpointVue ZpointVue /viewpoint defpoint3d 
    682684\fi 
    683685>%