source: Sophya/trunk/SophyaLib/Samba/localmap.h@ 396

Last change on this file since 396 was 228, checked in by ansari, 26 years ago

Creation du module DPC/Samba Reza 13/04/99

File size: 4.4 KB
Line 
1#ifndef LOCALMAP_SEEN
2#define LOCALMAP_SEEN
3
4#include "pixelmap.h"
5#include "sphericalmap.h"
6
7// A local map of a region of the sky, in cartesian coordinates.
8// It has an origin in (theta0, phi0), mapped to pixel(x0, y0)
9// (x0, y0 might be outside of this local map)
10// default value of (x0, y0) is middle of the map, center of pixel(nx/2, ny/2)
11//
12// la carte est consideree comme un tableau a deux indices i et j, i etant
13// indice de colonne et j indice de ligne. La carte est supposee resider
14// dans un plan tangent, dont le point de tangence est repere (x0,y0) dans
15// la carte et (theta0, phi0) sur la sphere celeste. L'extension de la
16// carte est definie par les valeurs de deux angles couverts respectivement
17// par la totalite des pixels en x de la carte et la totalite des pixels
18// en y. (SetSize()).
19// On considere un "plan de reference" : plan tangent a la sphere celeste
20// aux angles theta=Pi/2 et phi=0. Dans ce plan L'origine des coordonnees
21// est le point de tangence. L'axe Ox est la tangente parallele a
22// l'equateur, dirige vers les phi croissants, l'axe Oy est parallele
23// au meridien, dirige vers le pole nord.
24// De maniere interne a la classe une carte est definie dans ce plan de
25// reference et transportee jusqu'au point (theta0, phi0) de sorte que les // axes restent paralleles aux meridiens et paralleles. L'utilisateur peut
26// definir sa carte selon un repere en rotation par rapport au repere de
27// reference (par l'angle entre le parallele et l'axe Ox souhaite --
28// methode SetOrigin(...))
29
30
31
32
33
34
35
36class LocalMap : public PixelMap {
37public:
38 LocalMap();
39 LocalMap(int_4 nx, int_4 ny);
40 virtual ~LocalMap();
41 // Overloading of () to access pixel number k.
42inline r_8& operator()(int_4 k)
43 {return(PixVal(k));}
44inline r_8 const& operator()(int_4 k) const
45 {return(PixVal(k));}
46inline r_8& operator()(int ix, int iy)
47 { return PixVal(iy*mSzX_+ix) ; };
48inline r_8 const& operator()(int ix, int iy) const
49 { return PixVal(iy*mSzX_+ix) ; };
50
51// ---------- Persistence handling
52
53 enum {classId = 0xF003 };
54int_4 ClassId() const { return classId; }
55
56virtual void WriteSelf(POutPersist&) const;
57virtual void ReadSelf(PInPersist&);
58
59// ---------- Definition of PixelMap abstract methods
60
61 // Number of pixels
62 virtual int_4 NbPixels() const;
63
64 // Value of pixel number k
65 virtual r_8& PixVal(int_4 k);
66 virtual r_8 const& PixVal(int_4 k) const;
67
68 // Index of pixel at (theta,phi)
69 virtual int_4 PixIndexSph(float theta, float phi) const;
70
71 // Spherical coordinates of center of pixel number k
72 virtual void PixThetaPhi(int_4 k, float& theta, float& phi) const;
73 // Pixel Solid angle (steradians)
74 virtual r_8 PixSolAngle(int_4 k) const;
75
76// ---------- Specific methods
77
78 // Origin (with angle between x axis and phi axis, in degrees)
79 virtual void SetOrigin(float theta0, float phi0, float angle=0.); // x0,y0 default: middle of map
80 virtual void SetOrigin(float theta0, float phi0, int_4 x0, int_4 y0, float angle=0.);
81 // Pixel size (degres)
82 virtual void SetSize(float angleX, float angleY);
83
84 // Projection to/from spherical map
85 //virtual void Extract(SphericalMap const& sphere);
86 virtual void Project(SphericalMap& sphere) const;
87
88 // There should be a more complex algorithm somewhere to combine *several*
89 // local maps to a full sphere.
90 // -> static method, or separate class
91
92 void Pixelize(int_4,int_4); // Allocate pixel array
93
94// ------------- méthodes internes ----------------------
95
96private :
97
98 void InitNul();
99 void Clear();
100 void Getij(int k, int& i, int& j) const;
101 void ReferenceToUser(float &theta, float &phi) const;
102 void UserToReference(float &theta, float &phi) const;
103 void PixProjToAngle(float x, float y,float &theta, float &phi) const;
104 void AngleProjToPix(float theta, float phi, float& x, float& y) const;
105// ------------- variables internes -----------------------
106
107 int_4 mSzX_, mSzY_;
108 int_4 mNPix_;
109 int_4 x0_;
110 int_4 y0_;
111 int_4 originFlag_;
112 int_4 SzFlag_;
113 r_4 cos_angle_;
114 r_4 sin_angle_;
115 r_8 theta0_;
116 r_8 phi0_;
117 r_8 omeg_;
118 r_8 tgAngleX_;
119 r_8 tgAngleY_;
120 r_8* mPix_;
121};
122
123#endif
Note: See TracBrowser for help on using the repository browser.