00001 /* 00002 * Copyright (c) 1999-2003 Bert Kampes 00003 * Copyright (c) 1999-2003 Delft University of Technology, The Netherlands 00004 * 00005 * This file is part of Doris, the Delft o-o radar interferometric software. 00006 * 00007 * Doris program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * Doris is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00020 * 00021 * Publications that contain results produced by the Doris software should 00022 * contain an acknowledgment. (For example: The interferometric processing 00023 * was performed using the freely available Doris software package developed 00024 * by the Delft Institute for Earth-Oriented Space Research (DEOS), Delft 00025 * University of Technology, or include a reference to: Bert Kampes and 00026 * Stefania Usai. \"Doris: The Delft Object-oriented Radar Interferometric 00027 * software.\" In: proceedings 2nd ITC ORS symposium, August 1999. (cdrom)). 00028 * 00029 */ 00030 /**************************************************************** 00031 * $Source: /users/kampes/DEVELOP/DORIS/doris/src/RCS/conversion.hh,v $ 00032 * $Revision: 3.10 $ 00033 * $Date: 2005/03/07 10:38:40 $ 00034 * $Author: kampes $ 00035 * 00036 * Some conversion routines 00037 ****************************************************************/ 00038 00039 00040 #ifndef CONVERSION_H // guard 00041 #define CONVERSION_H 00042 00043 #include "constants.hh" // typedefs 00044 #include "readinput.hh" // input structs 00045 #include "orbitbk.hh" // my orbit class 00046 #include "slcimage.hh" // my slc image class 00047 00048 00049 00050 // ====== Inline ====== 00051 inline real8 deg2rad(real8 x) {return x * PI / 180.0;} 00052 inline real4 deg2rad(real4 x) {return x * PI / 180.0;} 00053 inline real8 rad2deg(real8 x) {return x * 180.0 / PI;} 00054 inline real4 rad2deg(real4 x) {return x * 180.0 / PI;} 00055 00056 00057 // these routines are now members of class slcimage.h 00058 // Bert Kampes, 05-Mar-2005 00059 // ______ Convert line number to azimuth time (1 is first line) ______ 00060 //inline real8 line2ta(real8 line, real8 ta1, real8 prf) 00061 // {return ta1+(line-1.0)/prf;} 00062 // 00063 // ______ Convert pixel number to range time (1 is first pixel) ______ 00064 //inline real8 pix2tr(real8 pixel, real8 tr1, real8 rangesamplingratex2) 00065 // {return tr1+(pixel-1.0)/rangesamplingratex2;} 00066 // 00067 // ______ Convert pixel number to range (1 is first pixel) ______ 00068 //inline real8 pix2range(real8 pixel, real8 tr1, real8 rangesamplingratex2) 00069 // {return SOL*pix2tr(pixel,tr1,rangesamplingratex2);} 00070 // 00071 // ______ Convert azimuth time to line number (1 is first line) ______ 00072 //inline real8 ta2line(real8 azitime, real8 ta1, real8 prf) 00073 // {return 1.0+prf*(azitime-ta1);} 00074 // 00075 // ______ Convert range time to pixel number (1 is first pixel) ______ 00076 //inline real8 tr2pix(real8 rangetime, real8 tr1, real8 rangesamplingratex2) 00077 // {return 1.0+rangesamplingratex2*(rangetime-tr1);} 00078 // 00079 // ______ Convert range pixel to fDC (1 is first pixel) ______ 00080 // Bert Kampes, 03-Mar-2005 00081 //inline real8 pix2fdc(real8 pixel, const slcimage &image) 00082 // {const real8 tau=(pixel-1.0)/(image.rsr2x/2.0);// two-way time 00083 // return image.f_DC_a0+image.f_DC_a1*tau+image.f_DC_a2*tau*tau;} 00084 00085 // ______ polar to xyz ??? ______ 00086 void pol2xyz( 00087 cn &xyz, 00088 real8 lat, 00089 real8 lon, 00090 real8 hei=0.); 00091 00092 // ______ xyz to polar ??? NOT OK ______ 00093 void xyz2pol( 00094 const cn &xyz, 00095 real8 &lat, 00096 real8 &lon, 00097 real8 &hei); 00098 00099 // ______ Convert xyz cartesian coordinates to ellipsoid coordinates ______ 00100 void xyz2ell( 00101 const input_ell &ell, 00102 const cn &xyz, 00103 real8 &phi, 00104 real8 &lambda, 00105 real8 &height); 00106 00107 // ______ Convert xyz cartesian to ellipsoid coordinates phi,lambda (no h) ______ 00108 void xyz2ell( 00109 const input_ell &ell, 00110 const cn &xyz, 00111 real8 &phi, 00112 real8 &lambda); 00113 00114 // ______ Convert ellipsoidal coordinates to xyz cartesian ______ 00115 void ell2xyz( 00116 const input_ell &ell, 00117 cn &xyz, 00118 real8 phi, 00119 real8 lambda, 00120 real8 height); 00121 00122 // ______ Dump tiepoint INFO ______ 00123 void tiepoint( 00124 const input_gen &generalinput, 00125 const slcimage &master, 00126 const slcimage &slave, 00127 orbit &masterorbit, 00128 orbit &slaveorbit, 00129 const input_ell &ellips); 00130 00131 // ====== Inline functions ====== 00132 // ______ For resampling output ci2, this might be slow, make function 00133 // i16 myround(real4) to avoid overhead real() ______ 00134 inline compli16 cr4toci2(complr4 x) 00135 { return compli16((x.real() > 0) ? short(x.real()+.5) : short(x.real()-.5), 00136 (x.imag() > 0) ? short(x.imag()+.5) : short(x.imag()-.5));} 00137 00138 #endif // CONVERSION_H 00139 00140 00141