Home > atmlab > geodetic > lon_crossing.m

lon_crossing

PURPOSE ^

LON_CROSSING Calculates the point where a longitude is passed

SYNOPSIS ^

function [r,lat,l,za,aa] = lon_crossing(r0,lat0,lon0,za0,aa0,lon,x,y,z,dx,dy,dz)

DESCRIPTION ^

 LON_CROSSING   Calculates the point where a longitude is passed

    Calculates where a 3D geometrical propagation path crosses a specified
    longitude (lon). The propagation path is specified by giving a starting
    point and the line-of-sight at that point. If these data are also at hand
    as Cartesian coordinates (x,y,z,dx,dy,dz), input these as well and the
    calculations will be quicker.

    Allowed solutions have a distance above zero (ie. l>0, note that the
    solution of l=0 is rejected).

 FORMAT [r,lat,l,za,aa] = lon_crossing(r0,lat0,lon0,za0,aa0,lon
                                                          [,x,y,z,dx,dy,dz])
        
 OUT   r     Radius of crossing point.
       lat   Latitude of crossing point.
       l     Distance to crossing point.
       za    Zenith angle at crossing point
       aa    Zenith angle at crossing point.
 IN    r0    Radius of starting point.
       lat   Latitude of starting point.
       lon   Longitude of starting point.
       za    Zenith angle at starting point.
       aa    Azimuth angle at starting point.
       lon   Longitude, for which crossing point shall be determined.
 OPT   x     x-cartesian coordinate of starting point.
       y     y-cartesian coordinate of starting point.
       z     z-cartesian coordinate of starting point.
       dx    x-component of line-of-sight.
       dy    y-component of line-of-sight.
       dz    z-component of line-of-sight.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

lon_crossing.m

SOURCE CODE ^

0001 % LON_CROSSING   Calculates the point where a longitude is passed
0002 %
0003 %    Calculates where a 3D geometrical propagation path crosses a specified
0004 %    longitude (lon). The propagation path is specified by giving a starting
0005 %    point and the line-of-sight at that point. If these data are also at hand
0006 %    as Cartesian coordinates (x,y,z,dx,dy,dz), input these as well and the
0007 %    calculations will be quicker.
0008 %
0009 %    Allowed solutions have a distance above zero (ie. l>0, note that the
0010 %    solution of l=0 is rejected).
0011 %
0012 % FORMAT [r,lat,l,za,aa] = lon_crossing(r0,lat0,lon0,za0,aa0,lon
0013 %                                                          [,x,y,z,dx,dy,dz])
0014 %
0015 % OUT   r     Radius of crossing point.
0016 %       lat   Latitude of crossing point.
0017 %       l     Distance to crossing point.
0018 %       za    Zenith angle at crossing point
0019 %       aa    Zenith angle at crossing point.
0020 % IN    r0    Radius of starting point.
0021 %       lat   Latitude of starting point.
0022 %       lon   Longitude of starting point.
0023 %       za    Zenith angle at starting point.
0024 %       aa    Azimuth angle at starting point.
0025 %       lon   Longitude, for which crossing point shall be determined.
0026 % OPT   x     x-cartesian coordinate of starting point.
0027 %       y     y-cartesian coordinate of starting point.
0028 %       z     z-cartesian coordinate of starting point.
0029 %       dx    x-component of line-of-sight.
0030 %       dy    y-component of line-of-sight.
0031 %       dz    z-component of line-of-sight.
0032 
0033 % 2012-03-01   Created by Patrick Eriksson.
0034 
0035 function [r,lat,l,za,aa] = lon_crossing(r0,lat0,lon0,za0,aa0,lon,x,y,z,dx,dy,dz)
0036 
0037   
0038 if nargin < 7
0039   [x,y,z,dx,dy,dz]=geocentricposlos2cart(r0,lat0,lon0,za0,aa0);
0040 end
0041   
0042 % Catch cases that needs special attention
0043 if lon == lon0  |  za0 == 0  |  za0 == 180  |  aa0 == 0  |  abs(aa0) == 180
0044   l = -1;
0045 else
0046   tanlon = tand( lon );
0047   l      = ( y - x*tanlon ) / ( dx*tanlon - dy );
0048 end
0049 
0050 
0051 if l <= 0 
0052   r   = NaN;
0053   lat = NaN;
0054   l   = NaN;
0055   za  = NaN;
0056   aa  = NaN; 
0057 
0058 else
0059   
0060   if nargout <= 3
0061     zp  = z + dz*l;
0062     r   = sqrt( (x+dx*l)^2 + (y+dy*l)^2 + zp^2 );
0063     lat = asind( zp / r );
0064   else
0065     [r,lat,lon2,za,aa] = cartposlos2geocentric(x+l*dx,y+l*dy,z+l*dz,dx,dy,dz);
0066     assert( abs(lon2-lon) < 1e-6 );
0067   end
0068 end
0069

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005