; docformat = 'rst' ;+ ;Convert a given location relative to a sphere in lat, lon, and, distance, ;into an equivalent cartesian vector. Grids should be input with ;[row, column] form rather than the IDL standard [column, row] form. ; ; :Examples: ; xyz_vec = llr_to_xyz(llr_vec) ;- ;+ ; :Params: ; llr : in, required, type=vector of double or array of vector ; A grid of vectors. First element is geocentric latitude in radians, ; second is longitude in radians, third is distance from the center of ; the sphere. ; ; :Keywords: ; sid : in, required, type=boolean ; Greenwich Mean Sidereal time, in radians. If set apropriately, ; returned vector will be in ECI rather than ECEF. Defaults to zero, ; giving ECEF. ; ; :Returns: ; Returns a grid of xyz vectors, in the same length as distance input. ;- function llr_to_xyz,llr,sid=sid if n_elements(sid) eq 0 then sid=0 resolve_grid,llr,x=lat,y=lon,z=r lon+=sid x = r * cos(lat) * cos(lon); y = r * cos(lat) * sin(lon); z = r * sin(lat); return,compose_grid(x,y,z); end