summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/generic/pst-solides3d/pst-solides3d.tex
blob: e80033298dbfeaf0236c3278b53be11634dd8ba3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
%%		
%% COPYRIGHT 2008-2010 by Manuel Luque, Arnaud Schmittbuhl, 
%% Jean-Paul Vignault, Herbert Voss.
%%
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2003/12/01 or later.
%%
%% This work has the LPPL maintenance status "maintained".
% 
%% This work consists of the file pstricks.tex, PostScript macros 
%% for Generic TeX.
%% See the PSTricks User's Guide for description.
%
% 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.19}
\def\filedate{2010/04/30}
\message{`PSTSOLIDESIIID' v\fileversion, \filedate}
%
\pstheader{pst-solides3d.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=}%
\define@key[psset]{pst-solides3d}{zcolor}{\def\pst@solides@zcolor{#1}} %
\psset[pst-solides3d]{zcolor=}%
\define@key[psset]{pst-solides3d}{tablez}{\def\pst@solides@tablez{#1}} %
\psset[pst-solides3d]{tablez=}%

\def\Sol@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=\Sol@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}}
\define@key[psset]{pst-solides3d}{numsep}{\pst@getlength{#1}\pst@solides@numsep}
\psset[pst-solides3d]{numfaces=,numsep=15pt}% 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}

%% 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*,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%
}
%
\@ifundefined{pst@linetype}{\def\pst@linetype{0}}{}%  preventing errors hv 2009-07-03
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% 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
/tablez  [\pst@solides@tablez] def
/zcolor  [\pst@solides@zcolor] def
%
/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
SolidesDict begin /solidnumsep \pst@solides@numsep\space def end
/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}
%
\let\composeSolid\use@pscode
\let\endpspictureS@lid\endpspicture%  redefine \endpspicture (hv)
\def\endpspicture{\ifPst@solidmemory\use@pscode\fi\endpspictureS@lid} 

\def\psSolid{\pst@object{psSolid}}
\def\psSolid@i{\@ifnextchar({\psSolid@ii}{\psSolid@iv{ 0. 0. 0. }}}
\def\psSolid@ii(#1){\expandafter\psSolid@iii#1,,,\@nil}
\def\psSolid@iii#1,#2,#3,#4\@nil{%
  \ifx\relax#2\relax\psSolid@iv{#1}\else\psSolid@iv{#1 #2 #3}\fi}
\def\psSolid@iv#1{%
  \pst@killglue%
  \ifPst@solidmemory\begingroup\use@par\else\begin@ClosedObj\fi%
  \addto@pscode{
    1 setlinejoin
    \tx@optionssolides
    SolidesDict begin
    #1
    /CZ exch def
    /CY exch def
    /CX exch def
    % nature du solide
    \psk@solides@object\space
    end
  }% fin du code ps
  \ifPst@solidmemory\endgroup\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%
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \psSurface
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\psSurface{\@ifnextchar*{\@startrue\psSurface@i}{\@starfalse\psSurface@i*}}
\def\psSurface@i*{\@ifnextchar[{\psSurface@ii}{\psSurface@ii[]}}
\def\psSurface@ii[#1](#2,#3)(#4,#5)#6{%
%% \def\hue{0 1 #4 #2 sub \pst@solides@dx\space div
%%              #5 #3 sub \pst@solides@dy\space div mul
%%  {/iF ED iF [1 iF #4 #2 sub \pst@solides@dx\space div
%%                   #5 #3 sub \pst@solides@dy\space div
%%                    mul div sub 0.75 1] (sethsbcolor) astr2str} for}
  \pst@killglue%
  \begingroup%
  \psset{#1}%
  \init@pscode%
  \addto@pscode{
    1 setlinejoin
    \tx@optionssolides
    SolidesDict begin
    /CX 0 def /CY 0 def /CZ 0 def
    /base [ #2 #4 #3 #5 ] def
    \ifPst@algebraic
      /fonction (#6) tx@AlgToPs begin AlgToPs end cvx def
    \else
      /fonction  { #6 } def
    \fi
    /f {2 dict begin
      /y exch def
      /x exch def
      fonction end 
    } def
    \if@star pst-Surface* \else  pst-Surface \fi
    end
  }% fin du code ps
  \@starfalse
  \ifPst@axesboxed\gridIIID(#2,#4)(#3,#5)\fi
  \ifPst@solidmemory\else%
    \ifpsshadow \pst@closedshadow \fi
    \ifdim\psk@border\p@>\z@ \pst@addborder \fi
    \psk@fillstyle
    \pst@stroke
    \ifpsdoubleline \pst@doublestroke \fi
    \ifshowpoints\pst@OpenShowPoints\fi
    \use@pscode%
  \fi%
  \endgroup%
  \ignorespaces}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% la macro \defFunction
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\defFunction{\pst@object{defFunction}}%
\def\defFunction@i#1(#2)#3#4#5{%
  \pst@killglue
  \global\Pst@solidmemorytrue 
  \begingroup
  \use@par%
  \defFunction@ii{#2}\edef\@tempa{\the\toks@}%
  \ifPst@algebraic
    \toks@={}%
    \def\@tempb{#3}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \def\@tempb{#4}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \def\@tempb{#5}\ifx\@tempb\@empty \else\store@toks@after\@tempb\fi
    \codejps{%
      /#1 { 3 dict begin \@tempa \the\toks@
         gere_pst-deffunction end } def }% 20080625
  \else
    \codejps{%
       /#1 { 3 dict begin \the\toks@ #3 #4 #5
         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%
}
%
\def\psResetSolidKeys{%
\psset[pst-solides3d]{%
action=draw**,%
affinage=,% pas de affinage par defaut
affinagerm=true,
args=,%
axe=0 0 1,% vecteur definissant la direction de l'axe du prisme
axesboxed=false,%
axisemph=,
axisnames={x,y,z},
base=-1 -1 1 -1 0 1,% coordonnees d'un triangle, base triangulaire par defaut
biface=true,%
chanfrein=false,
color1=cyan,
color2=magenta,
color3=blue,
color4=red,
deactivatecolor=false,%
decal=-2,% decalage par defaut
definition=,%
dualreg=false,
faces={},% valeurs par defaut
fcolor=,% pas de couleur par defaut
fcol=,% pas de faces par defaut
file=,% pas de fichier par defaut
function=,% pas de valeur par defaut
geode=false,
grid=true,
hollow=false,
hue=,% pas de degrade externe par defaut
incolor=green,
inhue=,% pas de degrade interne par defaut
inouthue=,% pas de degrade total par defaut
intersectioncolor=(rouge),%
intersectionlinewidth=1,%
intersectionplan=[0 0 1 0],%
isolatin=true,
lightintensity=2,
lightsrc=,% pas de coordonnees par defaut
load=,% pas de load par defaut
mathLabel,
mode=2,%
name=,% pas de nom par defaut
ngrid=,% pas de faces par defaut
normal=0 0 1,
numfaces=,
numsep=15pt,% pas de numerotation par defaut
num=,% pas de numerotation defaut
object=tore,%
origine=0 0 0,%
path=newpath 0 0 moveto,% valeur par defaut
plangrid=false,%
planmarks=false,%
planname=,% pas de nom par defaut
plan=,% pas de plan par defaut
plansection=,% pas de section par defaut
plansepare=,% pas de separation par defaut
pos=cc,% centre par defaut
PSfont=Times-Roman,fontsize=10,
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,%
range=-5 5,% le range par defaut
rm=,% pas de faces par defaut
RotationAngleText=0,%
RotZ=0,RotX=0,RotY=0,Decran=50,% valeurs par defaut
section=\Sol@Section,% coordonnees des sommets de la section
showbase=false,%
showBase=false,%
showOrigin,
show=,% pas de pointage par defaut
solidmemory=false,
solidname=,% pas de nom par defaut
sommets=,% pas de sommet par defaut
spotX=dr,
spotY=dl,
spotZ=l,
QZ=0,
Zmin=-4,
Zmax=4,
stepX=1,
stepY=1,
stepZ=1,
ticklength=0.2,% the step for the axes labels
tablez=,%
text=,% pas de texte par defaut
transform=,%
trunc=,% pas de troncature par defaut
viewpoint=10 10 10,% coordonnees cartesiennes
visibility=true,
zcolor=}
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode`\@=\PstAtCode\relax
%
\endinput