NASA - Jet Propulsion Laboratory
    + View the NASA Portal
Search JPL
Jet Propulsion Laboratory Home Earth Solar System Stars & Galaxies Technology
Introduction Background Software Links

trafos.h

Go to the documentation of this file.
00001 /*
00002  *  This file is part of Healpix_cxx.
00003  *
00004  *  Healpix_cxx is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  Healpix_cxx is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with Healpix_cxx; if not, write to the Free Software
00016  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00017  *
00018  *  For more information about HEALPix, see http://healpix.jpl.nasa.gov
00019  */
00020 
00021 /*
00022  *  Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik
00023  *  and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt
00024  *  (DLR).
00025  */
00026 
00027 /*! \file trafos.h
00028  *  Celestial coordinate transformations.
00029  *
00030  *  Copyright (C) 2005 Max-Planck-Society
00031  * \author Martin Reinecke
00032  */
00033 #ifndef PLANCK_TRAFOS_H
00034 #define PLANCK_TRAFOS_H
00035 
00036 #include "vec3.h"
00037 #include "pointing.h"
00038 #include "rotmatrix.h"
00039 #include "cxxutils.h"
00040 #include "geom_utils.h"
00041 
00042 typedef enum { Ecliptic, Equatorial, Galactic } coordsys;
00043 
00044 /*! Class for celestial coordinate transformations. */
00045 class Trafo
00046   {
00047   private:
00048     rotmatrix mat;
00049 
00050     static vec3 xcc_dp_precess (const vec3 &iv, double iepoch, double oepoch);
00051     static double get_epsilon (double epoch);
00052     static vec3 xcc_dp_e_to_q (const vec3 &iv, double epoch);
00053     static vec3 xcc_dp_q_to_e (const vec3 &iv, double epoch);
00054     static vec3 xcc_dp_g_to_e (const vec3 &iv, double epoch);
00055     static vec3 xcc_dp_e_to_g (const vec3 &iv, double epoch);
00056     static vec3 xcc_v_convert(const vec3 &iv, double iepoch, double oepoch,
00057       coordsys isys,coordsys osys);
00058     static void coordsys2matrix (double iepoch, double oepoch, coordsys isys,
00059       coordsys osys, rotmatrix &matrix);
00060 
00061   public:
00062     /*! Creates a \a Trafo for transformation from \a iepoch and \a isys
00063         to \a oepoch and \a osys. */
00064     Trafo (double iepoch, double oepoch, coordsys isys, coordsys osys)
00065       { coordsys2matrix (iepoch, oepoch, isys, osys, mat); }
00066 
00067     /*! Transforms the vector \a vec and returns the result. */
00068     vec3 operator() (const vec3 &vec) const
00069       { return mat.Transform(vec); }
00070 
00071     /*! Transforms the pointing \a ptg and returns the result. */
00072     pointing operator() (const pointing &ptg) const
00073       { return pointing(operator()(vec3(ptg))); }
00074 
00075     /*! Transforms the pointing \a ptg and returns it in \a newptg.
00076         On exit, \a delta_psi holds the change in orientation. */
00077     void rotatefull (const pointing &ptg, pointing &newptg,
00078       double &delta_psi) const
00079       {
00080       vec3 vec (ptg);
00081       vec3 east (-vec.y,vec.x,0.);
00082       vec3 newvec = operator()(vec);
00083       vec3 neweast = operator()(east);
00084       delta_psi = orientation(newvec,neweast)+halfpi;
00085       newptg = newvec;
00086       }
00087 
00088     /*! Transforms the vector \a vec and returns it in \a newvec.
00089         On exit, \a delta_psi holds the change in orientation. */
00090     void rotatefull (const vec3 &vec, vec3 &newvec, double &delta_psi) const
00091       {
00092       vec3 east (-vec.y,vec.x,0.);
00093       newvec = operator()(vec);
00094       vec3 neweast = operator()(east);
00095       delta_psi = orientation(newvec,neweast)+halfpi;
00096       }
00097 
00098     /*! Returns the internally used rotation matrix. */
00099     const rotmatrix &Matrix() const
00100       { return mat; }
00101   };
00102 
00103 #endif

Generated on Fri Jun 18 16:12:29 2010 for LevelS C++ support library
Privacy / Copyright
FIRST GOV Contact: NASA Home Page Site Manager:
Webmaster:

CL 03-2650