Changeset 1217 in Sophya for trunk/SophyaLib/SkyMap/localmap.cc


Ignore:
Timestamp:
Oct 3, 2000, 10:19:18 AM (25 years ago)
Author:
ansari
Message:

doc dans les .cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaLib/SkyMap/localmap.cc

    r979 r1217  
    99
    1010
    11 //*****************************************************************************
    12 //++
    13 // Class        LocalMap
    14 //
    15 // include      localmap.h
    16 //
    17 //    A local map of a region of the sky, in cartesian coordinates.
    18 //    It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
    19 //    (x0, y0 might be outside of this local map)
    20 //    default value of (x0, y0) is middle of the map, center of
    21 //    pixel(nx/2, ny/2)
    22 //
    23 //    A local map is a 2 dimensional array, with i as column index and j
    24 //    as row index. The map is supposed to lie on a plan tangent to the
    25 //    celestial sphere in a point whose coordinates are (x0,y0) on the local
    26 //    map and (theta0, phi0) on the sphere. The range of the map is defined
    27 //    by two values of angles covered respectively by all the pixels in
    28 //    x direction and all the pixels in y direction (SetSize()).
    29 //
    30 //    A "reference plane" is considered : this plane is tangent to the
    31 //    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
    32 //    point is the origine of coordinates is of the reference plane. The
    33 //    x-axis is the tangent parallel to the equatorial line and oriented
    34 //    toward the increasing phi's ; the y-axis is parallel to the meridian
    35 //    line and oriented toward the north pole.
    36 //   
    37 //    Internally, a map is first defined within this reference plane and
    38 //    tranported until the point (theta0, phi0) in such a way that both
    39 //    axes are kept parallel to meridian and parallel lines of the sphere.
    40 //    The user can define its own map with axes rotated with respect to
    41 //    reference axes (this rotation is characterized by angle between
    42 //    the local parallel line and the wanted x-axis-- see method
    43 //    SetOrigin(...))
    44 //   
    45 //
    46 
    47 //
    48 //--
    49 //++
    50 //
    51 // Links        Parents
    52 //
    53 //    PixelMap
    54 //   
    55 //--
    56 //++
    57 //
    58 // Links        Childs
    59 //
    60 //     
    61 //--
    62 //++
    63 // Titre        Constructors
    64 //--
    65 //++
     11/*!
     12  \class SOPHYA::LocalMap
     13
     14  A local map has an origin in (theta0, phi0), mapped to pixel(x0, y0)
     15   (x0, y0 might be outside of this local map)
     16 default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2)
     17    A local map is a 2 dimensional array, with i as column index and j
     18    as row index. The map is supposed to lie on a plan tangent to the
     19    celestial sphere in a point whose coordinates are (x0,y0) on the local
     20   map and (theta0, phi0) on the sphere. The range of the map is defined
     21    by two values of angles covered respectively by all the pixels in
     22    x direction and all the pixels in y direction (SetSize()).
     23
     24    A "reference plane" is considered : this plane is tangent to the
     25    celestial sphere in a point with angles theta=Pi/2 and phi=0. This
     26    point is the origine of coordinates is of the reference plane. The
     27    x-axis is the tangent parallel to the equatorial line and oriented
     28    toward the increasing phi's ; the y-axis is parallel to the meridian
     29    line and oriented toward the north pole.
     30   
     31    Internally, a map is first defined within this reference plane and
     32    tranported until the point (theta0, phi0) in such a way that both
     33    axes are kept parallel to meridian and parallel lines of the sphere.
     34    The user can define its own map with axes rotated with respect to
     35    reference axes (this rotation is characterized by angle between
     36    the local parallel line and the wanted x-axis-- see method
     37    SetOrigin(...))
     38*/
    6639template<class T>
    6740LocalMap<T>::LocalMap() :  pixels_()
    68 //
    69 //     
    70 //--
    7141{
    7242  InitNul();
    73   //  pixels_.Reset();
    74 }
    75 
    76 //++
     43}
     44
    7745template<class T>
    7846LocalMap<T>::LocalMap(int_4 nx, int_4 ny) : nSzX_(nx), nSzY_(ny)
    79 //
    80 //   
    81 //--
    8247{
    8348  InitNul();
     
    8752}
    8853
    89 //++
    9054template<class T>
    9155LocalMap<T>::LocalMap(const LocalMap<T>& lm, bool share)
    9256  : pixels_(lm.pixels_, share)
    93 
    94 //
    95 //    copy constructor
    96 //--
    9757{
    9858
     
    10161}
    10262
    103 //++
    10463template<class T>
    10564LocalMap<T>::LocalMap(const LocalMap<T>& lm)
    10665  : pixels_(lm.pixels_)
    10766
    108 //
    109 //    copy constructor
    110 //--
    11167{
    11268
     
    11571}
    11672
    117 //++
    118 // Titre        Destructor
    119 //--
    120 //++
    12173template<class T>
    12274LocalMap<T>::~LocalMap()
    123 //
    124 //--
    12575{
    12676  InitNul();
     
    12979
    13080
    131 //++
    132 // Titre        Public Methods
    133 //--
    134 
    135 //++
     81/*!  \fn void SOPHYA::LocalMap::ReSize(int_4 nx, int_4 ny)
     82
     83  Resize storage area for pixels
     84*/
    13685template<class T>
    13786void LocalMap<T>::ReSize(int_4 nx, int_4 ny)
    138 //
    139 //    Resize storage area for pixels
    140 //--
    14187{
    14288  InitNul();
     
    188134
    189135
    190 //++
     136/*! \fn int_4 SOPHYA::LocalMap::NbPixels() const
     137
     138   \return number of pixels
     139*/
    191140template<class T>
    192141int_4 LocalMap<T>::NbPixels() const
    193 //
    194 //    Return number of pixels
    195 //--
    196142{
    197143  return(nPix_);
    198144}
    199145
    200 //++
     146/*! \fn T& SOPHYA::LocalMap::PixVal(int_4 k)
     147
     148   \return value of pixel with index k
     149*/
    201150template<class T>
    202151T& LocalMap<T>::PixVal(int_4 k)
    203 //
    204 //    Return value of pixel with index k
    205 //--
    206152{
    207153  if((k < 0) || (k >= nPix_))
    208154    {
    209155      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    210       //  THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    211156      THROW(rangeCheckErr);
    212       //throw "LocalMap::PIxVal Pixel index out of range";
    213157    }
    214158  return(pixels_(k));
    215159}
    216160
    217 //++
    218 
     161/*! \fn T const& SOPHYA::LocalMap::PixVal(int_4 k) const
     162  const version of previous method
     163*/
    219164template<class T>
    220165T const& LocalMap<T>::PixVal(int_4 k) const
    221 //
    222 //   const version of previous method
    223 //--
    224166{
    225167  if((k < 0) || (k >= nPix_))
    226168    {
    227169      cout << " LocalMap::PIxVal : exceptions  a mettre en place" <<endl;
    228       //    THROW(out_of_range("LocalMap::PIxVal Pixel index out of range"));
    229      
    230170      throw "LocalMap::PIxVal Pixel index out of range";
    231171    }
     
    233173}
    234174
     175/*! \fn bool SOPHYA::LocalMap::ContainsSph(double theta, double phi) const
     176
     177 \return true if teta,phi in map 
     178*/
    235179template<class T>
    236180bool LocalMap<T>::ContainsSph(double theta, double phi) const
     
    240184}
    241185
    242 //++
     186/*!  \fn int_4 SOPHYA::LocalMap::PixIndexSph(double theta,double phi) const
     187
     188  \return index of the pixel with spherical coordinates (theta,phi)
     189*/
    243190template<class T>
    244191int_4 LocalMap<T>::PixIndexSph(double theta,double phi) const
    245 //
    246 //    Return index of the pixel with spherical coordinates (theta,phi)
    247 //--
    248192{
    249193  int_4 i,j;
     
    284228}
    285229
    286 //++
     230/*! \fn void SOPHYA::LocalMap::PixThetaPhi(int_4 k,double& theta,double& phi) const
     231
     232   \return (theta, phi) coordinates of pixel with index k
     233*/
    287234template<class T>
    288235void LocalMap<T>::PixThetaPhi(int_4 k,double& theta,double& phi) const
    289 //
    290 //    Return (theta, phi) coordinates of pixel with index k
    291 //--
    292236{
    293237  if(!(originFlag_) || !(extensFlag_))
     
    311255}
    312256
     257/*! \fn T SOPHYA::LocalMap::SetPixels(T v)
     258
     259Set all pixels to value v
     260*/
    313261template <class T>
    314262T LocalMap<T>::SetPixels(T v)
     
    318266}
    319267 
    320 //++
     268/*! \fn double SOPHYA::LocalMap::PixSolAngle(int_4 k) const
     269
     270   Pixel Solid angle  (steradians)
     271
     272    All the pixels have not necessarly the same size in (theta, phi)
     273    because of the projection scheme which is not yet fixed.
     274*/ 
    321275template<class T>
    322276double LocalMap<T>::PixSolAngle(int_4 k) const
    323 //
    324 //    Pixel Solid angle  (steradians)
    325 //    All the pixels have not necessarly the same size in (theta, phi)
    326 //    because of the projection scheme which is not yet fixed.   
    327 //--
    328277{
    329278  int_4 i,j;
     
    355304}
    356305
    357 //++
     306/*! \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,double angle)
     307
     308   set the referential of the map (angles in degrees)
     309
     310    (default x0=siz_x/2,  y0=siz_y/2)
     311*/
    358312template<class T>
    359313void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle)
    360 //
    361 //    set the referential of the map (angles in degrees)
    362 //    (default x0=siz_x/2,  y0=siz_y/2)
    363 //--
    364314{
    365315  theta0_= theta0;
     
    374324}
    375325 
    376 //++
     326/*!  \fn void SOPHYA::LocalMap::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
     327
     328  set the referential of the map (angles in degrees)
     329*/
    377330template<class T>
    378331void LocalMap<T>::SetOrigin(double theta0,double phi0,int_4 x0,int_4 y0,double angle)
    379 //
    380 //    set the referential of the map (angles in degrees)
    381 //--
    382332{
    383333  theta0_= theta0;
     
    392342}
    393343
    394 //++
     344/*! \fn void SOPHYA::LocalMap::SetSize(double angleX,double angleY)
     345
     346   angle range of tthe map (angles in degrees)
     347*/
    395348template<class T>
    396349void LocalMap<T>::SetSize(double angleX,double angleY)
    397 //
    398 //    angle range of tthe map (angles in degrees)
    399 //--
    400350{
    401351  angleX_= angleX;
     
    410360}
    411361
    412 //++
     362/*! \fn void SOPHYA::LocalMap::Project(SphericalMap<T>& sphere) const
     363
     364Projection to a spherical map
     365*/
    413366template<class T>
    414367void LocalMap<T>::Project(SphericalMap<T>& sphere) const
    415 //
    416 //    Projection to a spherical map   
    417 //--
    418368{
    419369  for(int m = 0; m < nPix_; m++)
     
    440390}
    441391
    442 //++
     392
     393/*!   \fn void SOPHYA::LocalMap::Getij(int_4 k,int_4& i,int_4& j) const
     394
     395 \return 2 indices corresponding to the pixel number k
     396*/
    443397template<class T>
    444398void LocalMap<T>::Getij(int_4 k,int_4& i,int_4& j) const
    445 //
    446 //    Return 2 indices corresponding to the pixel number k
    447 //--
    448399{
    449400  i= (k+1)%nSzX_-1;
     
    452403}
    453404
    454 //++
     405/*! \fn void  SOPHYA::LocalMap::ReferenceToUser(double& theta,double& phi) const
     406
     407   Transform a pair of coordinates (theta, phi) given in
     408    reference coordinates into map coordinates
     409*/
    455410template<class T>
    456411void  LocalMap<T>::ReferenceToUser(double& theta,double& phi) const
    457 //
    458 //    Transform a pair of coordinates (theta, phi) given in
    459 //    reference coordinates into map coordinates
    460 //--     
    461412{
    462413  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    491442}
    492443
    493 //++
     444/*!  \fn void  SOPHYA::LocalMap::UserToReference(double& theta,double& phi) const
     445
     446  Transform a pair of coordinates (theta, phi) given in
     447   map coordinates into reference coordinates
     448*/
    494449template<class T>
    495450void  LocalMap<T>::UserToReference(double& theta,double& phi) const
    496 //
    497 //    Transform a pair of coordinates (theta, phi) given in
    498 //    map coordinates into reference coordinates
    499 //--     
    500451{
    501452  if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi)
     
    534485}
    535486
    536 //++
     487/*! \fn void SOPHYA::LocalMap::PixProjToAngle(double x,double y,double& theta,double& phi) const
     488
     489  Given coordinates in pixel units in the REFERENCE PLANE, return
     490    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
     491*/
    537492template<class T>
    538493void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const
    539 //
    540 // 
    541 //    Given coordinates in pixel units in the REFERENCE PLANE, return
    542 //    (theta, phi) in "absolute" referential theta=pi/2 ,phi=0.   
    543 //--
    544494{
    545495  theta= Pi*0.5-atan(2.*y*tgAngleY_/(double)nSzY_);
     
    548498}
    549499
    550 //++
     500/*! \fn void SOPHYA::LocalMap::AngleProjToPix(double theta,double phi,double& x,double& y) const
     501
     502   Given coordinates  (theta, phi) in "absolute" referential
     503    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
     504*/
    551505template<class T>
    552506void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const
    553 //
    554 //    Given coordinates  (theta, phi) in "absolute" referential
    555 //    theta=pi/2 ,phi=0  return pixel indices  (i,j) in the REFERENCE PLANE.
    556 //--
    557507{
    558508  if(phi >= Pi) phi-= DeuxPi;
Note: See TracChangeset for help on using the changeset viewer.