| 1 |
/* |
| 2 |
* This file is part of libcxxsupport. |
| 3 |
* |
| 4 |
* libcxxsupport is free software; you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License as published by |
| 6 |
* the Free Software Foundation; either version 2 of the License, or |
| 7 |
* (at your option) any later version. |
| 8 |
* |
| 9 |
* libcxxsupport is distributed in the hope that it will be useful, |
| 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
* GNU General Public License for more details. |
| 13 |
* |
| 14 |
* You should have received a copy of the GNU General Public License |
| 15 |
* along with libcxxsupport; if not, write to the Free Software |
| 16 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 |
*/ |
| 18 |
|
| 19 |
/* |
| 20 |
* libcxxsupport is being developed at the Max-Planck-Institut fuer Astrophysik |
| 21 |
* and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt |
| 22 |
* (DLR). |
| 23 |
*/ |
| 24 |
|
| 25 |
/*! \file trafos.h |
| 26 |
* Celestial coordinate transformations. |
| 27 |
* |
| 28 |
* Copyright (C) 2005-2011 Max-Planck-Society |
| 29 |
* \author Martin Reinecke |
| 30 |
*/ |
| 31 |
#ifndef PLANCK_TRAFOS_H |
| 32 |
#define PLANCK_TRAFOS_H |
| 33 |
|
| 34 |
#include "vec3.h" |
| 35 |
#include "pointing.h" |
| 36 |
#include "rotmatrix.h" |
| 37 |
|
| 38 |
enum coordsys { Ecliptic, Equatorial, Galactic }; |
| 39 |
|
| 40 |
/*! Class for celestial coordinate transformations. */ |
| 41 |
class Trafo |
| 42 |
{ |
| 43 |
private: |
| 44 |
rotmatrix mat; |
| 45 |
|
| 46 |
static vec3 xcc_dp_precess (const vec3 &iv, double iepoch, double oepoch); |
| 47 |
static double get_epsilon (double epoch); |
| 48 |
static vec3 xcc_dp_e_to_q (const vec3 &iv, double epoch); |
| 49 |
static vec3 xcc_dp_q_to_e (const vec3 &iv, double epoch); |
| 50 |
static vec3 xcc_dp_g_to_e (const vec3 &iv, double epoch); |
| 51 |
static vec3 xcc_dp_e_to_g (const vec3 &iv, double epoch); |
| 52 |
static vec3 xcc_v_convert(const vec3 &iv, double iepoch, double oepoch, |
| 53 |
coordsys isys,coordsys osys); |
| 54 |
static void coordsys2matrix (double iepoch, double oepoch, coordsys isys, |
| 55 |
coordsys osys, rotmatrix &matrix); |
| 56 |
|
| 57 |
public: |
| 58 |
/*! Creates a \a Trafo for transformation from \a iepoch and \a isys |
| 59 |
to \a oepoch and \a osys. */ |
| 60 |
Trafo (double iepoch, double oepoch, coordsys isys, coordsys osys); |
| 61 |
|
| 62 |
/*! Transforms the vector \a vec and returns the result. */ |
| 63 |
vec3 operator() (const vec3 &vec) const |
| 64 |
{ return mat.Transform(vec); } |
| 65 |
|
| 66 |
/*! Transforms the pointing \a ptg and returns the result. */ |
| 67 |
pointing operator() (const pointing &ptg) const; |
| 68 |
|
| 69 |
/*! Transforms the pointing \a ptg and returns it in \a newptg. |
| 70 |
On exit, \a delta_psi holds the change in orientation. */ |
| 71 |
void rotatefull (const pointing &ptg, pointing &newptg, |
| 72 |
double &delta_psi) const; |
| 73 |
|
| 74 |
/*! Transforms the pointing \a ptg and adjusts \a psi accordingly. */ |
| 75 |
void rotatefull (pointing &ptg, double &psi) const; |
| 76 |
|
| 77 |
/*! Transforms the vector \a vec and returns it in \a newvec. |
| 78 |
On exit, \a delta_psi holds the change in orientation. */ |
| 79 |
void rotatefull (const vec3 &vec, vec3 &newvec, double &delta_psi) const; |
| 80 |
|
| 81 |
/*! Transforms the vector \a vec and adjusts \a psi accordingly. */ |
| 82 |
void rotatefull (vec3 &vec, double &psi) const; |
| 83 |
|
| 84 |
/*! Returns the internally used rotation matrix. */ |
| 85 |
const rotmatrix &Matrix() const |
| 86 |
{ return mat; } |
| 87 |
}; |
| 88 |
|
| 89 |
#endif |