Début de la mise en ligne de la documentation et des exemples
[pst-anamorphosis.git] / doc / anamorphosis.pro
diff --git a/doc/anamorphosis.pro b/doc/anamorphosis.pro
new file mode 100644 (file)
index 0000000..698afca
--- /dev/null
@@ -0,0 +1,152 @@
+%!
+% 12 octobre 2011
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === Capture de commandes de systemdict --------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/LINETO    { systemdict /lineto get exec    } def
+/MOVETO    { systemdict /moveto get exec    } def
+/CURVETO   { systemdict /curveto get exec   } def
+/CLOSEPATH { systemdict /closepath get exec } def
+/RLINETO   { systemdict /rlineto get exec   } def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === Transformation des commandes de construction des path(s) ----------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% 12/10/2011 : version incomplète et un peu brute !
+/tx@anamorphosisPathDict 50 dict def tx@anamorphosisPathDict begin
+/moveto {
+  /s@y ED /s@x ED /c@x s@x def /c@y s@y def
+  s@x s@y Anamorphose MOVETO
+} bind def
+/lineto {
+  /c@yt ED /c@xt ED /dx c@xt c@x sub 50 div def /dy c@yt c@y sub 50 div def
+  1 1 50 {dup dx mul c@x add exch dy mul c@y add Anamorphose LINETO} for
+  /c@x c@xt def /c@y c@yt def
+} bind def
+/closepath {
+  s@x s@y lineto CLOSEPATH
+} bind def
+/curveto {
+  /c@yt ED /c@xt ED
+  /c@yb ED /c@xb ED
+  /c@ya ED /c@xa ED
+  1 1 20 {
+    20 div /s ED 1 s sub /t ED
+    t c@x mul 3 s c@xa mul mul add t mul 3 s s c@xb mul mul mul add t mul s 3 exp c@xt mul add
+    t c@y mul 3 s c@ya mul mul add t mul 3 s s c@yb mul mul mul add t mul s 3 exp c@yt mul add
+    Anamorphose LINETO
+  } for
+  /c@x c@xt def /c@y c@yt def
+} bind def
+/curvetoinv {
+  /c@ya ED /c@xa ED
+  /c@yb ED /c@xb ED
+  /c@yt ED /c@xt ED
+  1 1 20 {
+    20 div /s ED 1 s sub /t ED
+    t c@x mul 3 s c@xa mul mul add t mul 3 s s c@xb mul mul mul add t mul s 3 exp c@xt mul add
+    t c@y mul 3 s c@ya mul mul add t mul 3 s s c@yb mul mul mul add t mul s 3 exp c@yt mul add
+    Anamorphose LINETO
+  } for
+  /c@x c@xt def /c@y c@yt def
+} bind def
+/rlineto {
+  c@y add exch c@x add exch lineto
+} bind def
+end
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === L'anamorphose cylindrique -----------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/pst-cylindrical {
+  /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def
+  /a Xv Xp sub dup mul Yv Yp sub dup mul add def
+  /b Xv Xp mul Yv Yp mul add Xv dup mul sub Yv dup mul sub def
+  /c R neg Xv dup mul add Yv dup mul add def
+  /d b dup mul a c mul sub 0.5 exp def
+  /rho b neg d sub a div def
+  /alpha 2 1 rho div sub def
+  /xi Xv dup Xp sub rho mul sub def
+  /yi Yv dup Yp sub rho mul sub def
+  /k 2 Xv xi mul Yv yi mul add mul R div def
+  /xv k xi mul Xv sub def
+  /yv k yi mul Yv sub def
+  xv dup xi sub alpha mul sub
+  yv dup yi sub alpha mul sub
+} def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === L'anamorphose conique ---------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/pst-conical {
+  /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def
+  /rP Xp dup mul Yp dup mul add 0.5 exp def
+  /k Rmirror Zs Zv sub mul Zs rP mul Zv Rmirror mul sub div def
+  /Xi k Xp mul def
+  /Yi k Yp mul def
+  k 0 eq {/Zi Zs def}{/Zi Zv 1 k sub mul def} ifelse
+  /BETA rP Zv Atan def
+  /THETA Rmirror Zs Atan def
+  /ALPHA 90 2 THETA mul sub BETA add def
+  /rI Xi dup mul Yi dup mul add 0.5 exp def
+  /KP' Zi ALPHA sin ALPHA cos div div def
+  /rP' rI KP' add def
+  rP' Xp rP div mul
+  rP' Yp rP div mul
+} def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === L'anamorphose spherique ---------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/pst-spherical {%
+    /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def
+    /rV Xv dup mul Yv dup mul add Zv dup mul add def
+    /rP Xp dup mul Yp dup mul add def
+    /A rP rV add Xv Xp mul Yv Yp mul add 2 mul sub def
+    /B rP neg Xv Xp mul add Yv Yp mul add def
+    /C rP R sub def
+    /Discriminant B dup mul A C mul sub 0.5 exp def
+    /solution1 B neg Discriminant add
+            A div def
+    /solution2 B neg Discriminant sub
+            A div def
+    solution1 0 gt {/Coeff1 solution1 def}{/Coeff1 solution2 def}
+    ifelse
+    /Xi Xp 1 Coeff1 sub mul Coeff1 Xv mul add def
+    /Yi Yp 1 Coeff1 sub mul Coeff1 Yv mul add def
+    /Zi Coeff1 Zv mul def
+    /Coeff2 2 Xv Xi mul Yv Yi mul add Zv Zi mul add mul R div def % k+2
+    /Xv2 Coeff2 Xi mul Xv sub def
+    /Yv2 Coeff2 Yi mul Yv sub def
+    /Zv2 Coeff2 Zi mul Zv sub def
+    /Coeff3 Zi Zi Zv2 sub div def
+    /Ximage Xi Coeff3 Xv2 Xi sub mul add def
+    /Yimage Yi Coeff3 Yv2 Yi sub mul add def
+    Ximage Yimage}
+    def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === La perspective ---------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/pst-perspective{
+  /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def
+       Xp xD mul
+       Yp ua add xD add div % x'
+       ua yH xD add mul Yp yH mul add
+      Yp ua add xD add div  % y'
+   } def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === La perspective inversee --------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/pst-inverseperspective{
+  /Yp exch s@@y mul t@@y add def /Xp exch s@@x mul t@@x add def
+       Xp ua yH sub mul
+       Yp yH sub div   % x'
+       ua yH xD add mul ua xD add Yp mul sub
+       Yp  yH sub div  % y'
+   } def
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% === Les commandes -----------------------------------------------------------
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+/Image {
+  gsave
+    /showpage {} def
+    t@@x t@@y translate s@@x s@@y scale 
+    fichier run
+  grestore
+} def

Licence Creative Commons Les fichiers de Syracuse sont mis à disposition (sauf mention contraire) selon les termes de la
Licence Creative Commons Attribution - Pas d’Utilisation Commerciale - Partage dans les Mêmes Conditions 4.0 International.