v_atan2sc
PURPOSE 
V_ATAN2SC sin and cosine of atan(y/x) [S,C,R,T]=(Y,X)
SYNOPSIS 
function [s,c,r,t]=v_atan2sc(y,x)
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
This function is called by:
- v_rotpl2ro V_ROTPL2RO find matrix to rotate in the plane containing u and v r=[u,v,t]
- v_rotro2eu V_ROTRO2EU converts a 3x3 rotation matrix into the corresponding euler angles
- v_rotro2pl V_ROTRO2PL find the plane and rotation angle of a rotation matrix [u,v,t]=r
SOURCE CODE 
0001 function [s,c,r,t]=v_atan2sc(y,x)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035 sz=size(y);
0036 s=zeros(sz);
0037 c=NaN(sz);
0038 r=zeros(sz);
0039 t=NaN(sz);
0040 m=y==0;
0041 if any(m(:))
0042 t(m)=(x(m)<0);
0043 c(m)=1-2*t(m);
0044 r(m)=abs(x(m));
0045 t(m)=t(m)*pi;
0046 end
0047 m=abs(y)>abs(x) & isnan(c);
0048 if any(m(:))
0049 q = x(m)./y(m);
0050 u = sqrt(1+q.^2).*sign(y(m));
0051 s(m) = 1./u;
0052 c(m) = s(m).*q;
0053 r(m) = y(m).*u;
0054 end
0055 m=isnan(c);
0056 if any(m(:))
0057 q = y(m)./x(m);
0058 u = sqrt(1+q.^2).*sign(x(m));
0059 c(m) = 1./u;
0060 s(m) = c(m).*q;
0061 r(m) = x(m).*u;
0062 end
0063 m=isnan(t);
0064 if nargout>3 && any(m(:))
0065 t(m)=atan2(s(m),c(m));
0066 end
Generated by m2html © 2003