Changeset 15

Show
Ignore:
Timestamp:
02/27/08 17:38:45 (10 months ago)
Author:
manuel
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pst-map3d/map3d.pro

    r5 r15  
    540540} 
    541541def 
     542% 
     543%% produit vectoriel de deux vecteurs 3d 
     544/vectprod3d { %% x1 y1 z1 x2 y2 z2 
     5456 dict begin 
     546   /zp exch def 
     547   /yp exch def 
     548   /xp exch def 
     549   /z exch def 
     550   /y exch def 
     551   /x exch def 
     552   y zp mul z yp mul sub 
     553   z xp mul x zp mul sub 
     554   x yp mul y xp mul sub 
    542555end 
     556} def 
     557 
     558% coordonnées sphériques -> coordonnées cartésiennes 
     559/rtp2xyz { 
     5606 dict begin 
     561   /phi exch def 
     562   /theta exch def 
     563   /r exch def 
     564   /x phi cos theta cos mul r mul def  
     565   /y phi cos theta sin mul r mul def 
     566   /z phi sin r mul def 
     567   x y z 
     568end 
     569} def 
     570 
     571%% norme d'un vecteur 3d 
     572/norme3d { %% x y z 
     5733 dict begin 
     574   /z exch def 
     575   /y exch def 
     576   /x exch def 
     577   x dup mul y dup mul add z dup mul add sqrt 
     578end 
     579} def 
     580 
     581%% duplique le vecteur 3d 
     582/dupp3d { %% x y z 
     583        3 copy 
     584} def 
     585/dupv3d {dupp3d} def 
     586 
     587%%%%% ### mulv3d ### 
     588%% (scalaire)*(vecteur 3d) Attention : dans l autre sens ! 
     589/mulv3d { %% x y z lambda 
     5904 dict begin 
     591   /lambda exch def 
     592   /z exch def 
     593   /y exch def 
     594   /x exch def 
     595   x lambda mul 
     596   y lambda mul 
     597   z lambda mul 
     598end 
     599} def 
     600 
     601%%%%% ### defpoint3d ### 
     602%% creation du point A a partir de xA yA yB et du nom /A 
     603/defpoint3d { %% xA yA zA /nom 
     6041 dict begin 
     605   /memo exch def 
     606   [ 4 1 roll ] cvx memo exch 
     607end def 
     608}def 
     609 
     610%%%%% ### scalprod3d ### 
     611%% produit scalaire de deux vecteurs 3d 
     612/scalprod3d { %% x1 y1 z1 x2 y2 z2 
     6136 dict begin 
     614   /zp exch def 
     615   /yp exch def 
     616   /xp exch def 
     617   /z exch def 
     618   /y exch def 
     619   /x exch def 
     620   x xp mul y yp mul add z zp mul add 
     621end 
     622} def 
     623 
     624%%%%% ### addv3d ### 
     625%% addition de deux vecteurs 3d 
     626/addv3d { %% x1 y1 z1 x2 y2 z2 
     6276 dict begin 
     628   /zp exch def 
     629   /yp exch def 
     630   /xp exch def 
     631   /z exch def 
     632   /y exch def 
     633   /x exch def 
     634   x xp add 
     635   y yp add 
     636   z zp add 
     637end 
     638} def 
     639 
     640/arccos { 
     641   dup 
     642   dup mul neg 1 add sqrt 
     643   exch 
     644   atan 
     645} def 
     646 
     647%%%%% ### rotV3d ### 
     648/rotV3d { 
     64915 dict begin 
     650%    /ux 0 def /uy 41.15 sin def /uz 41.15 cos def 
     651    /N2uvw ux dup mul uy dup mul add uz dup mul add def 
     652    /N2uv  ux dup mul uy dup mul add def 
     653    /N2vw  uz dup mul uy dup mul add def 
     654    /N2uw  uz dup mul ux dup mul add def 
     655    /z exch def /y exch def /x exch def 
     656    /uxvywz ux x mul uy y mul add uz z mul add def 
     657    /uxvy   ux x mul uy y mul add def 
     658    /uxwz   ux x mul uz z mul add def 
     659    /vywz   uy y mul uz z mul add def 
     660    /_wyvz  uz y mul neg uy z mul add def 
     661    /wx_uz  uz x mul ux z mul sub def 
     662    /_vxuy  uy x mul neg ux y mul add def 
     663    ux uxvywz mul x N2vw mul ux vywz mul sub theta cos mul add N2uvw sqrt _wyvz mul theta sin mul add N2uvw div 
     664    uy uxvywz mul y N2uw mul uy uxwz mul sub theta cos mul add N2uvw sqrt wx_uz mul theta sin mul add N2uvw div 
     665    uz uxvywz mul z N2uv mul uz uxvy mul sub theta cos mul add N2uvw sqrt _vxuy mul theta sin mul add N2uvw div  
     666end 
     667 } def    
     668 
     669 
     670/grand_cercle_test{ 
     67150 dict begin 
     672 /theta {180 hour 15 mul sub} bind def 
     673% direction des rayons du soleil 
     674   u1 u2 u3 /u defpoint3d 
     675% vecteur normal dans le plan meridien 
     676% la latitude 
     677%  /phi0 u2 neg u3 atan def 
     678u1 u2 u3 rotV3d 
     679    /nZ exch def /nY exch def pop 
     680  /phi0 nY neg nZ atan def     
     681% vecteur normal dans le plan equateur 
     682   /theta0 u1 neg u2 atan def 
     683    theta0 cos theta0 sin 0 /v defpoint3d 
     684% w tels que le trièdre u v w soit direct    
     685   u v vectprod3d dupp3d norme3d 1 exch div mulv3d /w defpoint3d 
     686/TabPointsVusNeg[ 
     687-180 1 0{ % for 
     688   /t exch def 
     689    v t cos Rsphere mul mulv3d 
     690    w t sin Rsphere mul mulv3d 
     691         addv3d 
     692    rotV3d 
     693   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     694   CalculsPointsAfterTransformations 
     695    Test 
     696    PS 0 gt { t } if 
     697    } for  
     698] def 
     699% 
     700/TabPointsVusPos[ 
     7010 1 180{ % for 
     702   /t exch def 
     703    v t cos Rsphere mul mulv3d 
     704    w t sin Rsphere mul mulv3d 
     705         addv3d 
     706    rotV3d 
     707   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     708   CalculsPointsAfterTransformations 
     709    Test 
     710    PS 0 gt { t } if 
     711    } for  
     712] def   
     713/t_minNeg 0 def 
     714/t_maxNeg -180 def 
     715 
     7160 1 TabPointsVusNeg length 1 sub { % for 
     717    /iPoint exch def 
     718    /t TabPointsVusNeg iPoint get def 
     719     t t_minNeg le {/t_minNeg t def} if 
     720    } for 
     7210 1 TabPointsVusNeg length 1 sub { % for 
     722    /iPoint exch def 
     723    /t TabPointsVusNeg iPoint get def 
     724     t t_maxNeg ge {/t_maxNeg t def} if 
     725    } for 
     726     
     727/t_minPos 180 def 
     728/t_maxPos   0 def  
     729     
     7300 1 TabPointsVusPos length 1 sub { % for 
     731    /iPoint exch def 
     732    /t TabPointsVusPos iPoint get def 
     733     t t_minPos le {/t_minPos t def} if 
     734    } for 
     7350 1 TabPointsVusPos length 1 sub { % for 
     736    /iPoint exch def 
     737    /t TabPointsVusPos iPoint get def 
     738     t t_maxPos ge {/t_maxPos t def} if 
     739    } for 
     740 
     741theta -90 ge theta 90 le and { 
     742          v t_minNeg cos Rsphere mul mulv3d 
     743          w t_minNeg sin Rsphere mul mulv3d 
     744         addv3d 
     745   rotV3d 
     746   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     747   CalculsPointsAfterTransformations 
     748   CalcCoordinates 
     749     moveto    
     750      
     751t_minNeg 1 t_maxPos{ 
     752         /t  exch def 
     753          v t cos Rsphere mul mulv3d 
     754          w t sin Rsphere mul mulv3d 
     755         addv3d 
     756   rotV3d 
     757   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     758   CalculsPointsAfterTransformations 
     759   CalcCoordinates 
     760   lineto 
     761   } for 
     762%/phi0 90 phi0 sub def 
     763phi0 1 phi0 180 add { /t exch def 
     764    /Xpoint 0 def 
     765    /Ypoint Rsphere t cos mul def 
     766    /Zpoint Rsphere t sin mul def 
     767   CalculsPointsAfterTransformations 
     768   CalcCoordinates 
     769   lineto 
     770   } for   
     771%2 setlinewidth 
     772%1 0 1 setrgbcolor 
     773%stroke 
     774closepath 
     775%gsave 
     776%pst@fill 
     777%grestore 
     778}{ 
     779          v t_minPos cos Rsphere mul mulv3d 
     780          w t_minPos sin Rsphere mul mulv3d 
     781         addv3d 
     782   rotV3d 
     783   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     784   CalculsPointsAfterTransformations 
     785   CalcCoordinates 
     786     moveto    
     787      
     788t_minPos 1 t_maxPos { 
     789         /t  exch def 
     790          v t cos Rsphere mul mulv3d 
     791          w t sin Rsphere mul mulv3d 
     792         addv3d 
     793   rotV3d 
     794   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     795   CalculsPointsAfterTransformations 
     796   CalcCoordinates 
     797   lineto 
     798   } for 
     799t_minNeg 1 t_maxNeg { 
     800         /t  exch def 
     801          v t cos Rsphere mul mulv3d 
     802          w t sin Rsphere mul mulv3d 
     803         addv3d 
     804   rotV3d 
     805   /Zpoint exch def /Ypoint exch def /Xpoint exch def 
     806   CalculsPointsAfterTransformations 
     807   CalcCoordinates 
     808   lineto 
     809   } for 
     810phi0 1 phi0 180 add { /t exch def 
     811    /Xpoint 0 def 
     812    /Ypoint Rsphere t cos mul def 
     813    /Zpoint Rsphere t sin mul def 
     814   CalculsPointsAfterTransformations 
     815   CalcCoordinates 
     816   lineto 
     817   } for   
     818%2 setlinewidth 
     819%1 1 0 setrgbcolor 
     820%stroke 
     821closepath 
     822%gsave 
     823%pst@fill 
     824%grestore 
     825} ifelse 
     826end 
     827} 
     828def    
     829 
     830 
     831end 
  • trunk/pst-map3d/pst-map3d.tex

    r5 r15  
    3737\psset{RotX=0,RotY=0,RotZ=0,Radius=5} 
    3838% 
     39\define@key[psset]{pst-map3d}{Day}{\def\psk@WorldMap@J{#1}} 
     40\define@key[psset]{pst-map3d}{Month}{\def\psk@WorldMap@M{#1}} 
     41\define@key[psset]{pst-map3d}{Year}{\def\psk@WorldMap@A{#1}} 
     42\psset{Day=\number\day,Month=\number\month,Year=\number\year} 
     43\define@key[psset]{pst-map3d}{hour}{\edef\psk@WorldMap@hour{#1}} 
     44\psset{hour=12} % en heures 
     45% 
    3946\define@key[psset]{pst-map3d}{gridmapdiv}{\edef\psk@WorldMap@mapgriddiv{#1}} 
    4047\psset{gridmapdiv=10} 
     
    8592\pst@getcolor{#1}\psoceancolor} 
    8693\psset[pst-map3d]{oceancolor=mer} 
     94 
     95\define@key[psset]{pst-map3d}{rivercolor}{% 
     96\pst@getcolor{#1}\psrivercolor} 
     97\psset[pst-map3d]{rivercolor=blue} 
    8798 
    8899\define@key[psset]{pst-map3d}{gridmapcolor}{% 
     
    151162\psset{australia=false} 
    152163% 
     164\newif\ifPst@WorldMap@canada 
     165\define@key[psset]{pst-map3d}{canada}[true]{\@nameuse{Pst@WorldMap@canada#1}} 
     166\psset{canada=false} 
     167% 
    153168\newif\ifPst@WorldMap@city 
    154169\define@key[psset]{pst-map3d}{citys}[false]{\@nameuse{Pst@WorldMap@city#1}} 
     
    182197\define@key[psset]{pst-map3d}{blueEarth}[false]{\@nameuse{Pst@WorldMap@blueEarth#1}} 
    183198\psset{blueEarth=true} 
     199% 
     200\newif\ifPst@WorldMap@ombre 
     201\define@key[psset]{pst-map3d}{ombre}[true]{\@nameuse{Pst@WorldMap@ombre#1}} 
     202\psset{ombre=false} 
    184203% 
    185204\def\WorldMapThreeD{\pst@object{WorldMapThreeD}} 
     
    187206\def\WorldMapThreeD@do[#1]{{% 
    188207\psset{#1}% 
    189 \begin@ClosedObj 
     208\begin@ClosedObj% 
    190209\addto@pscode{% 
    191210  /increment \psk@WorldMap@mapgriddiv\space def 
     
    197216  /maillagecolor  {\pst@usecolor\psgridmapcolor currentrgbcolor} def 
    198217  /oceancolor  {\pst@usecolor\psoceancolor currentrgbcolor} def 
     218  /rivercolor  {\pst@usecolor\psrivercolor currentrgbcolor} def 
    199219  /circlecolor  {\pst@usecolor\pscirclecolor currentrgbcolor} def 
    200220  /circlewidth {\pst@number\pscirclewidth SLW} def 
     
    209229  /parallelwidth {\pst@number\psparallelwidth SLW} def 
    210230  /parallelcolor  {\pst@usecolor\psparallelcolor currentrgbcolor} def 
     231  /year \psk@WorldMap@A\space def 
     232  /month \psk@WorldMap@M\space def 
     233  /day \psk@WorldMap@J\space def 
     234  month 3 lt {/month month 12 add def /year year 1 sub def} if 
     235  /AA year 100 div truncate def 
     236  /BB 2 AA sub AA 4 div truncate add def 
     237  /CC 365.25 year mul truncate def 
     238  /DD 30.6001 month 1 add mul truncate def 
     239  /julien BB CC add DD add day add 1720994.5 add def 
     240  /hour \psk@WorldMap@hour\space def 
     241%  /jours \psk@WorldMap@daysAfterAutumnEquinox\space def 
     242  /jours julien 2454366.5 sub def 
     243  /AngleRayonsSoleil latitude_parallel neg 23.5 sin 360 jours mul 365.25 div sin mul arccos add neg def 
     244   /u1 0 def /u2 AngleRayonsSoleil cos def /u3 AngleRayonsSoleil sin def 
     245%  /Julien jd hour 24 div add def 
    211246  % 
    212247  1 setlinejoin 
     
    220255\else 
    221256 /condition { 0 le } def 
     257\fi 
     258% 
     259\ifPst@WorldMap@ombre 
     260grand_cercle_test 
    222261\fi 
    223262% 
     
    366405\fi 
    367406% 
     407\ifPst@WorldMap@canada 
     408  (\psk@WorldMap@Path/canada.dat) run 
     409gsave 
     410GrandCercle 
     411clip 
     412canada dup /REGION exch def 
     413CompteurRegions 
     414{CalculsPointsRegion 
     415  borderwidth 
     416  bordercolor 
     417   stroke 
     418  }forall 
     419grestore 
     420\fi 
     421% 
    368422\ifPst@WorldMap@Rivers 
    369423  (\psk@WorldMap@Path/river.dat) run 
     
    373427CompteurRegions 
    374428{CalculsPointsRegion 
    375       0 0 1 setrgbcolor 
    376       stroke 
     429   rivercolor 
    377430   stroke}forall 
    378431\fi 
     
    400453    MaillageSphere 
    401454\fi 
    402 %\ifPst@WorldMap@meridien 
    403 %gsave 
    404 %  meridien 
    405 %grestore 
    406 %\fi 
    407 %\ifPst@WorldMap@parallel 
    408 %gsave 
    409 %  parallel 
    410 %grestore 
    411 %\fi 
    412455end}% 
    413 \end@ClosedObj 
    414 }} 
     456\end@ClosedObj}} 
    415457% placer une ville en particulier 
    416458% par sa longitude et sa latitude en degrés 
     
    458500  \def\pst@tempb{all} 
    459501  \ifx\pst@tempb\psk@WorldMap@mapCountry 
    460     \mapputIIID@v[#1](#2,#3)[#4]{#5} 
     502    \mapputIIID@v[#1](#2,#3)[#4]{#5}% 
    461503  \else 
    462     \def\pst@tempb{#6} 
     504    \def\pst@tempb{#6}% 
    463505%    \typeout{Compare \pst@tempb{} with \psk@WorldMap@mapCountry} 
    464506    \ifx\pst@tempb\psk@WorldMap@mapCountry