[pstricks] pst-3Dplot

Patrice Mégret Patrice.Megret at umons.ac.be
Fri Oct 2 09:40:58 CEST 2009


Dear Herbert,

I have worked on your files following my yesterday mail and I would like to propose you this solution:

1.  I have changed the pst-3dplot.pro ==> pst-3dplotnew.pro by introducing SphericalcoorType in the procedure \ConvertToCartesian

/ConvertToCartesian {
  /latitude exch def
  /longitude exch def
  /Radius exch def
  1 { %  dummy loop, will run only 1 time, allows exit
    SphericalcoorType 0 le {                                               % the default |
     /z { Radius latitude sin mul } def
     /x { Radius longitude cos mul latitude cos mul } def
     /y { Radius longitude sin mul latitude cos mul } def
      exit } if
    SphericalcoorType 2 le {
     /z { Radius longitude cos mul } def
     /x { Radius longitude sin mul latitude cos mul} def
     /y { Radius longitude sin mul latitude sin mul } def
      exit } if
  } repeat
} def

To tackle the order of arguments, I have just exchanged longitude and latitude for SphericalcoorType=2

I have removed coorType 4 and 5 to come back to the previous version in \ConvertTo2D:

/ConvertTo2D {
  RotatePoint
  1 { %  dummy loop, will run only 1 time, allows exit
    coorType 0 le {                                               % the default |
      /x2D x leftHanded not { neg } if Alpha cos mul y Alpha sin mul add def %  /\  co system
      /y2D x leftHanded { neg } if Alpha sin mul y Alpha cos mul add neg Beta sin mul z Beta cos mul add def
      exit } if
    coorType 1 le {
      /x2D y x Alpha 90 sub sin mul sub def  %  |/_  co system, no shortened x axis
      /y2D z x Alpha 90 sub cos mul sub def
      exit } if
    coorType 2 le { % coorType |/_ with a 1/sqrt(2) shortend x-axis and 135 degrees
      /x2D y x 0.5 mul sub def
      /y2D z x 0.5 mul sub def
      exit } if
    coorType 3 le { % coorType |/_ with a 1/sqrt(2) shortend x-axis and 135 degrees
      /x2D y x -0.5 mul sub def
      /y2D z x -0.5 mul sub def
      exit } if
  } repeat
} def


2. I have also changed the original pst-3dplot.tex (so not the one you send me) ==> pst-3dplotnew.tex to add a key SphericalcoorType

89 %% added by PM
90 \define at key[psset]{pst-3dplot}{SphericalcoorType}[0]{\def\psk at ThreeDplot@SphericalcoorType{#1}}
91 %% end added by PM
92
93 \psset[pst-3dplot]{drawing,drawCoor,hiddenLine=false,SphericalCoor=false,
    leftHanded=false,eulerRotation=false,coorType=0,SphericalcoorType=0}


314 %% added by PM01
315   /SphericalcoorType \psk at ThreeDplot@SphericalcoorType\space def
316 %% end added by PM

and finally I have put SphericalcoorType=0 in line 93 (psset) and line 269.

It seems to work but I am not expert and cannot assume there is no side effect in the tex part of the code.

Herbert, could you let me know if this way of doing is correct and maybe add it into your code.


I also send a file with an example.

Best regards and tanks a lot.

Patrice



-----Message d'origine-----
De : pstricks-bounces at tug.org [mailto:pstricks-bounces at tug.org] De la part de Herbert Voss
Envoyé : jeudi 24 septembre 2009 23:13
À : Graphics with PSTricks
Objet : Re: [pstricks] pst-3Dplot

Patrice Mégret schrieb:

> In the attached files you will find the transformation from the proposed spherical coordinates to (x,y,z). Then from (x,y,z) to (x2d,y2d) it is your subroutines depending on CoorType key.
>
> In fact the spherical coordinate system used in electromagnetism (r,theta_2,phi_2) is nearly the same as the one you used (r,phi_1,theta_1) except that (1) latitude is measured from the z-axis and from not the xy plane, and (2) the order is r, theta_2, phi_2 and not r, phi_1, theta_1.
>
> This change also implies theta_2=pi/2 -theta_1.

Patrice,
try
it with the pst-3dplot.pro from here
http://voss.homedns.org/packages/pst-3dplot/

you have to set \psset{coorType=5}, then the conversion
of spherical to cartesian is done in your way. Hopefully ...

Herbert
_______________________________________________
PSTricks mailing list
PSTricks at tug.org
http://tug.org/mailman/listinfo/pstricks
archive: http://www.tug.org/pipermail/pstricks/

Important notification: In the context of the creation of the University of Mons, FPMs email address policy is changing from '@fpms.ac.be' to '@umons.ac.be' (or @student.fpms.ac.be to @student.umons.ac.be), please update your contact list accordingly.

Note importante: Dans le cadre de la création de l'Université de Mons, la stratégie d'adresse de courrier électronique de la FPMs change de '@fpms.ac.be' à '@umons.ac.be' (ou @student.fpms.ac.be to @student.umons.ac.be), merci de mettre à jour votre liste d'adresses en conséquence.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pst-3dplotnew.pro
Type: application/octet-stream
Size: 24707 bytes
Desc: pst-3dplotnew.pro
URL: <http://tug.org/pipermail/pstricks/attachments/20091002/df48d960/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pst-3dplotnew.sty
Type: application/octet-stream
Size: 472 bytes
Desc: pst-3dplotnew.sty
URL: <http://tug.org/pipermail/pstricks/attachments/20091002/df48d960/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pst-3dplotnew.tex
Type: application/x-tex
Size: 81367 bytes
Desc: pst-3dplotnew.tex
URL: <http://tug.org/pipermail/pstricks/attachments/20091002/df48d960/attachment-0002.tex>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pm_spherical.tex
Type: application/x-tex
Size: 690 bytes
Desc: pm_spherical.tex
URL: <http://tug.org/pipermail/pstricks/attachments/20091002/df48d960/attachment-0003.tex>


More information about the PSTricks mailing list