[pstricks] arctan
Herbert Voss
Herbert.Voss at FU-Berlin.DE
Tue Aug 30 12:47:12 CEST 2011
Am 30.08.2011 12:32, schrieb Christoph Bersch:
> On 30.08.2011 11:47, Doris Behrendt wrote:
>>
>> in the following minimal example, I want to compute the arctan of
>> 0.75, which is approximately 37 degrees; but it doesn't work:
>>
>> \pstThreeDDot[SphericalCoor](20,180,0.75 atan)%does not work
>
> atan takes two arguments:
> \pstThreeDDot[SphericalCoor](20,180,0.75 1 atan)
>
> With these two also the correct quadrant is selected (compare 1 1 atan
> versus -1 -1 atan).
\pstThreeDDot[SphericalCoor](20,180,0.75 ATAN1)
is also possible
> For a reference of all Postscript operators see Chapter. 8 in
> <http://www.adobe.com/products/postscript/pdfs/PLRM.pdf>.
or http://pstricks.tug.org/PS/quick-ref.PS.pdf
This is what pstricks.pro also defines:
/Sqrt { dup 0 lt { pop 0 } { sqrt } ifelse } def % return 0 for
negative arguments
/Atan { /atan load stopped { pop pop 0 } if } def % return 0 if atan not
known
/ATAN1 {neg -1 atan 180 sub } def % atan(x) (only one parameter)
/Div { dup 0 eq { pop } { div } ifelse } def % control the division
/tan { dup cos abs 1.e-10 lt
{ pop 1.e10 } % return 1.e10 as infinit
{ dup sin exch cos div } ifelse % default sin/cos
} def
/Tan { dup sin exch cos Div } def % sin(x)/cos(x) x in degrees
/Acos {dup dup mul neg 1 add dup 0 lt { % arc cos, returns 0 when
negative root
pop pop 0 }{ sqrt exch atan} ifelse } def
/NET { neg exch neg exch T } def % change coordinate system to
the negative one
/Pyth { dup mul exch dup mul add sqrt } def % Pythagoras, expects 2
parameter
/Pyth2 { % Pythagoras, xA yA xB yB
3 -1 roll % xA xB yB yA
sub % xA xB yB-yA
3 1 roll % yB-yA xA xB
sub % yB-yA xA-xB
Pyth } def
/PtoC { 2 copy cos mul 3 1 roll sin mul } def % Polar to Cartesian
/Rand { rand 4294967295 div } def % a real random number
%----------------- hv added 20050516 ---------------
/PiDiv2 1.57079632680 def
/Pi 3.14159265359 def
/TwoPi 6.28318530718 def
/Euler 2.71828182846 def
%/e Euler bind def
%
/RadtoDeg { 180 mul Pi div } bind def % convert from radian to degrees
/DegtoRad { Pi mul 180 div } bind def % viceversa
Herbert
More information about the PSTricks
mailing list