Changeset 568 in Sophya for trunk/SophyaLib/Samba/localmap.cc
- Timestamp:
- Nov 10, 1999, 3:17:10 PM (26 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaLib/Samba/localmap.cc
r518 r568 40 40 // pixel(nx/2, ny/2) 41 41 // 42 // la carte est consideree comme un tableau a deux indices i et j, i etant 43 // indice de colonne et j indice de ligne. La carte est supposee resider 44 // dans un plan tangent, dont le point de tangence est repere (x0,y0) dans 45 // la carte et (theta0, phi0) sur la sphere celeste. L'extension de la 46 // carte est definie par les valeurs de deux angles couverts respectivement 47 // par la totalite des pixels en x de la carte et la totalite des pixels 48 // en y. (SetSize()). 49 // On considere un "plan de reference" : plan tangent a la sphere celeste 50 // aux angles theta=Pi/2 et phi=0. Dans ce plan L'origine des coordonnees 51 // est le point de tangence. L'axe Ox est la tangente parallele a 52 // l'equateur, dirige vers les phi croissants, l'axe Oy est parallele 53 // au meridien, dirige vers le pole nord. 54 // De maniere interne a la classe une carte est definie dans ce plan de 55 // reference et transportee jusqu'au point (theta0, phi0) de sorte que 56 // les axes restent paralleles aux meridiens et paralleles. L'utilisateur 57 // peut definir sa carte selon un repere en rotation par rapport au repere 58 // de reference (par l'angle entre le parallele et l'axe Ox souhaite -- 59 // methode SetOrigin(...)) 42 // A local map is a 2 dimensional array, with i as column index and j 43 // as row index. The map is supposed to lie on a plan tangent to the 44 // celestial sphere in a point whose coordinates are (x0,y0) on the local 45 // map and (theta0, phi0) on the sphere. The range of the map is defined 46 // by two values of angles covered respectively by all the pixels in 47 // x direction and all the pixels in y direction (SetSize()). 48 // 49 // A "reference plane" is considered : this plane is tangent to the 50 // celestial sphere in a point with angles theta=Pi/2 and phi=0. This 51 // point is the origine of coordinates is of the reference plane. The 52 // x-axis is the tangent parallel to the equatorial line and oriented 53 // toward the increasing phi's ; the y-axis is parallel to the meridian 54 // line and oriented toward the north pole. 55 // 56 // Internally, a map is first defined within this reference plane and 57 // tranported until the point (theta0, phi0) in such a way that both 58 // axes are kept parallel to meridian and parallel lines of the sphere. 59 // The user can define its own map with axes rotated with respect to 60 // reference axes (this rotation is characterized by angle between 61 // the local parallel line and the wanted x-axis-- see method 62 // SetOrigin(...)) 63 // 64 // 60 65 61 66 // … … 70 75 //++ 71 76 // 72 // Links Descendants77 // Links Childs 73 78 // 74 79 // 75 80 //-- 76 81 //++ 77 // Titre Construct eurs82 // Titre Constructors 78 83 //-- 79 84 //++ … … 81 86 LocalMap<T>::LocalMap() 82 87 // 83 // Constructeur par defaut88 // 84 89 //-- 85 90 { … … 91 96 LocalMap<T>::LocalMap(int nx, int ny) : nSzX_(nx), nSzY_(ny) 92 97 // 93 // Constructeur98 // 94 99 //-- 95 100 { … … 104 109 LocalMap<T>::LocalMap(const LocalMap<T>& lm) 105 110 // 106 // Constructeur de recopie111 // copy constructor 107 112 //-- 108 113 { … … 130 135 131 136 //++ 137 // Titre Destructor 138 //-- 139 //++ 132 140 template<class T> 133 141 LocalMap<T>::~LocalMap() 134 142 // 135 // Destructeur136 143 //-- 137 144 { … … 139 146 } 140 147 141 //++ 142 template<class T> 143 void LocalMap<T>::InitNul() 144 // 145 // Initialise à zéro certaines variables internes 146 //-- 147 { 148 originFlag_= false; 149 extensFlag_= false; 150 cos_angle_= 1.0; 151 sin_angle_= 0.0; 152 pixels_.Reset(); 153 } 148 149 150 //++ 151 // Titre Public Methods 152 //-- 154 153 155 154 //++ … … 157 156 void LocalMap<T>::ReSize(int nx, int ny) 158 157 // 159 // Redimensionne l'espace de stokage des pixels158 // Resize storage area for pixels 160 159 //-- 161 160 { … … 169 168 170 169 //++ 171 // Titre Methodes172 //--173 174 175 //++176 170 template<class T> 177 171 int LocalMap<T>::NbPixels() const 178 172 // 179 // Ret ourne le nombre de pixels du découpage173 // Return number of pixels 180 174 //-- 181 175 { … … 187 181 T& LocalMap<T>::PixVal(int k) 188 182 // 189 // Ret ourne la valeur du contenu du pixel d'indicek183 // Return value of pixel with index k 190 184 //-- 191 185 { … … 205 199 T const& LocalMap<T>::PixVal(int k) const 206 200 // 207 // Retourne la valeur du contenu du pixel d'indice k201 // const version of previous method 208 202 //-- 209 203 { … … 220 214 //++ 221 215 template<class T> 222 bool LocalMap<T>::ContainsSph(double theta, double phi) const223 //--224 {225 return(true); // $CHECK$ A MODIFIER - Reza 26/10/99226 }227 228 //++229 template<class T>230 216 int LocalMap<T>::PixIndexSph(double theta,double phi) const 231 217 // 232 // Retourne l'indice du pixel vers lequel pointe une direction définie par 233 // ses coordonnées sphériques 218 // Return index of the pixel with spherical coordinates (theta,phi) 234 219 //-- 235 220 { … … 275 260 void LocalMap<T>::PixThetaPhi(int k,double& theta,double& phi) const 276 261 // 277 // Ret ourne les coordonnées (theta,phi) du milieu du pixel d'indicek262 // Return (theta, phi) coordinates of pixel with index k 278 263 //-- 279 264 { … … 302 287 double LocalMap<T>::PixSolAngle(int k) const 303 288 // 304 // Pixel Solid angle (steradians)305 // All the pixels have not necessarly the same size in (theta, phi)306 // because of the projection scheme which is not yet fixed.289 // Pixel Solid angle (steradians) 290 // All the pixels have not necessarly the same size in (theta, phi) 291 // because of the projection scheme which is not yet fixed. 307 292 //-- 308 293 { … … 339 324 void LocalMap<T>::SetOrigin(double theta0,double phi0,double angle) 340 325 // 341 // Fixe la repere de reference ( angles en degres) 326 // set the referential of the map (angles in degrees) 327 // (default x0=siz_x/2, y0=siz_y/2) 342 328 //-- 343 329 { … … 357 343 void LocalMap<T>::SetOrigin(double theta0,double phi0,int x0,int y0,double angle) 358 344 // 359 // Fixe le repere de reference (angles en degres)345 // set the referential of the map (angles in degrees) 360 346 //-- 361 347 { … … 375 361 void LocalMap<T>::SetSize(double angleX,double angleY) 376 362 // 377 // Fixe l'extension de la carte (angles en degres)363 // angle range of tthe map (angles in degrees) 378 364 //-- 379 365 { … … 393 379 void LocalMap<T>::Project(SphericalMap<T>& sphere) const 394 380 // 395 // Projection tospherical map381 // Projection to a spherical map 396 382 //-- 397 383 { … … 404 390 } 405 391 } 392 // Titre Private Methods 393 //++ 394 template<class T> 395 void LocalMap<T>::InitNul() 396 // 397 // set some attributes to zero 398 //-- 399 { 400 originFlag_= false; 401 extensFlag_= false; 402 cos_angle_= 1.0; 403 sin_angle_= 0.0; 404 pixels_.Reset(); 405 } 406 406 407 407 //++ … … 409 409 void LocalMap<T>::Getij(int k,int& i,int& j) const 410 410 // 411 // Return 2 indices corresponding to the pixel number k 411 412 //-- 412 413 { … … 420 421 void LocalMap<T>::ReferenceToUser(double& theta,double& phi) const 421 422 // 422 // -- 423 // Transform a pair of coordinates (theta, phi) given in 424 // reference coordinates into map coordinates 425 //-- 423 426 { 424 427 if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi) … … 457 460 void LocalMap<T>::UserToReference(double& theta,double& phi) const 458 461 // 459 // -- 462 // Transform a pair of coordinates (theta, phi) given in 463 // map coordinates into reference coordinates 464 //-- 460 465 { 461 466 if(theta > Pi || theta < 0. || phi < 0. || phi >= 2*Pi) … … 498 503 void LocalMap<T>::PixProjToAngle(double x,double y,double& theta,double& phi) const 499 504 // 500 // (x,y) representent les coordonnees en unites de pixels d'un point DANS LE PLAN DE REFERENCE. 501 // On recupere (theta,phi) par rapport au repere "absolu" theta=pi/2 et phi=0. 505 // 506 // Given coordinates in pixel units in the REFERENCE PLANE, return 507 // (theta, phi) in "absolute" referential theta=pi/2 ,phi=0. 502 508 //-- 503 509 { … … 511 517 void LocalMap<T>::AngleProjToPix(double theta,double phi,double& x,double& y) const 512 518 // 513 // (theta,phi) par rapport au repere "absolu" theta=pi/2,phi=0. On recupere514 // (i,j) DANS LE PLAN DE REFERENCE.519 // Given coordinates (theta, phi) in "absolute" referential 520 // theta=pi/2 ,phi=0 return pixel indices (i,j) in the REFERENCE PLANE. 515 521 //-- 516 522 { … … 542 548 os << endl; 543 549 } 550 //++ 551 // Titre class FIO_LocalMap 552 // Delegated objects for persitance management 553 //-- 544 554 545 555 //******************************************************************* … … 548 558 //******************************************************************* 549 559 560 //++ 550 561 template <class T> 551 562 FIO_LocalMap<T>::FIO_LocalMap() 563 // 564 //-- 552 565 { 553 566 dobj= new LocalMap<T>; 554 567 ownobj= true; 555 568 } 556 569 //++ 557 570 template <class T> 558 571 FIO_LocalMap<T>::FIO_LocalMap(string const& filename) 572 // 573 //-- 559 574 { 560 575 dobj= new LocalMap<T>; … … 563 578 } 564 579 580 //++ 565 581 template <class T> 566 582 FIO_LocalMap<T>::FIO_LocalMap(const LocalMap<T>& obj) 583 // 584 //-- 567 585 { 568 586 dobj= new LocalMap<T>(obj); … … 577 595 } 578 596 597 //++ 579 598 template <class T> 580 599 FIO_LocalMap<T>::~FIO_LocalMap() 600 // 601 //-- 581 602 { 582 603 if (ownobj && dobj) delete dobj; 583 604 } 584 605 //++ 585 606 template <class T> 586 607 AnyDataObj* FIO_LocalMap<T>::DataObj() 608 // 609 //-- 587 610 { 588 611 return(dobj); 589 612 } 590 613 614 //++ 591 615 template <class T> 592 616 void FIO_LocalMap<T>::ReadSelf(PInPersist& is) 593 { 594 cout << " FIO_LocalMap:: ReadSelf " << endl; 617 // 618 //-- 619 { 595 620 596 621 if(dobj == NULL) … … 598 623 dobj= new LocalMap<T>; 599 624 } 600 601 // Let's Read the SphereCoordSys object -- ATTENTIOn - $CHECK$602 SphereCoordSys* cs = dynamic_cast<SphereCoordSys*>(is.ReadObject());603 dobj->SetCoordSys(cs);604 625 605 626 // Pour savoir s'il y avait un DVList Info associe … … 652 673 } 653 674 675 //++ 654 676 template <class T> 655 677 void FIO_LocalMap<T>::WriteSelf(POutPersist& os) const 656 { 657 cout << " FIO_LocalMap:: WriteSelf " << endl; 658 678 // 679 //-- 680 { 659 681 if(dobj == NULL) 660 682 { 661 cout << " WriteSelf:: dobj= null " << endl;683 cout << " FIO_LocalMap::WriteSelf:: dobj= null " << endl; 662 684 return; 663 685 } 664 686 665 // Let's write the SphereCoordSys object666 dobj->GetCoordSys()->Write(os);667 668 687 char strg[256]; 669 688 int nSzX= dobj->Size_x();
Note:
See TracChangeset
for help on using the changeset viewer.