%% COPYRIGHT 2008 by Manuel Luque, Arnaud Schmittbuhl, 
%% Jean-Paul Vignault, Herbert Voss.
%% This program can be redistributed and/or modified under the terms
%% of the LaTeX Project Public License Distributed from CTAN
%% archives in directory macros/latex/base/lppl.txt.
%% etex detection by looking for the \ifcsname macro
\expandafter\ifx\csname ifcsname\endcsname\relax
 \newlinechar`\^^J
 \message{^^J*****************************************}
 \message{etex is needed to work with pst-solides3d}
 \message{*****************************************}
 \catcode`\ =11\relax
 \Compile With etex Please
\fi
\csname PSTSOLIDESIIIDLoaded\endcsname
\let\PSTSOLIDESIIIDLoaded\endinput
% Requires PSTricks, pst-xkey and pst-node packages
\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
\ifx\PSTnodesLoaded\endinput\else\input pst-node \fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi
\ifx\MultidoLoaded\endinput\else\input multido.tex \fi 
% JPV & ML & AS & HV
\def\fileversion{4.11}
\def\filedate{2008/10/29}
\message{`PSTSOLIDESIIID' v\fileversion, \filedate}
%
\pstheader{solides.pro}

\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\pst@addfams{pst-solides3d}
\SpecialCoor
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Definition des differentes variables pour PSTricks
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%%%%%%%%%%%%%%%%% variables numeriques %%%%%%%%%%%%%%%%%
%
% point de vue et rotations de l'objet
% distance de l'ecran a l'observateur
%
\define@key[psset]{pst-solides3d}{viewpoint}{\def\pst@solides@viewpoint{#1}}% position de l'observateur
\psset[pst-solides3d]{viewpoint=10 10 10}% coordonnees cartesiennes
\define@key[psset]{pst-solides3d}{Decran}{\def\pst@solides@Decran{#1}}% distance de l'ecran
\define@key[psset]{pst-solides3d}{RotX}{\def\psk@solides@RotX{#1}}% rotation autour de Ox en degres
\define@key[psset]{pst-solides3d}{RotY}{\def\psk@solides@RotY{#1}}% rotation autour de Oy en degres
\define@key[psset]{pst-solides3d}{RotZ}{\def\psk@solides@RotZ{#1}}% rotation autour de Oz en degres
\psset[pst-solides3d]{RotZ=0,RotX=0,RotY=0,Decran=50}% valeurs par defaut
% parametres propres a chaque objet
\define@key[psset]{pst-solides3d}{resolution}{\def\pst@solides@resolution{#1}} % nb points par courbe
\define@key[psset]{pst-solides3d}{no}{\def\pst@solides@no{#1}} % numero face du solide
\define@key[psset]{pst-solides3d}{phi}{\def\pst@solides@phi{#1}} % angle calotte sphere
\define@key[psset]{pst-solides3d}{theta}{\def\pst@solides@theta{#1}} % angle calotte sphere
\define@key[psset]{pst-solides3d}{r0}{\def\pst@solides@rO{#1}} % rayon interieur tore
\define@key[psset]{pst-solides3d}{r1}{\def\pst@solides@rI{#1}} % rayon moyen tore
\define@key[psset]{pst-solides3d}{R}{\def\pst@solides@R{#1}} % rayon moyen tore
\define@key[psset]{pst-solides3d}{r}{\def\pst@solides@r{#1}} % rayon de la sphere circonscrite
\define@key[psset]{pst-solides3d}{a}{\def\pst@solides@a{#1}} % arete du cube (1 du parallelepipede)
\define@key[psset]{pst-solides3d}{b}{\def\pst@solides@b{#1}} % arete 2 du parallelepipede
\define@key[psset]{pst-solides3d}{c}{\def\pst@solides@c{#1}} % arete 3 du parallelepipede
\define@key[psset]{pst-solides3d}{h}{\def\pst@solides@h{#1}} % hauteur du cylindre, du cone, du prisme
\define@key[psset]{pst-solides3d}{chanfreincoeff}{\def\pst@solides@chanfreincoeff{#1}} % coeff de chanfreinage
\define@key[psset]{pst-solides3d}{trunccoeff}{\def\pst@solides@trunccoeff{#1}} % coeff de troncature
\define@key[psset]{pst-solides3d}{affinagecoeff}{\def\pst@solides@affinagecoeff{#1}} % coeff de affinage
\define@key[psset]{pst-solides3d}{dualregcoeff}{\def\pst@solides@dualregcoeff{#1}} % coeff de dual
\define@key[psset]{pst-solides3d}{intersectiontype}{\def\pst@solides@intersectiontype{#1}} %
%
%% les affectations par defaut
\psset[pst-solides3d]{R=4,r1=4,r0=1.5,r=2,no=0,a=4,b=a,c=a,h=6,phi=0,theta=90,resolution=36,%
trunccoeff=.25,chanfreincoeff=.8,affinagecoeff=.8,dualregcoeff=1,intersectiontype=-1}
%
%%%%%%%%%%%%%%%%% variables complexes %%%%%%%%%%%%%%%%%
%
\define@key[psset]{pst-solides3d}{base}{\def\pst@solides@base{#1}} % base du prisme
\psset[pst-solides3d]{base=-1 -1 1 -1 0 1}% coordonnees d'un triangle, base triangulaire par defaut
\define@key[psset]{pst-solides3d}{axe}{\def\pst@solides@axe{#1}} % axe du prisme
\psset[pst-solides3d]{axe=0 0 1}% vecteur definissant la direction de l'axe du prisme
\define@key[psset]{pst-solides3d}{plansection}{\def\pst@solides@plansection{#1}} % le plan de section
\psset[pst-solides3d]{plansection=}% pas de section par defaut
\define@key[psset]{pst-solides3d}{plansepare}{\def\pst@solides@plansepare{#1}} % le plan de separation
\psset[pst-solides3d]{plansepare=}% pas de separation par defaut
\define@key[psset]{pst-solides3d}{intersectionlinewidth}{\def\pst@solides@intersectionlinewidth{#1}}%
\psset[pst-solides3d]{intersectionlinewidth=1}%
\define@key[psset]{pst-solides3d}{intersectioncolor}{\def\pst@solides@intersectioncolor{#1}}%
\psset[pst-solides3d]{intersectioncolor=(rouge)}%
\define@key[psset]{pst-solides3d}{intersectionplan}{\def\pst@solides@intersectionplan{#1}}%
\psset[pst-solides3d]{intersectionplan=[0 0 1 0]}%
\define@key[psset]{pst-solides3d}{definition}{\def\pst@solides@definition{#1}} %
\psset[pst-solides3d]{definition=}%
\define@key[psset]{pst-solides3d}{args}{\def\pst@solides@args{#1}} %
\psset[pst-solides3d]{args=}%
\define@key[psset]{pst-solides3d}{transform}{\def\pst@solides@transform{#1}} %
\psset[pst-solides3d]{transform=}%

\def\Section{%
         R h 2 div neg % sommet 1
         R h 2 div % sommet 2
         r h 2 div % sommet 3
         r h 2 div neg % sommet 4
            }
\define@key[psset]{pst-solides3d}{section}{\def\pst@solides@section{#1}} % section de l'objet de revolution
\psset[pst-solides3d]{section=\Section}% coordonnees des sommets de la section

%% decalage pourle prisme
\define@key[psset]{pst-solides3d}{decal}{\def\pst@solides@decal{#1}}
\psset[pst-solides3d]{decal=-2}% decalage par defaut

% teinte des faces exterieures de l'objet a partir de PSTricks
% donnee par filcollor
% teinte des faces interieures de l'objet a partir de PSTricks
\define@key[psset]{pst-solides3d}{incolor}{\pst@getcolor{#1}\psincolor}
\psset[pst-solides3d]{incolor=green}
%
%% couleurs definies par l'utilisateur
\define@key[psset]{pst-solides3d}{color1}{\pst@getcolor{#1}\pscolora}
\psset[pst-solides3d]{color1=cyan}
%
\define@key[psset]{pst-solides3d}{color2}{\pst@getcolor{#1}\pscolorb}
\psset[pst-solides3d]{color2=magenta}
%
\define@key[psset]{pst-solides3d}{color3}{\pst@getcolor{#1}\pscolorc}
\psset[pst-solides3d]{color3=blue}
%
\define@key[psset]{pst-solides3d}{color4}{\pst@getcolor{#1}\pscolord}
\psset[pst-solides3d]{color4=red}
%
% resolution du trace
\newcount\test@mode
\define@key[psset]{pst-solides3d}{mode}{% resolution : mode=0,1,2, 3,4 ou 5
  \test@mode=#1\relax%
  \ifnum\test@mode>4%
    \typeout{mode must be 0,1,2,3 or 4 and not `\the\test@mode'. Value 4 forced.}\test@mode=4%
  \fi%
\edef\pst@solides@mode{\the\test@mode}}%
\psset[pst-solides3d]{mode=2}%
%
%%%%%%%%%%%%%%%%% variables booleennes %%%%%%%%%%%%%%%%%
%
%\define@boolkey[psset]{pst-solides3d}[Pst@]{SphericalCoor}[true]{%
%  \ifPst@SphericalCoor
%  \def\pst@solides@viewpoint{ 17.320509 45 35.264389 }%
%  \fi}
%\psset{SphericalCoor=false} 
%
\define@boolkey[psset]{pst-solides3d}[Pst@]{isolatin}[false]{}
\psset{isolatin=true}
\define@boolkey[psset]{pst-solides3d}[Pst@]{affinagerm}[false]{}
\psset{affinagerm=true}
\define@boolkey[psset]{pst-solides3d}[Pst@]{chanfrein}[true]{}
\psset{chanfrein=false}
\define@boolkey[psset]{pst-solides3d}[Pst@]{grid}[false]{}
\psset{grid=true}
\define@boolkey[psset]{pst-solides3d}[Pst@]{dualreg}[true]{}
\psset{dualreg=false}
\define@boolkey[psset]{pst-solides3d}[Pst@]{geode}[true]{}
\psset{geode=false}
\define@boolkey[psset]{pst-solides3d}[Pst@]{hollow}[true]{}
\psset{hollow=false}
\define@boolkey[psset]{pst-solides3d}[Pst@]{biface}[true]{}
\psset{biface=true}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{axesboxed}[true]{}
\psset{axesboxed=false}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{planmarks}[true]{}
\psset{planmarks=false}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{plangrid}[true]{}
\psset{plangrid=false}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{showbase}[true]{}
\psset{showbase=false}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{showBase}[true]{}
\psset{showBase=false}%
\define@boolkey[psset]{pst-solides3d}[Pst@]{deactivatecolor}[true]{}
\psset{deactivatecolor=false}%

