Les sources de Syracuse carpol.pps

%% syntaxe : x y carpol --> r alpha
/carpol {       % transforme des coordonnees cartesiennes en polaires
   2 copy	% x, y, x, y
   dup mul exch 
   dup mul add	sqrt % x, y, r
   3 copy div	% x, y, r, x, sin (alpha)
   3 1 roll	% x, y, sin (alpha), r, x, 
   2 copy	% x, y, sin (alpha), r, x, r, x
   exch div	% x, y, sin (alpha), r, x, cos (alpha)
   4 -1 roll	% x, y, r, x, cos (alpha), sin (alpha)
   atan		% x, y, r, x, alpha mod 180
   exch pop	% x, y, r, alpha mod 180
   %% seul pbm : quand x*y<0
   4 -1 roll   % y, r, alpha mod 180, x
   4 -1 roll 
   mul
   0 le
      {180 sub}
   if
} def


Page composée par petitParseur[ps2html] le mardi 14 octobre 2008.