summaryrefslogtreecommitdiff
path: root/obsolete/graphics/pstricks/contrib/pst-vue3d/pst-vue3d.tex
blob: e6ffa14446a3fde5e7070142ad49d147eeeacaef (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
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
%% This is file `pst-vue3d.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-vue3d.tex'
%%
%% Manuel Luque <Mluque5130@aol.com> (France)
%% Herbert Voss <voss _at_ pstricks.de (Germany)
%%
%% 2008/02/21
%%
%% 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.
%%
%% DESCRIPTION:
%%   `pst-vue3d' is a PSTricks package to define 3d views
%% ChangeLog (at end)
%%
\csname PSTVueTroisDLoaded\endcsname
\let\PSTVueTroisDLoaded\endinput
% Require PSTricks and pst-node packages
\ifx\PSTricksLoaded\endinput\else\input pstricks.tex\fi
\ifx\PSTnodesLoaded\endinput\else\input pst-node.tex\fi
\ifx\PSTthreeDLoaded\endinput\else\input pst-3d.tex\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey\fi
%
\def\fileversion{1.24}%
\def\filedate{2008/02/21}%
\message{`pst-vue3d v\fileversion, \filedate\space (ML,hv)}%
\edef\PstAtCode{\the\catcode`\@}\catcode`\@=11\relax
\pst@addfams{pst-vue3d}% for pst-xkey
%%%%
\define@key[psset]{pst-vue3d}{scale}{\def\psk@TroisD@scale{#1}} % echelle
\define@key[psset]{pst-vue3d}{RotX}{\def\psk@TroisD@RotX{#1}} % rotation autour de Ox en degrés
\define@key[psset]{pst-vue3d}{RotY}{\def\psk@TroisD@RotY{#1}} % rotation autour de Oy en degrés
\define@key[psset]{pst-vue3d}{RotZ}{\def\psk@TroisD@RotZ{#1}} % rotation autour de OZ en degrés
\define@key[psset]{pst-vue3d}{A}{\def\psk@TroisD@A{#1}} % double  d'une arête du parallèlépipède
\define@key[psset]{pst-vue3d}{B}{\def\psk@TroisD@B{#1}} % double  d'une arête du parallèlépipède
\define@key[psset]{pst-vue3d}{C}{\def\psk@TroisD@C{#1}} % double  de l'arête du parallèlépipède
\define@key[psset]{pst-vue3d}{Rtetraedre}{\def\psk@TroisD@Rtetraedre{#1}} % Rayon du cercle tétraèdre
\define@key[psset]{pst-vue3d}{ColorFaceA}{\def\psk@TroisD@TetraedreColorFaceA{#1}} % couleur de la face A du tétraèdre
\define@key[psset]{pst-vue3d}{ColorFaceB}{\def\psk@TroisD@TetraedreColorFaceB{#1}} % couleur de la face B du tétraèdre
\define@key[psset]{pst-vue3d}{ColorFaceC}{\def\psk@TroisD@TetraedreColorFaceC{#1}} % couleur de la face C du tétraèdre
\define@key[psset]{pst-vue3d}{ColorFaceD}{\def\psk@TroisD@TetraedreColorFaceD{#1}} % couleur de la face D du tétraèdre
\define@key[psset]{pst-vue3d}{ColorFaceE}{\def\psk@TroisD@TetraedreColorFaceE{#1}} % couleur de la face D du tétraèdre
\define@key[psset]{pst-vue3d}{fracHeight}{\def\psk@TroisD@fracHeight{#1}} % fraction de la hauteur du cone
\define@key[psset]{pst-vue3d}{fracHcone}{\def\psk@TroisD@fracHeight{#1}} % for compatibility
%
\define@key[psset]{pst-vue3d}{normaleLongitude}{\def\psk@TroisD@normaleLongitude{#1}} % coordonnées angulaires de la normale
\define@key[psset]{pst-vue3d}{normaleLatitude}{\def\psk@TroisD@normaleLatitude{#1}} % coordonnées angulaires de la normale
\define@key[psset]{pst-vue3d}{pas}{\def\psk@TroisD@pas{#1}} % en cm résolution du tracé
\define@key[psset]{pst-vue3d}{grille}{\def\psk@TroisD@grille{#1}} % Pas de la grille en cm
%
\define@key[psset]{pst-vue3d}{THETA}{\def\psk@TroisD@Theta{#1}}
\define@key[psset]{pst-vue3d}{PHI}{\def\psk@TroisD@Phi{#1}}
\define@key[psset]{pst-vue3d}{DeltaTHETA}{\def\psk@TroisD@DeltaTheta{#1}}
\define@key[psset]{pst-vue3d}{DeltaPHI}{\def\psk@TroisD@DeltaPhi{#1}}
\define@key[psset]{pst-vue3d}{PortionSphereTHETA}{\def\psk@TroisD@PortionSphereTHETA{#1}}
\define@key[psset]{pst-vue3d}{PortionSpherePHI}{\def\psk@TroisD@PortionSpherePHI{#1}}
\define@key[psset]{pst-vue3d}{PhiCercle}{\def\psk@TroisD@PhiCercle{#1}}
\define@key[psset]{pst-vue3d}{ThetaMeridien}{\def\psk@TroisD@ThetaMeridien{#1}}
\define@key[psset]{pst-vue3d}{Dobs}{\def\psk@TroisD@Dobs{#1}}
\define@key[psset]{pst-vue3d}{Decran}{\def\psk@TroisD@Ecran{#1}}
%
\psset[pst-vue3d]{THETA=30,PHI=10,%
    Dobs=100,Decran=10,%
    normaleLongitude=45,%
    normaleLatitude=45,%
    PhiCercle=0,%
    ThetaMeridien=0,%
    pas=1,%
    grille=10,%
    scale=1,%
    RotX=0,RotY=0,RotZ=0,%
    A=10,B=10,C=10,%
    Rtetraedre=5,%
    ColorFaceD=cyan,ColorFaceA=magenta,ColorFaceB=red,%
    ColorFaceC=blue,ColorFaceE=yellow,%
    fracHeight=1,%
    DeltaTHETA=10,DeltaPHI=10,%
    PortionSphereTHETA=0,PortionSpherePHI=0}
% ajout du 28 août 2003
% colorier au choix les faces du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceOne}{\def\psk@TroisD@CubeColorFaceOne{#1}} % couleur de la face 1 du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceTwo}{\def\psk@TroisD@CubeColorFaceTwo{#1}} % couleur de la face 2 du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceThree}{\def\psk@TroisD@CubeColorFaceThree{#1}} % couleur de la face 3 du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceFour}{\def\psk@TroisD@CubeColorFaceFour{#1}} % couleur de la face 4 du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceFive}{\def\psk@TroisD@CubeColorFaceFive{#1}} % couleur de la face 5 du cube
\define@key[psset]{pst-vue3d}{CubeColorFaceSix}{\def\psk@TroisD@CubeColorFaceSix{#1}} % couleur de la face 6 du cube
\psset[pst-vue3d]{CubeColorFaceOne= 1 1 0 ,
    CubeColorFaceTwo= 0.9 0.9 0 ,
    CubeColorFaceThree= 0.8 0.8 0 ,
    CubeColorFaceFour= 0.7 0.7 0 ,
    CubeColorFaceFive= 0.6 0.6 0 ,
    CubeColorFaceSix= 0.5 0.5 0 }
% fin 28 août 2003
% ajout 27 octobre 2003
\define@boolkey[psset]{pst-vue3d}[Pst@]{CubeInside}[true]{}
\psset[pst-vue3d]{CubeInside=false}
% hv 2003-12-20
\define@boolkey[psset]{pst-vue3d}[Pst@]{SphericalCoor}[true]{}
\psset[pst-vue3d]{SphericalCoor=false}
%
\def\variablesTroisD{%
 0 0 translate
% hv 2005-04-30   --->beg
    /xUnit \pst@number\psxunit def
    /yUnit \pst@number\psyunit def
% hv 2005-04-30   <---end
    /reduction \psk@TroisD@scale\space def
    /RotX \psk@TroisD@RotX\space def
    /RotY \psk@TroisD@RotY\space def
    /RotZ \psk@TroisD@RotZ\space def
    /A \psk@TroisD@A\space def
    /B \psk@TroisD@B\space def
    /C \psk@TroisD@C\space def
    /RayonBaseTetraedre \psk@TroisD@Rtetraedre\space def
    /fracHeight \psk@TroisD@fracHeight\space def
    /Rpoint A 4 div def
    /nTheta \psk@TroisD@normaleLongitude\space def
    /nPhi \psk@TroisD@normaleLatitude\space def
    /S1 \psk@TroisD@normaleLongitude\space sin def
    /C1 \psk@TroisD@normaleLongitude\space cos def
    /S2 \psk@TroisD@normaleLatitude\space sin def
    /C2 \psk@TroisD@normaleLatitude\space cos def
    /THETA \psk@TroisD@Theta\space def
    /PHI \psk@TroisD@Phi\space def
    /dTHETA \psk@TroisD@DeltaTheta\space def
    /dPHI \psk@TroisD@DeltaPhi\space def
    /psTHETA \psk@TroisD@PortionSphereTHETA\space def
    /psPHI \psk@TroisD@PortionSpherePHI\space def
    /PhiCercle \psk@TroisD@PhiCercle\space def
    /ThetaMeridien \psk@TroisD@ThetaMeridien\space def
    /Dobs \psk@TroisD@Dobs\space def
    /DScreen \psk@TroisD@Ecran\space def
    /Sin1 THETA sin def
    /Sin2 PHI sin def
    /Cos1 THETA cos def
    /Cos2 PHI cos def
    /Cos1Sin2 Cos1 Sin2 mul def
    /Sin1Sin2 Sin1 Sin2 mul def
    /Cos1Cos2 Cos1 Cos2 mul def
    /Sin1Cos2 Sin1 Cos2 mul def
    /XpointVue Dobs Cos1Cos2 mul def
    /YpointVue Dobs Sin1Cos2 mul def
    /ZpointVue Dobs Sin2 mul def
    /M11 RotZ cos RotY cos mul def
    /M12 RotZ cos RotY sin mul RotX sin mul
         RotZ sin RotX cos mul sub def
    /M13 RotZ cos RotY sin mul RotX cos mul
         RotZ sin RotX sin mul add def
    /M21 RotZ sin RotY cos mul def
    /M22 RotZ sin RotY sin RotX sin mul mul
         RotZ cos RotX cos mul add def
    /M23 RotZ sin RotY sin mul RotX cos mul
         RotZ cos RotX sin mul sub def
    /M31 RotY sin neg def
    /M32 RotX sin RotY cos mul def
    /M33 RotX cos RotY cos mul def
 }%
% hv 2003-12-20
% -------------- Utilities -----------------
\SpecialCoor
\pstheader{pst-vue3d.pro}

\def\face{%
  \pscurve(1;160)(0.8;180)(1;200)
  \pscustom{\gsave\psarc(0,0){1}{165}{195}
    \pscurve(1;195)(0.85;180)(1;165)
    \fill[fillstyle=solid,fillcolor=blue]\grestore}
  \pscurve[linewidth=.4pt](1;195)(0.85;180)(1;165)
  \bgroup
    \psset{linewidth=2pt}
    \psarc(0,1){1}{180}{270}
    \psarc(0,-1){1}{90}{180}
  \egroup
  \psarc(0,0){1}{150}{210}
  \psset{linewidth=4pt,linecolor=gray}%
  \pscurve(-.5,3.5)(-1,3)(-1.2,2.5)(-1.3,2)(-1.4,1)(-1.35,0.5)%
    (-1.2,-.2)(-1.35,-.5)(-1.4,-1)(-1.5,-1.5)(-1.8,-2)(-1.8,-2.3)%
    (-1.65,-2.5)(-1.35,-2.55)(-.95,-2.8)(-.95,-3.35)(-1,-3.65)(-.8,-4)(-.4,-4.1)
  \pscurve(-.8,-4)(-.8,-4.2)(-.5,-4.5)(-.4,-5)(-.25,-5.5)(0,-5.8)(.5,-6)%
}
\def\eye{%
  \psarc[linewidth=2pt](0,2.5){2.5}{215}{270}%
  \psarc[linewidth=2pt](0,-2.5){2.5}{90}{140}%
  \psarc(-2.5,0){1}{-30}{30}%
  \psarc(0,0){1.75}{160}{200}
  \psclip{\pscircle[linestyle=none](0,0){1.75}}
    \pscircle[fillstyle=solid,fillcolor=lightgray](-2.5,0){0.9}
  \endpsclip%
}
%
% -------------- Basic Macros --------------
%
% hv 2003
\def\AxesThreeD{\pst@object{AxesThreeD}}
\def\AxesThreeD@i{\@ifnextchar({\AxesThreeD@iii}{\AxesThreeD@ii}}
\def\AxesThreeD@ii#1(#2){%
  \begingroup
  \addto@par{arrows=#1}%
  \begin@OpenObj
    \AxesThreeD@iv#2,@comma*\relax%
}
\def\AxesThreeD@iii(#1){%
  \begingroup
  \begin@OpenObj
    \AxesThreeD@iv#1,@comma*\relax%
}
%
\def\AxesThreeD@iv#1,#2*{%
  \def\@tempa{#2}\def\@tempb{@comma}%
  \ifx\@tempa\@tempb% only one value
    \AxesThreeD@v#1,#2\else\AxesThreeD@vi#1,#2\relax%
  \fi%
}
\def\AxesThreeD@v#1,#2\relax{%
  \AxesThreeD@vi#1,#1,#1,#1\relax%
}
\def\AxesThreeD@vi#1,#2,#3,#4\relax{%
  \use@par
  \pNodeThreeD(0,0,0){Origin}%
  \pNodeThreeD(0,0,#3){ZMax}\pNodeThreeD(#1,0,0){XMax}\pNodeThreeD(0,#2,0){YMax}%
  \psline(Origin)(ZMax)\psline(Origin)(XMax)\psline(Origin)(YMax)%
  \uput[0](ZMax){\small Z}\uput[90](XMax){\small X}\uput[0](YMax){\small Y}%
  \end@OpenObj
  \endgroup
}
%
% hv 2003
\def\showCoorThreeD{\pst@object{showCoorThreeD}}
\def\showCoorThreeD@i(#1){{%
    \begin@OpenObj
      \showCoorThreeD@ii#1,@comma*\relax
    \end@OpenObj
  }\ignorespaces%
}
\def\showCoorThreeD@ii#1,#2*{%
  \def\@tempa{#2}\def\@tempb{@comma}%
  \ifx\@tempa\@tempb%
    \showCoorThreeD@iii#1;#2\else\showCoorThreeD@iv#1,#2\relax%
  \fi%
}
%
\def\showCoorThreeD@iii#1;#2;#3;#4\relax{%
  \psline(!
    \variablesTroisD
    /Radius #1 def
    /longitude #2 def
    /latitude #3 def
    /Zcote Radius latitude sin mul def
    /Xabscisse Radius longitude cos mul latitude cos mul def
    /Yordonnee Radius longitude sin mul latitude cos mul def
    tx@3DDict begin
      formulesTroisD
        Xi reduction mul Yi reduction mul
   end)(!
    /Zcote 0 def
    tx@3DDict begin
      formulesTroisD
        Xi reduction mul Yi reduction mul
      end)
  \psline(!
    /Zcote 0 def
    /Xabscisse Radius longitude cos mul latitude cos mul def
    /Yordonnee Radius longitude sin mul latitude cos mul def
    tx@3DDict begin
      formulesTroisD
      Xi reduction mul Yi reduction mul
    end)(!
     /Zcote 0 def
     /Yordonnee 0 def
     tx@3DDict begin
	formulesTroisD
	Xi reduction mul Yi reduction mul
     end)
  \psline(!
    /Zcote 0 def
    /Xabscisse Radius longitude cos mul latitude cos mul def
    /Yordonnee Radius longitude sin mul latitude cos mul def
    tx@3DDict begin
      formulesTroisD
      Xi reduction mul Yi reduction mul
    end)(!
      /Zcote 0 def
      /Xabscisse 0 def
      tx@3DDict begin
	formulesTroisD
	Xi reduction mul Yi reduction mul
    end)
}
%
\def\showCoorThreeD@iv#1,#2,#3,#4\relax{%
%	\qdisk(P){1pt}
  \LineThreeD(#1,#2,#3)(#1,#2,0)%
  \LineThreeD(#1,#2,0)(#1,0,0)%
  \LineThreeD(#1,#2,0)(0,#2,0)%
}
%
%
\def\CubeThreeD{\def\pst@par{}\pst@object{CubeThreeD}}
\def\CubeThreeD@i(#1,#2,#3){{
  \begin@ClosedObj
%    \use@par
    \addto@pscode{%
      \variablesTroisD
	\ifPst@SphericalCoor
  	  /Radius #1 def
	  /longitude #2 def
	  /latitude #3 def
	  /CZ Radius latitude sin mul def
	  /CX Radius longitude cos mul latitude cos mul def
	  /CY Radius longitude sin mul latitude cos mul def
	\else
	  /CX #1 def
	  /CY #2 def
	  /CZ #3 def
	\fi
	\ifPst@CubeInside /Condition { ge } def \else /Condition { le } def \fi
	/CubeColorFaceOne {\psk@TroisD@CubeColorFaceOne} def
	/CubeColorFaceTwo {\psk@TroisD@CubeColorFaceTwo} def
	/CubeColorFaceThree {\psk@TroisD@CubeColorFaceThree} def
	/CubeColorFaceFive {\psk@TroisD@CubeColorFaceFive} def
	/CubeColorFaceFour {\psk@TroisD@CubeColorFaceFour} def
	/CubeColorFaceSix {\psk@TroisD@CubeColorFaceSix} def
	tx@3DDict begin
	    /Condition1 { PS1 0 le } def
	    Cube
	end
    }% fin du code ps
    \end@ClosedObj%
}}
%
\def\DieThreeD{\pst@object{DieThreeD}}
\def\DieThreeD@i(#1,#2,#3){{%
% (#2,#3,#4) coordonnées du centre
  \begin@ClosedObj
    \use@par
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
        /Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      \ifPst@CubeInside /Condition { ge } def \else /Condition {le } def \fi
      /CubeColorFaceOne {\psk@TroisD@CubeColorFaceOne} def
      /CubeColorFaceTwo {\psk@TroisD@CubeColorFaceTwo} def
      /CubeColorFaceThree {\psk@TroisD@CubeColorFaceThree} def
      /CubeColorFaceFive {\psk@TroisD@CubeColorFaceFive} def
      /CubeColorFaceFour {\psk@TroisD@CubeColorFaceFour} def
      /CubeColorFaceSix {\psk@TroisD@CubeColorFaceSix} def
      tx@3DDict begin
        Cube
        PointsDie
      end
    }% fin du code ps
  \end@ClosedObj%
}}
%
% Dodecahedron : 31 décembre 2003 ml
\def\DodecahedronThreeD{\pst@object{DodecahedronThreeD}}
\def\DodecahedronThreeD@i(#1,#2,#3){{%
  \begin@ClosedObj
    \addto@pscode{%
    \variablesTroisD
    /CX #1 def
    /CY #2 def
    /CZ #3 def
    /Condition {le } def
    tx@3DDict begin
        Dodecahedron
    end
    }% fin du code ps
    \end@ClosedObj%
}}
%
\def\SphereThreeD{\pst@object{SphereThreeD}}
\def\SphereThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordonnées du centre
% #5 rayon
  \begin@ClosedObj%
    \use@par
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      /increment 10 def
      tx@3DDict begin
	/condition { PSfacette 0 le } def
	/departPhi -90 def
	MaillageSphere
      end
    }% fin du code ps
  \showpointsfalse%
  \end@ClosedObj%
}\ignorespaces}
% % fin de la commande PSTricks
%
% 2décembre 2002
%
\def\SphereInverseThreeD{\pst@object{SphereInverseThreeD}}
\def\SphereInverseThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordonnées du centre
% #5 rayon
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      /increment 10 def
      tx@3DDict begin
	/condition {PSfacette 0 ge} def
	/departPhi -90 def
	MaillageSphere
      end
    }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj%
}\ignorespaces}
% % fin de la commande PSTricks
% fin 2 décembre 2002
%
\def\SphereCercleThreeD{\pst@object{SphereCercleThreeD}}
\def\SphereCercleThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordonnées du centre
% #5 rayon
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      tx@3DDict begin
        0 2 360 {
  	  /ThetaEquateur exch def
	  /Xpoint Rsphere ThetaEquateur cos mul PhiCercle cos mul def
	  /Ypoint Rsphere ThetaEquateur sin mul PhiCercle cos mul def
	  /Zpoint Rsphere PhiCercle sin mul def
	  CalculsPointsAfterTransformations
% rayon de las sphère (normale)
	  /nXfacette Xabscisse CX sub def
	  /nYfacette Yordonnee CY sub def
	  /nZfacette Zcote CZ sub def
% rayon vers point de vue
	  /RXvue Xabscisse XpointVue sub def
	  /RYvue Yordonnee YpointVue sub def
	  /RZvue Zcote ZpointVue sub def
% test de visibilité
	  /PSPoint RXvue nXfacette mul
	    RYvue nYfacette mul add
	    RZvue nZfacette mul add
	  def
	  PSPoint 0 le {
	    newpath
	    CalcCoordinates
	    0.5 0 360 arc
	    closepath
	    fill
	  } if
%lineto
        } for
      end
    }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj%
}\ignorespaces}
%
%
\def\SphereMeridienThreeD{\pst@object{SphereMeridienThreeD}}
\def\SphereMeridienThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordonnées du centre
% #5 rayon
  \begin@ClosedObj%
    \use@par
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
        /Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      tx@3DDict begin
        0 2 360 {
          /PhiCercle exch def
          /Xpoint Rsphere ThetaMeridien cos mul PhiCercle cos mul def
          /Ypoint Rsphere ThetaMeridien sin mul PhiCercle cos mul def
          /Zpoint Rsphere PhiCercle sin mul def
          CalculsPointsAfterTransformations
% rayon de las sphère (normale)
          /nXfacette Xabscisse CX sub def
          /nYfacette Yordonnee CY sub def
          /nZfacette Zcote CZ sub def
% rayon vers point de vue
          /RXvue Xabscisse XpointVue sub def
          /RYvue Yordonnee YpointVue sub def
          /RZvue Zcote ZpointVue sub def
% test de visibilité
          /PSPoint RXvue nXfacette mul
            RYvue nYfacette mul add
            RZvue nZfacette mul add
          def
          PSPoint 0 le{
	    newpath
            CalcCoordinates
	    0.5 0 360 arc
            closepath
            fill
          } if
          %lineto
        } for
        end
      }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj%
}\ignorespaces}
%
\def\CylindreThreeD{\pst@object{CylindreThreeD}}
\def\CylindreThreeD@i(#1,#2,#3)#4#5{{%
% Le centre de la base sera placé avec
% (#2,#3,#4) les paramètres CX,CY et CZ
% #5 rayon
% #6 hauteur
% on peut ensuite faire tourner le cylindre
% avec RotX, RotY et RotZ
  \begin@ClosedObj
    \use@par
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rcylindre #4 def
      /Hcylindre #5 def
      /incrementANGLE 10 def
      /incrementHAUTEUR Hcylindre 5 div def
      tx@3DDict begin
	CylinderThreeD
      end
    }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj
}\ignorespaces}% % fin de la commande PSTricks
%
% hv 2003-12-18
\def\LineThreeD{\pst@object{LineThreeD}}
\def\LineThreeD@i(#1,#2,#3)(#4,#5,#6){{%
% (#2,#3,#4) coordonnées du point1
% (#5,#6,#7) coordonnées du point2
  \begin@OpenObj
    \pNodeThreeD(#1,#2,#3){tempNodeA}
    \pNodeThreeD(#4,#5,#6){tempNodeB}
    \psline(tempNodeA)(tempNodeB)
  \end@OpenObj
}\ignorespaces}
%
% hv 2003-12-17
\def\pNodeThreeD{\pst@object{pNodeThreeD}}
% point can be in cartesian (x,y,z) or sphere coordinates (r;phi;theta)
\def\pNodeThreeD@i(#1)#2{{%
  \begin@ClosedObj
    \edef\@NodeNameThreeD{#2}
    \pNodeThreeD@ii#1,@comma*\relax
  \end@ClosedObj
  }\ignorespaces%
}
\def\pNodeThreeD@ii#1,#2*{%
  \def\@tempa{#2}\def\@tempb{@comma}%
  \ifx\@tempa\@tempb%
    \pNodeThreeD@iii#1;#2\else\pNodeThreeD@iv#1,#2\relax%
  \fi%
}
\def\pNodeThreeD@iii#1;#2;#3;#4\relax{%
  \pnode(!
    \variablesTroisD
    /Radius #1 def
    /longitude #2 def
    /latitude #3 def
    /Zcote Radius latitude sin mul def
    /Xabscisse Radius longitude cos mul latitude cos mul def
    /Yordonnee Radius longitude sin mul latitude cos mul def
    tx@3DDict begin
      formulesTroisD
      Xi reduction mul Yi reduction mul
    end){\@NodeNameThreeD}
}
\def\pNodeThreeD@iv#1,#2,#3,#4\relax{%
  \pnode(!
    \variablesTroisD
    \ifPst@SphericalCoor
      /Radius #1 def
      /longitude #2 def
      /latitude #3 def
      /Zcote Radius latitude sin mul def
      /Xabscisse Radius longitude cos mul latitude cos mul def
      /Yordonnee Radius longitude sin mul latitude cos mul def
    \else
      /Zcote #3 def
      /Xabscisse #1 def
      /Yordonnee #2 def
    \fi
    tx@3DDict begin
      formulesTroisD
      Xi reduction mul Yi reduction mul
    end){\@NodeNameThreeD}%
}
%

\iffalse
% hv 2005-12-04
\def\pnodeThreeD{\pst@object{pnodeThreeD}}
\def\pnodeThreeD@i(#1,#2,#3)#4{%
  \pst@killglue
  \begingroup
  \use@par
  \pnode(!
    \psk@embedangle
    \psk@viewpoint
    \psk@viewangle
    \tx@SetMatrixThreeD    
    \ifPst@SphericalCoor
      /Radius #1 def
      /longitude #2 def
      /latitude #3 def
      Radius longitude cos mul latitude cos mul % x
      Radius longitude sin mul latitude cos mul % y
      Radius latitude sin mul % z
    \else
      #1 #2 #3 
    \fi
    \tx@ProjThreeD){#4}%
    \endgroup}
%
\let\pNodeThreeD\pnodeThreeD
\fi
%
\def\TetraedreThreeD{\pst@object{TetraedreThreeD}}
\def\TetraedreThreeD@i(#1,#2,#3){{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      tx@3DDict begin
	Tetraedre
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
%
% pyramide
%
\def\FaceSAB{\pst@object{FaceSAB}}
\def\FaceSAB@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
        SommetsPyramide
        PSAB 0 le { %
  	  reduction reduction scale
	  newpath
	  1 setlinejoin
	  /Xabscisse XS 1 fracHeight sub XA XS sub mul add def
	  /Yordonnee YS 1 fracHeight sub YA YS sub mul add def
	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  moveto
	  /Xabscisse XA def
	  /Yordonnee YA def
	  /Zcote ZA def
	  CalcCoordinates
	  lineto
	  /Xabscisse XB def
	  /Yordonnee YB def
	  /Zcote ZB def
	  CalcCoordinates
	  lineto
	  /Xabscisse XS 1 fracHeight sub XB XS sub mul add def
	  /Yordonnee YS 1 fracHeight sub YB YS sub mul add def
	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  lineto
	  closepath
	} if
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
\def\FaceSBC{\pst@object{FaceSBC}}
\def\FaceSBC@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
        SommetsPyramide
        PSBC 0 le { %
  	  reduction reduction scale
	  newpath
	  1 setlinejoin
	  /Xabscisse XS 1 fracHeight sub XB XS sub mul add def
	  /Yordonnee YS 1 fracHeight sub YB YS sub mul add def
	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  moveto
	  /Xabscisse XB def
	  /Yordonnee YB def
	  /Zcote ZB def
	  CalcCoordinates
	  lineto
	  /Xabscisse XC def
	  /Yordonnee YC def
	  /Zcote ZC def
	  CalcCoordinates
	  lineto
	  /Xabscisse XS 1 fracHeight sub XC XS sub mul add def
	  /Yordonnee YS 1 fracHeight sub YC YS sub mul add def
	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  lineto
	  closepath
	} if
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
%
\def\FaceSCD{\pst@object{FaceSCD}}
\def\FaceSCD@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
      SommetsPyramide
      PSCD 0 le { %
	reduction reduction scale
	newpath
	1 setlinejoin
	/Xabscisse XS 1 fracHeight sub XC XS sub mul add def
	/Yordonnee YS 1 fracHeight sub YC YS sub mul add def
	/Zcote ZS CZ sub fracHeight mul CZ add def
	CalcCoordinates
	moveto
	/Xabscisse XC def
	/Yordonnee YC def
	/Zcote ZC def
	CalcCoordinates
	lineto
	/Xabscisse XD def
	/Yordonnee YD def
	/Zcote ZD def
	CalcCoordinates
	lineto
	/Xabscisse XS 1 fracHeight sub XD XS sub mul add def
	/Yordonnee YS 1 fracHeight sub YD YS sub mul add def
	/Zcote ZS CZ sub fracHeight mul CZ add def
	CalcCoordinates
	lineto
	closepath
      } if
    end
  }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
\def\FaceSDA{\pst@object{FaceSDA}}
\def\FaceSDA@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
	SommetsPyramide
	PSDA 0 le { %
          reduction reduction scale
          newpath
          1 setlinejoin
          /Xabscisse XS 1 fracHeight sub XD XS sub mul add def
          /Yordonnee YS 1 fracHeight sub YD YS sub mul add def
   	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  moveto
	  /Xabscisse XD def
	  /Yordonnee YD def
	  /Zcote ZD def
	  CalcCoordinates
	  lineto
	  /Xabscisse XA def
	  /Yordonnee YA def
	  /Zcote ZA def
	  CalcCoordinates
	  lineto
	  /Xabscisse XS 1 fracHeight sub XA XS sub mul add def
	  /Yordonnee YS 1 fracHeight sub YA YS sub mul add def
	  /Zcote ZS CZ sub fracHeight mul CZ add def
	  CalcCoordinates
	  lineto
	  closepath
	} if
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
\def\FaceABCD{\pst@object{FaceABCD}}
\def\FaceABCD@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
        SommetsPyramide
	PSABCD 0 le { %
	  reduction reduction scale
	  newpath
	  1 setlinejoin
	  /Xabscisse XA def
	  /Yordonnee YA def
	  /Zcote ZA def
	  CalcCoordinates
    	  moveto
	  /Xabscisse XB def
	  /Yordonnee YB def
	  /Zcote ZB def
	  CalcCoordinates
	  lineto
	  /Xabscisse XC def
	  /Yordonnee YC def
	  /Zcote ZC def
	  CalcCoordinates
	  lineto
	  /Xabscisse XD def
	  /Yordonnee YD def
	  /Zcote ZD def
	  CalcCoordinates
	  lineto
	  closepath
	} if
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
% hv 2003
\def\FaceABCDTop{\pst@object{FaceABCDTop}}
\def\FaceABCDTop@i(#1,#2,#3)#4{{%
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Hpyramide #4 def
      tx@3DDict begin
      SommetsPyramide
      PSABCD 0 gt { %
        reduction reduction scale
        newpath
        1 setlinejoin
        /Xabscisse XS 1 fracHeight sub XD XS sub mul add def
        /Yordonnee YS 1 fracHeight sub YD YS sub mul add def
        /Zcote ZS CZ sub fracHeight mul CZ add def
        CalcCoordinates
        moveto
        /Xabscisse XS 1 fracHeight sub XA XS sub mul add def
        /Yordonnee YS 1 fracHeight sub YA YS sub mul add def
        /Zcote ZS CZ sub fracHeight mul CZ add def
        CalcCoordinates
        lineto
	/Xabscisse XS 1 fracHeight sub XB XS sub mul add def
	/Yordonnee YS 1 fracHeight sub YB YS sub mul add def
	/Zcote ZS CZ sub fracHeight mul CZ add def
	CalcCoordinates
	lineto
	/Xabscisse XS 1 fracHeight sub XC XS sub mul add def
	/Yordonnee YS 1 fracHeight sub YC YS sub mul add def
	/Zcote ZS CZ sub fracHeight mul CZ add def
	CalcCoordinates
	lineto
	closepath
      } if
      end
    }% fin du code ps
  \end@ClosedObj
}\ignorespaces}
%
\def\PyramideThreeD{\@ifnextchar[{\PyramideThreeD@i}{\PyramideThreeD@i[]}}
% (#2,#3,#4) the coordinates of the origin
% #5 the height of the pyrimide
\def\PyramideThreeD@i[#1](#2,#3,#4)#5{{%
  \FaceSAB[fillcolor=\psk@TroisD@TetraedreColorFaceA,#1](#2,#3,#4){#5}%
  \FaceSBC[fillcolor=\psk@TroisD@TetraedreColorFaceB,#1](#2,#3,#4){#5}%
  \FaceSCD[fillcolor=\psk@TroisD@TetraedreColorFaceC,#1](#2,#3,#4){#5}%
  \FaceSDA[fillcolor=\psk@TroisD@TetraedreColorFaceD,#1](#2,#3,#4){#5}%
  \FaceABCD[fillcolor=\psk@TroisD@TetraedreColorFaceE,#1](#2,#3,#4){#5}%
  \FaceABCDTop[fillcolor=\psk@TroisD@TetraedreColorFaceE,#1](#2,#3,#4){#5}%
}\ignorespaces}
%
%
\def\ConeThreeD{\pst@object{ConeThreeD}}
\def\ConeThreeD@i(#1,#2,#3)#4#5{%
% Le centre de la base sera placé avec
% (#2,#3,#4) les paramètres CX,CY et CZ
% #5 rayon
% #6 hauteur
% on peut ensuite faire tourner le cylindre
% avec RotX, RotY et RotZ
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rcone #4 def
      /Hcone #5 def
      tx@3DDict begin
	ConeThreeD
      end
    }% fin du code ps
    \showpointsfalse
  \end@ClosedObj
\ignorespaces}%
%
\def\CircleThreeD{\pst@object{CircleThreeD}}
\def\CircleThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) les paramètres CX,CY et CZ
% #5 rayon du cercle
  \begin@ClosedObj
    \addto@pscode{%
      /Rcercle #4 def
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      tx@3DDict begin
        reduction reduction scale
        /TableauxPoints [
        0 1 360 {% on décrit le cercle
  	  /Angle exch def [
	    /Xcercle Rcercle Angle cos mul def
	    /Ycercle Rcercle Angle sin mul def
	    /Xabscisse Xcercle S1 mul Ycercle S2 C1 mul mul add CX add def
	    /Yordonnee Xcercle C1 mul neg Ycercle S2 S1 mul mul add CY add def
	    /Zcote Ycercle C2 mul neg CZ add def
	    CalcCoordinates ]
	} for
	] def
	TableauxPoints 0 get aload pop moveto
	0 1 360 {
	  /compteur exch def
	  TableauxPoints compteur get aload pop
	  lineto } for
      end
    }% fin du code ps
    \showpointsfalse
  \end@ClosedObj
}\ignorespaces}
%
%
\def\FrameThreeD{\pst@object{FrameThreeD}}
\def\FrameThreeD@i(#1,#2,#3)(#4,#5)(#6,#7){{%
% (#2,#3,#4) the origin
% (#5,#6) d'un sommet
% (#7,#8) du sommet opposé
% rectangle ABCD
  \begin@ClosedObj
    \addto@pscode{%
      /XA #4 def
      /YA #5 def
      /XC #6 def
      /YC #7 def
% on en déduit les autres sommets
      /XB XC def
      /YB YA def
      /XD XA def
      /YD YC def
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      tx@3DDict begin
	reduction reduction scale
	newpath
        /Xframe XA def
 	/Yframe YA def
        /Xabscisse Xframe S1 mul Yframe S2 C1 mul mul add CX add def
        /Yordonnee Xframe C1 mul neg Yframe S2 S1 mul mul add CY add def
        /Zcote Yframe C2 mul neg CZ add def
        CalcCoordinates
        moveto
        /Xframe XB def
        /Yframe YB def
        /Xabscisse Xframe S1 mul Yframe S2 C1 mul mul add CX add def
        /Yordonnee Xframe C1 mul neg Yframe S2 S1 mul mul add CY add def
        /Zcote Yframe C2 mul neg CZ add def
        CalcCoordinates
        lineto
        /Xframe XC def
        /Yframe YC def
        /Xabscisse Xframe S1 mul Yframe S2 C1 mul mul add CX add def
        /Yordonnee Xframe C1 mul neg Yframe S2 S1 mul mul add CY add def
        /Zcote Yframe C2 mul neg CZ add def
        CalcCoordinates
        lineto
        /Xframe XD def
        /Yframe YD def
        /Xabscisse Xframe S1 mul Yframe S2 C1 mul mul add CX add def
        /Yordonnee Xframe C1 mul neg Yframe S2 S1 mul mul add CY add def
        /Zcote Yframe C2 mul neg CZ add def
        CalcCoordinates
        lineto
        /Xframe XA def
        /Yframe YA def
        /Xabscisse Xframe S1 mul Yframe S2 C1 mul mul add CX add def
        /Yordonnee Xframe C1 mul neg Yframe S2 S1 mul mul add CY add def
        /Zcote Yframe C2 mul neg CZ add def
        CalcCoordinates
        lineto
	closepath
      end
    }% fin du code ps
    \showpointsfalse
  \end@ClosedObj
}\ignorespaces}% % fin de la commande PSTricks
%
%
\def\QuadrillageThreeD{\pst@object{QuadrillageThreeD}}
\def\QuadrillageThreeD@i(#1,#2,#3)(#4,#5)(#6,#7){{%
  \begin@OpenObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      /Xmin #4 def
      /Xmax #6 def
      /Ymin #5 def
      /Ymax #7 def
      /pas \psk@TroisD@pas\space def
      /grille \psk@TroisD@grille\space def
      tx@3DDict begin
	reduction reduction scale
	Ymin grille Ymax {% balayage suivant Oy
 	  /Ygrille exch def
	  /TableauxPoints [
	    Xmin pas Xmax { % balayage suivant Ox
	      /Xgrille exch def
	      /Xabscisse Xgrille S1 mul Ygrille S2 C1 mul mul add CX add def
	      /Yordonnee Xgrille C1 mul neg Ygrille S2 S1 mul mul add CY add def
	      /Zcote Ygrille C2 mul neg CZ add def
	      formulesTroisD
	      [ Xi 28.45 mul Yi 28.45 mul ]
	    } for
    	  ] def
	  TableauxPoints 0 get aload pop moveto
	  0 1 Xmax Xmin sub pas div {
	    /compteur exch def
	    TableauxPoints compteur get aload pop
	    lineto
	  } for
% stroke
    	} for
%
	Xmin grille Xmax {% balayage suivant Ox
    	  /Xgrille exch def
	  /TableauxPoints [
	    Ymin pas Ymax { % balayage suivant Ox
	      /Ygrille exch def
	      /Xabscisse Xgrille S1 mul Ygrille S2 C1 mul mul add CX add def
	      /Yordonnee Xgrille C1 mul neg Ygrille S2 S1 mul mul add CY add def
	      /Zcote Ygrille C2 mul neg CZ add def
	      formulesTroisD
	      [ Xi 28.45 mul Yi 28.45 mul ]
            } for
    	  ] def
	  TableauxPoints 0 get aload pop moveto
	  0 1 Ymax Ymin sub pas div {
	    /compteur exch def
    	    TableauxPoints compteur get aload pop
   	    lineto
	  } for
	  \pst@number\pslinewidth SLW
  	  \pst@usecolor\pslinecolor
	  \@nameuse{psls@\pslinestyle}
% stroke
    	} for
% fin du tracé
      end
    }% fin du code ps
  \end@OpenObj
}\ignorespaces}% % fin de la commande PSTricks
%
\newif\ifPstThreeDplot@showInside
\define@key[psset]{pst-vue3d}{showInside}[true]{\@nameuse{PstThreeDplot@showInside@#1}}
\define@key[psset]{pst-vue3d}{SegmentColor}{\pst@getcolor{#1}\psk@ThreeDplot@SegmentColor}
\define@key[psset]{pst-vue3d}{increment}{\pst@getint{#1}\psk@ThreeDplot@increment}
\psset[pst-vue3d]{showInside,SegmentColor={[cmyk]{0.2,0.6,1,0}},increment=10}
%
\def\ParaboloidThreeD{\pst@object{ParaboloidThreeD}}
\def\ParaboloidThreeD@i#1#2{%
\begin@SpecialObj%
\addto@pscode{%
  \psk@embedangle
  \psk@viewpoint
  \psk@viewangle
  \tx@SetMatrixThreeD
% Vecteur  ViewPoint
  \psk@viewpoint
  /vZ  ED
  /vY  ED
  /vX  ED
  /increment \psk@ThreeDplot@increment\space def
  /height #1 def
  /radius #2 #1 sqrt div def
  /cmyk {} def
  1 setlinejoin
  % les rayons de lumière
  /xLight 1 def
  /yLight 0.1 def
  /zLight 0.2 def
  % précision du tracé
  /pas 0.5 def
  /pas10 {pas 10 div} bind def
%
  /NormeLight {xLight dup mul yLight dup mul zLight dup mul add add sqrt} bind def
% l'ellipse du plan de coupe : le contour
  /calculate2DPoint { % four values on stack; x2D y2D are returned
    /V0 ED /Z0 ED /U20 ED /U10 ED
    U10 cos V0 mul radius mul \pst@number\psunit mul
    U20 sin V0 mul radius mul \pst@number\psunit mul
    Z0 \pst@number\psunit mul \tx@ProjThreeD
  } def
  /PlanCoupe {
    /Z height store
    /V {Z sqrt} bind def
    /TableauxPoints [
      0 1 359 { 
        /U exch def [ U U Z V caclculate2DPoint ] % on décrit le cercle
      } for
    ] def
    newpath
    TableauxPoints 0 get aload pop moveto
    0 1 359 {
      /compteur exch def
      TableauxPoints compteur get aload pop
      lineto } for
    closepath
  } def
%
  /facette {
    newpath
    U U Z V calculate2DPoint moveto
    U 1 U increment add  {%
      /U1 exch def
      U1 U1 Z V calculate2DPoint lineto
    } for
    Z pas10 Z pas add pas10 add{
      /Z1 exch def
      /V {Z1 sqrt} bind def
      U1 U1 Z1 V calculate2DPoint lineto
    } for
    U increment add -1 U {%
      /U2 exch def
      U2 U2 Z pas add V calculate2DPoint lineto
    } for
    Z pas add pas10 sub pas10 neg Z pas10 sub{
      /Z2 exch def
      /V {Z2 abs sqrt} bind def
      U U Z2 V calculate2DPoint lineto
    } for
    closepath
  } def % facette
%
  /MaillageParaboloid {
    0 pas height pas sub{%
      /Z ED
      /V {Z sqrt} bind def
      0 increment 360 increment sub {%
        /U exch def
% Centre de la facette
        /Ucentre {U increment 2 div add} bind def
        /Vcentre {Z pas 2 div add sqrt} bind def
% normale à la facette
        /nXfacette {2 Vcentre dup mul mul Ucentre cos mul radius mul} bind def
        /nYfacette {2 Vcentre dup mul mul Ucentre sin mul radius mul} bind def
        /nZfacette {Vcentre neg radius dup mul mul} bind def
        /NormeN {
          nXfacette dup mul
          nYfacette dup mul
          nZfacette dup mul
          add add sqrt} bind def
        NormeN 0 eq {/NormeN 1e-10 def} if
% test de visibilité
       /PSfacette vX nXfacette mul
                  vY nYfacette mul add
                  vZ nZfacette mul add def
       condition {
         facette
         /cosV {1 xLight nXfacette mul
           yLight nYfacette mul
           zLight nZfacette mul
           add add
           NormeLight
           NormeN mul div sub} bind def
         \psk@ThreeDplot@SegmentColor\space 
         cosV mul 4 1 roll cosV mul 4 1 roll cosV dup mul mul 4 1 roll cosV dup mul mul 4 1 roll
         setcmykcolor fill
         0 setgray
         facette
         stroke
       } if
     } for
    } for
  } def
  /conditionGE {PSfacette 0 ge} def
  /conditionLE {PSfacette 0 le} def
  \ifPstThreeDplot@showInside
    /condition {conditionGE} def
    MaillageParaboloid
    vZ 0 ge {%
      PlanCoupe 1 0.5 0.5 setrgbcolor fill
      PlanCoupe 0 setgray stroke} if
  \else 
    /condition {conditionLE} def
    MaillageParaboloid
    /condition {conditionGE} def
    MaillageParaboloid%
  \fi
}
% fin du code  ps
\showpointsfalse
\end@SpecialObj}
%
%
% 11 novembre
\def\DemiSphereThreeD{\pst@object{DemiSphereThreeD}}
\def\DemiSphereThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordinates of the center
% #5 rayon
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      /increment 10 def
      tx@3DDict begin
	/condition { PSfacette 0 le } def
	/departPhi 0 def
	MaillageSphere
% centre de la base inférieure après transformations
        /CxFaceInf CX def
        /CyFaceInf CY def
        /CzFaceInf CZ def
% correction 16 novembre 2002
%    /Xpoint CxFaceInf def
%    /Ypoint CyFaceInf def
%    /Zpoint CzFaceInf def
        /Xpoint 0 def
        /Ypoint 0 def
        /Zpoint 0 def
% fin correction 16/11/2002
 	CalculsPointsAfterTransformations
        /CxBaseInf Xabscisse def
        /CyBaseInf Yordonnee def
        /CzBaseInf Zcote def
        /RXvueInf CxBaseInf XpointVue sub def
        /RYvueInf CyBaseInf YpointVue sub def
        /RZvueInf CzBaseInf ZpointVue sub def
% Sommet de la sphère
        /Xpoint 0 def
        /Ypoint 0 def
        /Zpoint Rsphere def
        CalculsPointsAfterTransformations
        /XsommetSphere Xabscisse def
        /YsommetSphere Yordonnee def
        /ZsommetSphere Zcote def
% Normale extérieure à la base inférieure
        /nXBaseInf CxFaceInf XsommetSphere sub def
        /nYBaseInf CyFaceInf YsommetSphere sub def
        /nZBaseInf CzFaceInf ZsommetSphere sub def
% Visibilité de la base inférieure
        /PSbaseSphere nXBaseInf RXvueInf mul
          nYBaseInf RYvueInf mul add
          nZBaseInf RZvueInf mul add def
        PSbaseSphere 0 le {
          /TableauxPoints [
            0 1 359 {% on décrit le cercle
              /theta exch def [
                /Xpoint Rsphere theta cos mul def
                /Ypoint Rsphere theta sin mul def
                /Zpoint 0 def
                CalculsPointsAfterTransformations
                CalcCoordinates ]
            } for
          ] def
          gsave
          newpath
          TableauxPoints 0 get aload pop moveto
          0 1 359 {
            /compteur exch def
            TableauxPoints compteur get aload pop
            lineto 
	  } for
          0.7 setgray
          closepath
          fill
          grestore
        } if
      end
    }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj
}\ignorespaces}% % fin de la commande PSTricks
%
%
\def\SphereCreuseThreeD{\pst@object{SphereCreuseThreeD}}
\def\SphereCreuseThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordinates of the center
% #5 rayon
  \begin@ClosedObj
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
	/Radius #1 def
	/longitude #2 def
	/latitude #3 def
	/CZ Radius latitude sin mul def
	/CX Radius longitude cos mul latitude cos mul def
	/CY Radius longitude sin mul latitude cos mul def
      \else
	/CX #1 def
	/CY #2 def
	/CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      /increment 10 def
      tx@3DDict begin
	/SphereInside {
  	  /condition {PSfacette 0 ge} def
	  /departPhi 0 def
	  MaillageSphere
	} def
%% centre de la base inférieure après transformations
	/CxFaceInf CX def
	/CyFaceInf CY def
	/CzFaceInf CZ def
	/Xpoint CxFaceInf def
	/Ypoint CyFaceInf def
	/Zpoint CzFaceInf def
	CalculsPointsAfterTransformations
	/CxBaseInf Xabscisse def
	/CyBaseInf Yordonnee def
	/CzBaseInf Zcote def
	/RXvueInf CxBaseInf XpointVue sub def
	/RYvueInf CyBaseInf YpointVue sub def
	/RZvueInf CzBaseInf ZpointVue sub def
% Sommet de la sphère
	/Xpoint 0 def
	/Ypoint 0 def
	/Zpoint Rsphere def
	CalculsPointsAfterTransformations
	/XsommetSphere Xabscisse def
	/YsommetSphere Yordonnee def
	/ZsommetSphere Zcote def
% Normale extérieure à la base inférieure
	/nXBaseInf CxFaceInf XsommetSphere sub def
	/nYBaseInf CyFaceInf YsommetSphere sub def
	/nZBaseInf CzFaceInf ZsommetSphere sub def
% Visibilité de la base inférieure
	/PSbaseSphere nXBaseInf RXvueInf mul nYBaseInf RYvueInf mul add
	nZBaseInf RZvueInf mul add def
	/base {
       	  /TableauxPoints [
	    0 1 359 {% on décrit le cercle
	      /theta exch def [
	        /Xpoint Rsphere theta cos mul def
	        /Ypoint Rsphere theta sin mul def
	        /Zpoint 0 def
	        CalculsPointsAfterTransformations
	        CalcCoordinates ]
	    } for
	  ] def
% gsave
    	  newpath
	  TableauxPoints 0 get aload pop moveto
	  0 1 359 {
	    /compteur exch def
	    TableauxPoints compteur get aload pop
	  lineto } for
	  0.7 setgray
	  closepath
% stroke
%grestore
        } def
	PSbaseSphere 0 le {
	  base
	  clip
	  SphereInside
	}{ 0 0 0.01 0 360 arc } ifelse
      end
    }% fin du code ps
  \showpointsfalse%
  \end@ClosedObj
}\ignorespaces}% % fin de la commande PSTricks
%
% 30 novembre 2002
% révisé le 30 octobre 2003
\def\PortionSphereThreeD{\pst@object{PortionSphereThreeD}}
\def\PortionSphereThreeD@i(#1,#2,#3)#4{{%
% (#2,#3,#4) coordinates of the center
% #5 rayon
  \begin@ClosedObj%
    \addto@pscode{%
      \variablesTroisD
      \ifPst@SphericalCoor
        /Radius #1 def
        /longitude #2 def
        /latitude #3 def
        /CZ Radius latitude sin mul def
        /CX Radius longitude cos mul latitude cos mul def
        /CY Radius longitude sin mul latitude cos mul def
      \else
        /CX #1 def
        /CY #2 def
        /CZ #3 def
      \fi
      reduction reduction scale
      /Rsphere #4 def
      /increment 1 def
%    	/increment 2.5 def
      tx@3DDict begin
        PortionSphere
      end
    }% fin du code ps
    \showpointsfalse%
  \end@ClosedObj%
}\ignorespaces}% % fin de la commande PSTricks
%
\catcode`\@=\PstAtCode\relax
%
%% END: pst-vue3D.tex
\endinput