%% faces a enlever
\define@key[psset]{pst-solides3d}{rm}{\def\pst@solides@CoordinatesRm{#1}}
\psset[pst-solides3d]{rm=}% pas de faces par defaut
%% nom de la variable de sauvegarde du solide considere
\define@key[psset]{pst-solides3d}{name}{\def\pst@solides@name{#1}}
\psset[pst-solides3d]{name=}% pas de nom par defaut
%% nom de la variable de sauvegarde du solide sur lequel on doit projeter
\define@key[psset]{pst-solides3d}{solidname}{\def\pst@solides@solidname{#1}}
\psset[pst-solides3d]{solidname=}% pas de nom par defaut
%% nom du fichier externe
\define@key[psset]{pst-solides3d}{file}{\def\pst@solides@file{#1}}
\psset[pst-solides3d]{file=}% pas de fichier par defaut
%% nom de l'objet de type plan
\define@key[psset]{pst-solides3d}{planname}{\def\pst@solides@planname{#1}}
\psset[pst-solides3d]{planname=}% pas de nom par defaut
%% nom de l'objet a charger (load)
\define@key[psset]{pst-solides3d}{load}{\def\pst@solides@load{#1}}
\psset[pst-solides3d]{load=}% pas de load par defaut
%% couleur face pour affinage
\define@key[psset]{pst-solides3d}{fcolor}{\def\pst@solides@fcolor{#1}}
\psset[pst-solides3d]{fcolor=}% pas de couleur par defaut
%% couleurs de faces isolees
\define@key[psset]{pst-solides3d}{fcol}{\def\pst@solides@fcol{#1}}
\psset[pst-solides3d]{fcol=}% pas de faces par defaut
%% les degrades ``hue''
\define@key[psset]{pst-solides3d}{hue}{\def\pst@solides@hue{#1}}
\psset[pst-solides3d]{hue=}% pas de degrade externe par defaut
\define@key[psset]{pst-solides3d}{inhue}{\def\pst@solides@inhue{#1}}
\psset[pst-solides3d]{inhue=}% pas de degrade interne par defaut
\define@key[psset]{pst-solides3d}{inouthue}{\def\pst@solides@inouthue{#1}}
\psset[pst-solides3d]{inouthue=}% pas de degrade total par defaut
%% definition des faces et des sommets d'un nouveau solide
\define@key[psset]{pst-solides3d}{sommets}{\def\pst@solides@sommets{#1}}
\psset[pst-solides3d]{sommets=}% pas de sommet par defaut
%% \define@key[psset]{pst-solides3d}{faces}{\def\pst@solides@faces{#1}}
%% \psset[pst-solides3d]{faces=}% pas de face par defaut
\define@key[psset]{pst-solides3d}{faces}{\def\pst@solides@faces{#1}}
\psset[pst-solides3d]{faces={}}% valeurs par defaut
%% numerotation des faces
\define@key[psset]{pst-solides3d}{numfaces}{\def\pst@solides@numfaces{#1}}
\psset[pst-solides3d]{numfaces=}% pas de numerotation par defaut
%% troncature des sommets
\define@key[psset]{pst-solides3d}{trunc}{\def\pst@solides@trunc{#1}}
\psset[pst-solides3d]{trunc=}% pas de troncature par defaut
%% affinage des faces
\define@key[psset]{pst-solides3d}{affinage}{\def\pst@solides@affinage{#1}}
\psset[pst-solides3d]{affinage=}% pas de affinage par defaut
%% numerotation des sommets
\define@key[psset]{pst-solides3d}{num}{\def\pst@solides@num{#1}}
\psset[pst-solides3d]{num=}% pas de numerotation defaut
%% pointage des sommets
\define@key[psset]{pst-solides3d}{show}{\def\pst@solides@show{#1}}
\psset[pst-solides3d]{show=}% pas de pointage par defaut
%% maillage de l'utilisateur
\define@key[psset]{pst-solides3d}{ngrid}{\def\pst@solides@ngrid{#1}}
\psset[pst-solides3d]{ngrid=}% pas de faces par defaut

% source de la lumiere :
\define@key[psset]{pst-solides3d}{lightsrc}{\def\pst@solides@CoordinatesLight{#1}}
\psset[pst-solides3d]{lightsrc=}% pas de coordonnees par defaut
% intensite de la lumiere
\define@key[psset]{pst-solides3d}{lightintensity}{\def\pst@solides@lightintensity{#1}}
\psset[pst-solides3d]{lightintensity=2}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Code \@for (Stolen from LaTeX file: latex.ltx)
%% thanks to Herbert Voss
\expandafter\ifx\csname @latexerr\endcsname\relax%	do we have LaTeX?
  \immediate\write17{We are running tex and have to define some LaTeX commands ...}
  \def\@fornoop#1\@@#2#3{}
  \long\def\@for#1:=#2\do#3{%
    \expandafter\def\expandafter\@fortmp\expandafter{#2}%
    \ifx\@fortmp\@empty \else
      \expandafter\@forloop#2,\@nil,\@nil\@@#1{#3}\fi}
  \long\def\@forloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
      #5\def#4{#2}\ifx #4\@nnil \else#5\@iforloop #3\@@#4{#5}\fi\fi}
  \long\def\@iforloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil
    \expandafter\@fornoop \else
      #4\relax\expandafter\@iforloop\fi#2\@@#3{#4}}%
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Reservation des noms de macros
% #1=type de reservation (action, object...) associee a une liste qui
% doit forcement etre du type pst@solides@list@#1
\def\pst@solides@reservednames#1{%
\edef\@tempa{\csname pst@solides@list@#1\endcsname}
\@for \name:=\@tempa\do{%
  \expandafter\def\csname pst@solides@#1@\name\endcsname{}%
}}
% type de dessin
\def\pst@solides@list@action{none,draw,draw*,draw**,writeobj,writesolid,writeoff}
%% Reservation de macros correspondants aux actions
\pst@solides@reservednames{action}
\define@key[psset]{pst-solides3d}{action}{%
  \ifcsname pst@solides@action@#1\endcsname
    \def\pst@solides@action{#1}%
  \else
    \@pstrickserr{This action is not authorized, the procedure draw** is
    chosen by default}{}%
  \fi}
% type par defaut = faces vues remplies
\psset[pst-solides3d]{action=draw**}%
%
% choix de la police et de la taille des caracteres en cm !!
\define@key[psset]{pst-solides3d}{PSfont}{\def\pst@solides@PSfont{/#1 }}
\define@key[psset]{pst-solides3d}{fontsize}{\def\pst@solides@fontsize{#1 }}
\psset[pst-solides3d]{PSfont=Times-Roman,fontsize=10}

% nature de l'objet
\def\pst@solides@list@object{%
tore,cube,tetrahedron,octahedron,icosahedron,dodecahedron,sphere,%
cylindre,cylindrecreux,cone,conecreux,tronccone,troncconecreux,%
grille,prisme,anneau,parallelepiped,prismecreux,ruban,calottesphere,face,%
Surface,surface,calottespherecreuse,polygoneregulier,fusion,new,chemin,courbeR2,courbe,%
surfaceparametree,texte,trigospherique,vecteur,line,objfile,datfile,surface*,%
plan,offfile,geode,load,plantype,point,pie,droite,polygone,cercle,rightangle}
%
%% Reservation de macros correspondants aux objects
\pst@solides@reservednames{object}
\define@key[psset]{pst-solides3d}{object}{%
 \ifcsname pst@solides@object@#1\endcsname
   \def\psk@solides@object{pst-#1}%
 \else
    \@pstrickserr{The solid #1 is not defined, the solid by default is
    drawn}{}%
 \fi}
%% Ajout de solides  la liste des objets
\def\addtosolideslistobject#1{%
% ajouter les nouveaux objets  la liste
\expandafter\def\expandafter\pst@solides@list@object\expandafter%
 {\pst@solides@list@object,#1}%
% Reserver le nom des nouveaux objets
 \edef\@tempa{#1}%
 \@for \name:=\@tempa\do{%
  \expandafter\def\csname pst@solides@object@\name\endcsname{}%
 }}
% solide par defaut
\psset[pst-solides3d]{object=tore}%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% pour le quadrillage 3d
\define@key[psset]{pst-solides3d}{spotX}{\def\pst@solides@@spotX{#1}}%
\define@key[psset]{pst-solides3d}{spotY}{\def\pst@solides@@spotY{#1}}%
\define@key[psset]{pst-solides3d}{spotZ}{\def\pst@solides@@spotZ{#1}}%
\define@key[psset]{pst-solides3d}{QZ}{\def\pst@solides@@QZ{#1}}%
\define@key[psset]{pst-solides3d}{Zmin}{\def\pst@solides@@Zmin{#1 }}%
\define@key[psset]{pst-solides3d}{Zmax}{\def\pst@solides@@Zmax{#1 }}%
\psset[pst-solides3d]{spotX=dr,spotY=dl,spotZ=l,QZ=0,Zmin=-4,Zmax=4}
% spotX, Y, Z vaut de 0 a 360 degres pour placer les valeurs correctement
% QZ translation du quadrillage suivant l'axe Oz

\define@key[psset]{pst-solides3d}{stepX}{\pst@getint{#1}\psk@solides@stepX}
\define@key[psset]{pst-solides3d}{stepY}{\pst@getint{#1}\psk@solides@stepY}
\define@key[psset]{pst-solides3d}{stepZ}{\pst@getint{#1}\psk@solides@stepZ}
\define@key[psset]{pst-solides3d}{ticklength}{\pst@checknum{#1}\psk@solides@ticklength}
%\define@key[psset]{pst-solides3d}{Dx}{\pst@checknum{#1}\psk@solides@Dx }
%\define@key[psset]{pst-solides3d}{Dy}{\pst@checknum{#1}\psk@solides@Dy }
%\define@key[psset]{pst-solides3d}{Dz}{\pst@checknum{#1}\psk@solides@Dz }
\psset[pst-solides3d]{stepX=1,stepY=1,stepZ=1,ticklength=0.2}% the step for the axes labels

\def\gridIIID{\pst@object{gridIIID}}
%% usage : \gridIIID[options](x_min,x_max)(y_min,y_max)
\def\gridIIID@i(#1,#2)(#3,#4){%
  \@ifnextchar[{\gridIIID@ii(#1,#2)(#3,#4)}{\gridIIID@ii(#1,#2)(#3,#4)[2,2,3]}}
\def\gridIIID@ii(#1,#2)(#3,#4)[#5,#6,#7]{%
  \pst@killglue%
  \begingroup%
  \use@par%
  \psSolid[object=parallelepiped,
    intersectiontype=-1,
    a={#2 #1 sub},b={#4 #3 sub},
    c={\pst@solides@@Zmax \pst@solides@@Zmin sub},
    action=draw](0,0,\pst@solides@@Zmax \pst@solides@@Zmin add 2 div )%
  \ifnum#1<0 \pst@cnta=-#1 \def\pst@minus{-}\else\pst@cnta=#1 \def\pst@minus{}\fi
  \divide\pst@cnta by \psk@solides@stepX
  \multido{\ix=\psk@solides@stepX+\psk@solides@stepX}{\pst@cnta}{%
    \psPoint(\pst@minus\ix,#4,\pst@solides@@Zmin){X1}%
    \psPoint(\pst@minus\ix,#4 \psk@solides@ticklength\space add,\pst@solides@@Zmin){X2}%
    \psline(X1)(X2)%
    \uput[\pst@solides@@spotX](X1){\small\pst@minus\ix}}%
  \ifnum#2<0 \pst@cnta=-#2 \def\pst@minus{-}\else\pst@cnta=#2 \def\pst@minus{}\fi
  \divide\pst@cnta by \psk@solides@stepX%
  \advance\pst@cnta by \@ne
  \multido{\ix=0+\psk@solides@stepX}{\the\pst@cnta}{%
    \psPoint(\pst@minus\ix,#4,\pst@solides@@Zmin){X1}
    \psPoint(\pst@minus\ix,#4 \psk@solides@ticklength\space add,\pst@solides@@Zmin){X2}
    \psline(X1)(X2)
    \uput[\pst@solides@@spotX](X1){\small\pst@minus\ix}}
%
  \ifnum#3<0 \pst@cnta=-#3 \def\pst@minus{-}\else\pst@cnta=#3 \def\pst@minus{}\fi
  \divide\pst@cnta by \psk@solides@stepY
  \multido{\iy=\psk@solides@stepY+\psk@solides@stepY}{\pst@cnta}{%
    \psPoint(#2,\pst@minus\iy,\pst@solides@@Zmin){Y1}
    \psPoint(#2 \psk@solides@ticklength\space add,\pst@minus\iy,\pst@solides@@Zmin){Y2}
    \psline(Y1)(Y2)
    \uput[\pst@solides@@spotY](Y1){\small\pst@minus\iy}}
  \ifnum#4<0 \pst@cnta=-#4 \def\pst@minus{-}\else\pst@cnta=#4 \def\pst@minus{}\fi
  \divide\pst@cnta by \psk@solides@stepY
  \advance\pst@cnta by \@ne
  \multido{\iy=0+\psk@solides@stepY}{\pst@cnta}{%
    \psPoint(#2,\pst@minus\iy,\pst@solides@@Zmin){Y1}
    \psPoint(#2 \psk@solides@ticklength\space add,\pst@minus\iy,\pst@solides@@Zmin){Y2}
    \psline(Y1)(Y2)
    \uput[\pst@solides@@spotY](Y1){\small\pst@minus\iy}}
%
  \pst@cnta=\pst@solides@@Zmin \pst@cntb=\pst@solides@@Zmax 
  \ifnum\pst@cnta=\pst@cntb\else% same z values?
    \pst@cnta=\pst@solides@@Zmin
    \ifnum\pst@cnta<0 \pst@cnta=-\pst@cnta \def\pst@minus{-}
    \else\def\pst@minus{}\fi%
    \divide\pst@cnta by \psk@solides@stepZ
    \multido{\iz=\psk@solides@stepZ+\psk@solides@stepZ}{\pst@cnta}{%
      \psPoint(#2,#3,\pst@minus\iz){Z1}
      \psPoint(#2,#3 \psk@solides@ticklength\space sub,\pst@minus\iz){Z2}
      \psline(Z1)(Z2)
      \uput[\pst@solides@@spotZ](Z1){\small\pst@minus\iz}}
    \pst@cnta=\pst@solides@@Zmax %
    \ifnum\pst@cnta<0 \pst@cnta=-\pst@pst@cnta \def\pst@minus{-}
    \else\def\pst@minus{}\fi%
    \divide\pst@cnta by \psk@solides@stepZ
    \advance\pst@cnta by \@ne
    \multido{\iz=0+\psk@solides@stepZ}{\pst@cnta}{%
      \psPoint(#2,#3,\pst@minus\iz){Z1}
      \psPoint(#2,#3 \psk@solides@ticklength\space sub,\pst@minus\iz){Z2}
      \psline(Z1)(Z2)
      \uput[\pst@solides@@spotZ](Z1){\small\pst@minus\iz}}
  \fi
%
  \psPoint(0,0,\pst@solides@@Zmax #7 add){Z'}
  \psPoint(#2 #5 add,0,0){X'}
  \psPoint(0,#4 #6 add, 0){Y'}
  \psPoint(0,0,\pst@solides@@Zmax){Z}
  \psPoint(#2,0,0){X}
  \psPoint(0,#4,0){Y}
  \psPoint(0,0,0){O}
  \uput[\pst@solides@@spotY](X'){$x$}
  \uput[\pst@solides@@spotX](Y'){$y$}
  \uput[u](Z'){$z$}
  \ifPst@showOrigin
    \psline[linestyle=dashed](O)(X)
    \psline[linestyle=dashed](O)(Y)
    \psline[linestyle=dashed](O)(Z)
  \fi
%\psset{linewidth=2\pslinewidth}
  \psline{->}(Z)(Z')\psline{->}(Y)(Y')\psline{->}(X)(X')
  \endgroup%
  \ignorespaces%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% code insere dans le .ps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
\pst@def{optionssolides}<%
/PSfont {\pst@solides@PSfont} def
/pst@fill { \psk@opacityalpha .setopacityalpha fill } def
/strokeopacity \psk@opacityalpha def
/fillopacity \psk@opacityalpha def
/xunit {\pst@number\psunit } def
%% /cm {\pst@number\psunit mul} def
%% /cm_1 {\pst@number\psunit div} def
/decal \pst@solides@decal\space def % decalage
/viewpointXYZ {\pst@solides@viewpoint} def
/Decran \pst@solides@Decran\space def % distance de l'ecran
%
/RotX \psk@solides@RotX\space def
/RotY \psk@solides@RotY\space def
/RotZ \psk@solides@RotZ\space def
%
/fontsize {\pst@solides@fontsize\space \pst@number\psunit mul 28.45 div } bind def
%
/projectionsifacevisible \ifPst@visibility true \else false \fi def
%
/R \pst@solides@R\space def % pour le tore
/r1 \pst@solides@rI\space def % pour le tore
/r0 \pst@solides@rO\space def % pour le tore
/resolution \pst@solides@resolution\space def % pour le nb de points par courbe
/phi \pst@solides@phi\space def % pour la calotte spherique
/theta \pst@solides@theta\space def % pour la calotte spherique
/r \pst@solides@r\space def % rayon sphere circonscrite
/a \pst@solides@a\space def % arete du cube (1 du parallelepipede)
/b \pst@solides@b\space def % arete 2 du parallelepipede
/c \pst@solides@c\space def % arete 3 du parallelepipede
/h \pst@solides@h\space def % hauteur du cylindre, du cone, du prisme
/trunccoeff \pst@solides@trunccoeff\space def % coeff de troncature
/chanfreincoeff \pst@solides@chanfreincoeff\space def % coeff de chanfreinage
/affinagecoeff \pst@solides@affinagecoeff\space def % coeff de affinage
/dualregcoeff \pst@solides@dualregcoeff\space def % coeff de dual
/solidintersectiontype \pst@solides@intersectiontype\space def % type d'intersection
/section {\pst@solides@section} def % section de l'objet de revolution
/base [ \pst@solides@base ] def
/solidintersectionlinewidth [ \pst@solides@intersectionlinewidth ] def
/solidintersectioncolor [ \pst@solides@intersectioncolor ] def
/solidintersectionplan [ \pst@solides@intersectionplan ] def
/axe  { \pst@solides@axe } def
/plansection  [ \pst@solides@plansection ] def
\ifx\pst@solides@function\@empty\else
  /function  (\pst@solides@function) def
\fi
%
/definition  (\pst@solides@definition) def
/args  { \pst@solides@args} def
/Mode \pst@solides@mode\space def % resolution du trace
/lightintensity \pst@solides@lightintensity\space def % intensite de la lumiere
%
/solidlinewidth {\pst@number\pslinewidth} def
/linecolor  {\pst@usecolor\pslinecolor} def
/linestyle  {\pslinestyle} def
/fillcolor  {\pst@usecolor\psfillcolor currentrgbcolor} def
/fillincolor  {\pst@usecolor\psincolor currentrgbcolor} def
%
/color1 {\pst@usecolor\pscolora } def
/color2 {\pst@usecolor\pscolorb } def
/color3 {\pst@usecolor\pscolorc } def
/color4 {\pst@usecolor\pscolord } def
%
/range [ \pst@solides@range ] def
/action (\pst@solides@action) def
/texte (\pst@solides@text) def
/pos (\pst@solides@pos) def
/proj-fontsize {\pst@solides@fontsize\space \pst@number\psunit mul 28.45 div } bind def
%
\ifx\pst@solides@CoordinatesLight\@empty\else
  /lightsrc {\pst@solides@CoordinatesLight} def
\fi
%
/rmfaces [\pst@solides@CoordinatesRm] def
%
\ifx\pst@solides@plansepare\@empty\else
  /plansepare {\pst@solides@plansepare} def
\fi
%
\ifx\pst@solides@transform\@empty\else
  /pst-transformoption { \pst@solides@transform} def
\fi
%
\ifx\pst@solides@name\@empty\else
  /solidname (\pst@solides@name) def
\fi
\ifx\pst@solides@file\@empty\else
  /solidfilename (\pst@solides@file) def
\fi
%
\ifx\pst@solides@planname\@empty\else
  /solidplanname (\pst@solides@planname) def
\fi
%
\ifx\pst@solides@load\@empty\else
  /solidloadname {\pst@solides@load} def
\fi
%
\ifx\pst@solides@fcolor\@empty\else
  /solidfcolor (\pst@solides@fcolor) def
\fi
%
/fcol [\pst@solides@fcol] def
/solidhue [\pst@solides@hue] def
/solidinouthue [\pst@solides@inouthue] def
/solidinhue [\pst@solides@inhue] def
/origin {\pst@solides@origin} def
%
%% 
%% /solidhue \ifPst@hue true \else false \fi def
%
/sommets [\pst@solides@sommets] def
/faces [\pst@solides@faces] def
/solidshow [\pst@solides@show] def
/solidnum [\pst@solides@num] def
/solidnumf [\pst@solides@numfaces] def
/solidtrunc [\pst@solides@trunc] def
/solidaffinage [\pst@solides@affinage] def
/ngrid [\pst@solides@ngrid] def
%
/isolatin \ifPst@isolatin true \else false \fi def
/affinagerm \ifPst@affinagerm true \else false \fi def
/chanfrein \ifPst@chanfrein true \else false \fi def
/solidgrid \ifPst@grid true \else false \fi def
/solidplanmarks \ifPst@planmarks true \else false \fi def
/solidplangrid \ifPst@plangrid true \else false \fi def
/solidshowbase3d \ifPst@showBase true \else false \fi def
/activationgestioncouleurs \ifPst@deactivatecolor false \else true \fi def
/solidshowbase \ifPst@showbase true \else false \fi def
/soliddualreg \ifPst@dualreg true \else false \fi def
/solidgeode \ifPst@geode true \else false \fi def
/solidhollow \ifPst@hollow true \else false \fi def
/solidbiface \ifPst@biface true \else false \fi def
%
%% 
%% /solidnum \ifPst@num true \else false \fi def
%
%\ifPst@SphericalCoor
%    viewpointXYZ /PHI ED /THETA ED /Dobs ED
%    %    CoefficientsMT
%    %% pour la 3D conventionnelle
%    %% Dony : graphisme scientifique : page 187
%    %% Editeur : Masson
%    /XpointVue {Dobs Cos1Cos2 mul} bind def
%    /YpointVue {Dobs Sin1Cos2 mul} bind def
%    /ZpointVue {Dobs Sin2 mul} bind def
%    XpointVue YpointVue ZpointVue /viewpoint defpoint3d
%\else
viewpointXYZ /ZpointVue ED /YpointVue ED /XpointVue ED
/THETA {YpointVue XpointVue atan} bind def
/PHI   {ZpointVue XpointVue dup mul YpointVue dup mul add sqrt atan} bind def
/Dobs  {XpointVue dup mul YpointVue dup mul add ZpointVue dup mul add sqrt} bind def
%    CoefficientsMT
XpointVue YpointVue ZpointVue /viewpoint defpoint3d
%\fi
>

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \psSolid
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\define@boolkey[psset]{pst-solides3d}[Pst@]{solidmemory}[true]{}
\psset{solidmemory=false}%
%
\def\composeSolid{\use@pscode}
\let\endpspictureS@lid\endpspicture%  redefine \endpspicture (hv)
\def\endpspicture{\ifPst@solidmemory\use@pscode\fi\endpspictureS@lid} 

\def\psSolid{\def\pst@par{}\pst@object{psSolid}}
\def\psSolid@i{\@ifnextchar({\psSolid@ii}{\psSolid@ii(0.,0.,0.)}}
\def\psSolid@ii(#1,#2,#3){{%
  \ifPst@solidmemory\use@par\else\begin@ClosedObj\fi
  \addto@pscode{
    1 setlinejoin
    \tx@optionssolides
    SolidesDict begin
    #1 #2 #3
    /CZ exch def
    /CY exch def
    /CX exch def
    % nature du solide
    \psk@solides@object\space
    end
  }% fin du code ps
  \ifPst@solidmemory\else\end@ClosedObj\fi
  \ignorespaces}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \codejps
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\codejps#1{{%
\define@key[psset]{pst-solides3d}{object}{\def\psk@solides@object{#1}}%
\psSolid[object={#1} exec](0,0,0)}}%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \psTransformPoint
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 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%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Vecteur normal a un plan
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\Normale{\pst@object{Normale}}
\def\Normale@i(#1,#2,#3){%
% #1 rayon
% #2 longitude
% #3 latitude
\pst@killglue%
\begingroup%
\use@par%
\pstVerb{/latitude #3 def
         /longitude #2 def
         /Rayon #1 def
         /xP Rayon #2 cos #3 cos mul mul def
         /yP Rayon #2 sin #3 cos mul mul def
         /zP Rayon #3 sin mul def}%
\psSolid[object=vecteur,RotZ=#2,RotY=-#3,
         args=1.7 0 0](xP,yP,zP)
  \endgroup%
  \ignorespaces%
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% les axes IIId
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% axisemph
%% thanks to Herbert Voss
\define@boolkey[psset]{pst-solides3d}[Pst@]{showOrigin}[true]{}
\define@boolkey[psset]{pst-solides3d}[Pst@]{mathLabel}[true]{}
\psset[pst-solides3d]{showOrigin,mathLabel}%

\def\pst@solides@axisnames@i#1,#2,#3,#4\@nil{%
 \def\pst@solides@axesIIID@xname{#1}
 \def\pst@solides@axesIIID@yname{#2}
 \def\pst@solides@axesIIID@zname{#3}}

\define@key[psset]{pst-solides3d}{axisnames}{%
  \expandafter\pst@solides@axisnames@i#1,,,\@nil}%
\psset[pst-solides3d]{axisnames={x,y,z}}

\define@key[psset]{pst-solides3d}{axisemph}{%
  \def\pst@solides@axesIIID@emph{#1}}
\psset[pst-solides3d]{axisemph=}

\def\axesIIID{\pst@object{axesIIID}}
\def\axesIIID@i(#1,#2,#3){%
\@ifnextchar({\axesIIID@ii(#1,#2,#3)}{\axesIIID@ii(0,0,0)(#1,#2,#3)}}
\def\axesIIID@ii(#1,#2,#3)(#4,#5,#6){% axes 3d 
  \pst@killglue%
  \begingroup%
  \addbefore@par{arrows=->}%
  \use@par%
  \psPoint(0,0,0){O}
  \psPoint(#1,0,0){X}
  \psPoint(0,#2,0){Y}
  \psPoint(0,0,#3){Z}
  \psPoint(#4,0,0){X'}
  \psPoint(0,#5,0){Y'}
  \psPoint(0,0,#6){Z'}
  \psPoint(#4 \pst@number\pslabelsep \pst@number\psunit div add,0, 0)
  {Xname}
  \psPoint(0, #5 \pst@number\pslabelsep \pst@number\psunit div add, 0)
  {Yname}
  \psPoint(0, 0, #6 \pst@number\pslabelsep \pst@number\psunit div add)
  {Zname}
  \ifPst@showOrigin
    \psline[linestyle=dashed,arrows=-](O)(X)
    \psline[linestyle=dashed,arrows=-](O)(Y)
    \psline[linestyle=dashed,arrows=-](O)(Z)
  \fi
  \psline(X)(X')
  \psline(Y)(Y')
  \psline(Z)(Z')
  \rput(Xname){\ifPst@mathLabel$\fi\pst@solides@axesIIID@emph
  \pst@solides@axesIIID@xname\ifPst@mathLabel$\fi}
  \rput(Yname){\ifPst@mathLabel$\fi\pst@solides@axesIIID@emph
  \pst@solides@axesIIID@yname\ifPst@mathLabel$\fi}
  \rput(Zname){\ifPst@mathLabel$\fi\pst@solides@axesIIID@emph
  \pst@solides@axesIIID@zname\ifPst@mathLabel$\fi}
  \endgroup%
  \ignorespaces%
}


% pour assurer la compatibilite avec PSTricks-add
\define@boolkey[psset]{pst-solides3d}[Pst@]{algebraic}[true]{}
\psset[pst-solides3d]{algebraic=false}%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \psSurface
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\psSurface{\pst@object{psSurface}}
\def\psSurface@i(#1,#2)(#3,#4)#5{{%
%% \def\hue{0 1 #3 #1 sub \pst@solides@dx\space div
%%              #4 #2 sub \pst@solides@dy\space div mul
%%  {/iF ED iF [1 iF #3 #1 sub \pst@solides@dx\space div
%%                   #4 #2 sub \pst@solides@dy\space div
%%                    mul div sub 0.75 1] (sethsbcolor) astr2str} for}
\ifPst@solidmemory\use@par\else\begin@ClosedObj\fi
    \addto@pscode{%
    1 setlinejoin
    \tx@optionssolides
    SolidesDict begin
/CX 0 def /CY 0 def /CZ 0 def
/base [ #1 #3 #2 #4 ] def
 \ifPst@algebraic
/fonction
  (#5) tx@AlgToPs begin AlgToPs end cvx def
 \else
/fonction  { #5 } def
 \fi
/f {2 dict begin
   /y exch def
   /x exch def
 fonction
end } def
 pst-Surface
 end
}% fin du code ps
 \ifPst@axesboxed
    \gridIIID(#1,#3)(#2,#4)
 \fi
\ifPst@solidmemory
  \else
\end@ClosedObj%
\fi
}}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \defFunction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\defFunction{\@ifnextchar[{\defFunction@i}{\defFunction@i[]}}%
\def\defFunction@i[#1]#2(#3)#4#5#6{%
  \pst@killglue
  \global\Pst@solidmemorytrue 
  \begingroup
  \psset{#1}%
  \defFunction@ii{#3}\edef\@tempa{\the\toks@}%
  \ifPst@algebraic
    \toks@={}%
    \def\@tempb{#4}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \def\@tempb{#5}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \def\@tempb{#6}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \codejps{%
      /#2 { 3 dict begin \@tempa \the\toks@
         gere_pst-deffunction end } def }% 20080625
  \else
    \codejps{%
       /#2 { 3 dict begin \the\toks@ #4 #5 #6
         gere_pst-deffunction end } def }% 20080625
  \fi
  \endgroup}%
%
\def\defFunction@ii#1{\defFunction@iii#1,,,\end}%
\def\defFunction@iii#1,#2,#3,#4\end{%
  \toks@={}%
   \def\arg@ii{#1}\ifx\arg@ii\@empty \else\store@toks@before\arg@ii\fi
   \def\arg@ii{#2}\ifx\arg@ii\@empty \else\store@toks@before\arg@ii\fi
   \def\arg@ii{#3}\ifx\arg@ii\@empty \else\store@toks@before\arg@ii\fi
   \edef\@tmpPSDefns{\the\toks@ mark }%       20080625
   \global\toks@=\expandafter{\@tmpPSDefns}}% 20080625
\def\store@toks@before#1{%
  \edef\@tmpPSDefns{/#1 exch def \the\toks@}%
  \global\toks@=\expandafter{\@tmpPSDefns}%
}%
\def\store@toks@after#1{%
  \edef\@tmpPSDefns{\the\toks@ (#1) tx@AlgToPs begin AlgToPs end cvx }%
  \global\toks@=\expandafter{\@tmpPSDefns}%
}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro de projection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% creation des variables pour PSTricks
\define@boolkey[psset]{pst-solides3d}[Pst@]{visibility}[false]{}
\psset{visibility=true}
\define@key[psset]{pst-solides3d}{normal}{\def\pst@solides@normal{#1}}
\psset[pst-solides3d]{normal=0 0 1}
% origine du plan
\define@key[psset]{pst-solides3d}{origine}{\def\pst@solides@origin{#1}} % origine du plan
\psset[pst-solides3d]{origine=0 0 0 }%
%% le range pour les fonctions numeriques
\define@key[psset]{pst-solides3d}{range}{\def\pst@solides@range{#1}}
\psset[pst-solides3d]{range=-5 5}% le range par defaut
%% le chemin a projeter
\define@key[psset]{pst-solides3d}{path}{\def\pst@solides@path{#1}}%
\psset[pst-solides3d]{path=newpath 0 0 moveto}% valeur par defaut
%% fonctions utilisees
\define@key[psset]{pst-solides3d}{function}{\def\pst@solides@function{#1}}%
\psset[pst-solides3d]{function=}% pas de valeur par defaut
% rotation du texte dans son plan
\define@key[psset]{pst-solides3d}{RotationAngleText}{\def\pst@solides@RotationAngleText{#1}} % origine du plan
\psset[pst-solides3d]{RotationAngleText=0 }%
% texte a projeter
\define@key[psset]{pst-solides3d}{text}{\def\pst@solides@text{#1}}
\psset[pst-solides3d]{text=}% pas de texte par defaut
% plan de projection
\define@key[psset]{pst-solides3d}{plan}{\def\pst@solides@plan{#1}}
\psset[pst-solides3d]{plan=}% pas de plan par defaut
% position du texte a projeter
\define@key[psset]{pst-solides3d}{pos}{\def\pst@solides@pos{#1}}
\psset[pst-solides3d]{pos=cc}% centre par defaut

%% transcription et inclusion des variables dans le fichier postscript
\pst@def{psProjection}<%
/projectionsifacevisible \ifPst@visibility true \else false \fi def
/isolatin \ifPst@isolatin true \else false \fi def
/solidlinewidth {\pst@number\pslinewidth} def
/PSfont {\pst@solides@PSfont} def
/normale {\pst@solides@normal} bind def
/fontsize {\pst@solides@fontsize\space \pst@number\psunit mul 28.45 div } bind def
/origin {\pst@solides@origin} def
/RotationAngleText {\pst@solides@RotationAngleText} def
/range [ \pst@solides@range ] def
/path  { \pst@solides@path } def
/function  { \pst@solides@function } def
/texte (\pst@solides@text) def
/pos (\pst@solides@pos) def
/proj-definition (\pst@solides@definition) def
/proj-args  { \pst@solides@args} def
/proj-action (\pst@solides@action) def
\ifx\pst@solides@name\@empty
    \else
/projname (\pst@solides@name) def
\fi
\ifx\pst@solides@plan\@empty
   \else
/planprojpst \pst@solides@plan \space def
\fi
\ifx\pst@solides@solidname\@empty
    \else
/solidprojname {\pst@solides@solidname\space} def
\fi
/noface \pst@solides@no\space def % no de la face du solide
/resolution \pst@solides@resolution\space def % pour le nb de points par courbe
>

%\makeatletter
%% la macro de projection
\def\psProjection{\def\pst@par{}\pst@object{psProjection}}
\def\psProjection@i{\@ifnextchar({\psProjection@ii}{\psProjection@ii(0,0)}}
\def\psProjection@ii(#1){\expandafter\psProjection@iii#1,,\@nil}
\def\psProjection@iii#1,#2,#3\@nil{{%
  \addbefore@par{pos=cc,range=0 360}%
  \def\pst@tempA{#2}%
  \ifPst@solidmemory\use@par\else\begin@ClosedObj\fi%
  \addto@pscode{%
    \tx@optionssolides
    SolidesDict begin
    \tx@psProjection
    /CX 0 def
    /CY 0 def
    /CZ 0 def
    #1/xorigine exch def
    \ifx\pst@tempA\@empty
        /yorigine xorigine def
        /xorigine exch def\space\else
    \pst@tempA\space /yorigine exch def
    \fi
    % nature du solide : texte, chemin, courbe
    proj-\psk@solides@object\space
    end
  }%<- fin du code ps
  \psk@fillstyle
  \pst@stroke
  \addto@pscode{newpath}%
  \ifPst@solidmemory\else\end@ClosedObj\fi
}}%
%\makeatother


%% 27/06/08 %% %% la macro de projection
%% 27/06/08 %% \def\psProjection{\def\pst@par{}\pst@object{psProjection}}
%% 27/06/08 %% \def\psProjection@i{\@ifnextchar({\psProjection@ii}{\psProjection@ii(0.,0.,0.)}}
%% 27/06/08 %% \def\psProjection@ii(#1,#2,#3){{%
%% 27/06/08 %%       \use@par
%% 27/06/08 %% \ifPst@solidmemory
%% 27/06/08 %% \else
%% 27/06/08 %%   \begin@ClosedObj
%% 27/06/08 %% \fi
%% 27/06/08 %%       \addto@pscode{%
%% 27/06/08 %%          \tx@optionssolides
%% 27/06/08 %%          SolidesDict begin
%% 27/06/08 %%          \tx@psProjection
%% 27/06/08 %%          /CX 0 def
%% 27/06/08 %%          /CY 0 def
%% 27/06/08 %%          /CZ 0 def
%% 27/06/08 %%          /xorigine #1 def
%% 27/06/08 %%          /yorigine #2 def
%% 27/06/08 %%          /zorigine #3 def
%% 27/06/08 %%          % nature du solide : texte, chemin, courbe
%% 27/06/08 %%          proj-\psk@solides@object\space
%% 27/06/08 %%          end
%% 27/06/08 %%       }%<- fin du code ps
%% 27/06/08 %%          \psk@fillstyle
%% 27/06/08 %%          \pst@stroke
%% 27/06/08 %% \ifPst@solidmemory
%% 27/06/08 %% \else
%% 27/06/08 %%   \end@ClosedObj
%% 27/06/08 %% \fi
%% 27/06/08 %%   }}

%% 28/06/08 %% \makeatletter
%% 28/06/08 %%     %% la macro de projection
%% 28/06/08 %% \def\psProjection{\def\pst@par{}\pst@object{psProjection}}
%% 28/06/08 %% \def\psProjection@i{\@ifnextchar({\psProjection@ii}{\psProjection@ii(0.,0.)}}
%% 28/06/08 %% \def\psProjection@ii(#1,#2){{%
%% 28/06/08 %%      \def\@tempb{#2}%
%% 28/06/08 %%       \use@par
%% 28/06/08 %% \ifPst@solidmemory
%% 28/06/08 %% \else
%% 28/06/08 %%   \begin@ClosedObj
%% 28/06/08 %% \fi
%% 28/06/08 %%       \addto@pscode{%
%% 28/06/08 %%          \tx@optionssolides
%% 28/06/08 %%          SolidesDict begin
%% 28/06/08 %%          \tx@psProjection
%% 28/06/08 %%          /CX 0 def
%% 28/06/08 %%          /CY 0 def
%% 28/06/08 %%          /CZ 0 def
%% 28/06/08 %%          \ifx\@tempb\@empty
%% 28/06/08 %%          #1 /yorigine exch def /xorigine exch def
%% 28/06/08 %%          \else
%% 28/06/08 %%          #1 #2 /yorigine exch def /xorigine exch def
%% 28/06/08 %%          \fi
%% 28/06/08 %%          % nature du solide : texte, chemin, courbe
%% 28/06/08 %%          proj-\psk@solides@object\space
%% 28/06/08 %%          end
%% 28/06/08 %%       }%<- fin du code ps
%% 28/06/08 %%          \psk@fillstyle
%% 28/06/08 %%          \pst@stroke
%% 28/06/08 %% \ifPst@solidmemory
%% 28/06/08 %% \else
%% 28/06/08 %%   \end@ClosedObj
%% 28/06/08 %% \fi
%% 28/06/08 %%   }}
%% 28/06/08 %% \makeatother

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \psLineIIID est
%% adapt de la macro \pstThreeDLine du package pst-3dplot (H.Voss)
%% http://tug.ctan.org/tex-archive/graphics/pstricks/contrib/pst-3dplot
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\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\psLineIIID{\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
      xunit mul exch xunit mul exch
    /n n 1 sub def
  } repeat
    end
    \pst@cp\space \psline@iii\space \tx@Line
  }%
  \end@OpenObj%
  \ignorespaces%
  \SpecialCoor%
}

\def\psPolygonIIID{\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
      xunit mul exch xunit mul exch
    /n n 1 sub def
  } repeat
    end
    \pst@cp\space \psline@iii\space \tx@Polygon
  }%
  \end@ClosedObj%
  \ignorespaces%
  \SpecialCoor%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode`\@=\PstAtCode\relax


\endinput
