summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/dvips/pst-3dplot
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/dvips/pst-3dplot')
-rw-r--r--Master/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro140
1 files changed, 136 insertions, 4 deletions
diff --git a/Master/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro b/Master/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro
index 23cd5be3db9..d8cffb1e8fb 100644
--- a/Master/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro
+++ b/Master/texmf-dist/dvips/pst-3dplot/pst-3dplot.pro
@@ -15,9 +15,9 @@
%% `pst-3dplot' is a PSTricks package to draw 3d curves and graphical objects
%%
%%
-%% version 0.2 / 2005-01-14 Herbert Voss <voss _at_ PSTricks.de>
+%% version 0.23 / 2006-01-18 Herbert Voss <voss _at_ PSTricks.de>
%
-/tx@3DPlotDict 40 dict def
+/tx@3DPlotDict 50 dict def
tx@3DPlotDict begin
%
/saveCoor {
@@ -28,8 +28,10 @@ tx@3DPlotDict begin
%
/ConvertTo2D {
RotatePoint
- /x2D x neg Alpha cos mul y Alpha sin mul add def
- /y2D x Alpha sin mul y Alpha cos mul add neg Beta sin mul z Beta cos mul add def
+% /x2D y x Alpha sin mul sub def % |/_ co system
+% /y2D z x Alpha cos mul sub def
+ /x2D x leftHanded not { neg } if Alpha cos mul y Alpha sin mul add def
+ /y2D x leftHanded { neg } if Alpha sin mul y Alpha cos mul add neg Beta sin mul z Beta cos mul add def
} def
%
/ConvertToCartesian {
@@ -105,4 +107,134 @@ tx@3DPlotDict begin
%
/RotatePoint { RotSequence cvx exec } def
%
+/VecNorm { 0 exch { dup mul add } forall sqrt } def
+/UnitVec { % on stack is [a]; returns a vector with [a][a]/|a|=1
+ dup VecNorm /norm ED
+ { norm div } forall 3 array astore } def
+/AxB { % on the stack are the two vectors [a][b]
+ aload pop /b3 ED /b2 ED /b1 ED
+ aload pop /a3 ED /a2 ED /a1 ED
+ a2 b3 mul a3 b2 mul sub
+ a3 b1 mul a1 b3 mul sub
+ a1 b2 mul a2 b1 mul sub
+ 3 array astore } def
+/AaddB { % on the stack are the two vectors [a][b]
+ aload pop /b3 ED /b2 ED /b1 ED
+ aload pop /a3 ED /a2 ED /a1 ED
+ a1 b1 add a2 b2 add a3 b3 add
+ 3 array astore } def
+/AmulC { % on stack is [a] and c; returns [a] mul c
+ /factor ED { factor mul } forall 3 array astore } def
+%
+%
+% 3D objects
+/tx@ProjThreeD {% adopted from pst-3d
+ /z ED /y ED /x ED
+ Matrix3D aload pop
+ z mul exch y mul add exch x mul add
+ 4 1 roll
+ z mul exch y mul add exch x mul add
+ exch} def
+%
+/setColorLight { % expects 7 values on stack C M Y K xL yL zL
+% les rayons de lumière
+ /zLight exch def
+ /yLight exch def
+ /xLight exch def
+% the color values
+ /K exch def
+ /Yellow exch def
+ /Magenta exch def
+ /Cyan exch def
+%
+ /NormeLight {xLight dup mul yLight dup mul zLight dup mul add add
+ sqrt} bind def
+} def
+/facetteSphere {
+ newpath
+ /Xpoint Rsphere theta cos mul phi cos mul CX add def
+ /Ypoint Rsphere theta sin mul phi cos mul CY add def
+ /Zpoint Rsphere phi sin mul CZ add def
+ Xpoint Ypoint Zpoint tx@ProjThreeD moveto
+ theta 1 theta increment add {%
+ /theta1 exch def
+ /Xpoint Rsphere theta1 cos mul phi cos mul CX add def
+ /Ypoint Rsphere theta1 sin mul phi cos mul CY add def
+ /Zpoint Rsphere phi sin mul CZ add def
+ Xpoint Ypoint Zpoint tx@ProjThreeD lineto
+ } for
+ phi 1 phi increment add {
+ /phi1 exch def
+ /Xpoint Rsphere theta increment add cos mul phi1 cos mul CX add def
+ /Ypoint Rsphere theta increment add sin mul phi1 cos mul CY add def
+ /Zpoint Rsphere phi1 sin mul CZ add def
+ Xpoint Ypoint Zpoint tx@ProjThreeD lineto
+ } for
+ theta increment add -1 theta {%
+ /theta1 exch def
+ /Xpoint Rsphere theta1 cos mul phi increment add cos mul CX add def
+ /Ypoint Rsphere theta1 sin mul phi increment add cos mul CY add def
+ /Zpoint Rsphere phi increment add sin mul CZ add def
+ Xpoint Ypoint Zpoint tx@ProjThreeD lineto
+ } for
+ phi increment add -1 phi {
+ /phi1 exch def
+ /Xpoint Rsphere theta cos mul phi1 cos mul CX add def
+ /Ypoint Rsphere theta sin mul phi1 cos mul CY add def
+ /Zpoint Rsphere phi1 sin mul CZ add def
+ Xpoint Ypoint Zpoint tx@ProjThreeD lineto
+ } for
+ closepath
+} def
+%
+/condition { PSfacette 0 ge } def
+/MaillageSphere {
+% on stack must be
+% x y z Radius increment C M Y K x y zLIGHT
+ setColorLight
+ /increment exch def
+ /Rsphere exch def
+ /CZ exch def
+ /CY exch def
+ /CX exch def
+ /StartTheta 0 def
+ -90 increment 90 increment sub {%
+ /phi exch def
+ StartTheta increment 360 StartTheta add increment sub {%
+ /theta exch def
+ % Centre de la facette
+ /Xpoint Rsphere theta increment 2 div add cos mul phi increment 2 div add cos mul CX add def
+ /Ypoint Rsphere theta increment 2 div add sin mul phi increment 2 div add cos mul CY add def
+ /Zpoint Rsphere phi increment 2 div add sin mul CZ add def
+ % normale à la facette
+ /nXfacette Xpoint CX sub def
+ /nYfacette Ypoint CY sub def
+ /nZfacette Zpoint CZ sub def
+ % test de visibilité
+ /PSfacette vX nXfacette mul
+ vY nYfacette mul add
+ vZ nZfacette mul add
+ def
+ condition {
+ gsave
+ facetteSphere
+ /cosV { 1 xLight nXfacette mul
+ yLight nYfacette mul
+ zLight nZfacette mul
+ add add
+ NormeLight
+ nXfacette dup mul
+ nYfacette dup mul
+ nZfacette dup mul
+ add add sqrt mul div sub } bind def
+ Cyan cosV mul Magenta cosV mul Yellow cosV mul K cosV mul setcmykcolor fill
+ grestore
+% 0 setgray
+ facetteSphere stroke
+ } if
+ } for
+ % /StartTheta StartTheta increment 2 div add def
+ } for
+} def
+
end