Документ взят из кэша поисковой машины. Адрес оригинального документа : http://astro.uni-altai.ru/~aw/stellarium/api/Star_8hpp_source.html
Дата изменения: Unknown
Дата индексирования: Fri Feb 28 07:26:56 2014
Кодировка:

Поисковые слова: horizon
Stellarium: core/modules/Star.hpp Source File
Stellarium 0.12.3
Star.hpp
1 /*
2  * The big star catalogue extension to Stellarium:
3  * Author and Copyright: Johannes Gajdosik, 2006, 2007
4  *
5  * Thanks go to Nigel Kerr for ideas and testing of BE/LE star repacking
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 2
10  * of the License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
20  */
21 
22 #ifndef _STAR_HPP_
23 #define _STAR_HPP_ 1
24 
25 #include "ZoneData.hpp"
26 #include "StelObjectType.hpp"
27 #include <QString>
28 
29 class StelObject;
30 
31 namespace BigStarCatalogExtension {
32 
33 typedef int Int32;
34 typedef unsigned int Uint32;
35 typedef short int Int16;
36 typedef unsigned short int Uint16;
37 
38 
39 template <class Star> class SpecialZoneArray;
40 template <class Star> struct SpecialZoneData;
41 
42 
43 // structs for storing the stars in binary form. The idea is
44 // to store much data for bright stars (Star1), but only little or even
45 // very little data for faints stars (Star3). Using only 6 bytes for Star3
46 // makes it feasable to store hundreds of millions of them in main memory.
47 
48 
49 
50 static inline float IndexToBV(unsigned char bV) {
51  return (float)bV*(4.f/127.f)-0.5f;
52 }
53 
54 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
55 #pragma pack(1)
56 #endif
57 struct Star1 { // 28 byte
58 #ifdef _MSC_BUILD
59  unsigned int hip:24; // 17 bits needed
60  unsigned int componentIds:8; // 5 bits needed
61 #else
62  int hip:24; // 17 bits needed
63  unsigned char componentIds; // 5 bits needed
64 #endif
65  Int32 x0; // 32 bits needed
66  Int32 x1; // 32 bits needed
67  unsigned char bV; // 7 bits needed
68  unsigned char mag; // 8 bits needed
69  Uint16 spInt; // 14 bits needed
70  Int32 dx0,dx1,plx;
71  enum {MaxPosVal=0x7FFFFFFF};
72  StelObjectP createStelObject(const SpecialZoneArray<Star1> *a,
73  const SpecialZoneData<Star1> *z) const;
74  void getJ2000Pos(const ZoneData *z,float movementFactor, Vec3f& pos) const {
75  pos = z->axis0;
76  pos*=((float)(x0)+movementFactor*dx0);
77  pos+=((float)(x1)+movementFactor*dx1)*z->axis1;
78  pos+=z->center;
79  }
80  float getBV(void) const {return IndexToBV(bV);}
81  bool hasName() const {return hip;}
82  QString getNameI18n(void) const;
83  int hasComponentID(void) const;
84  void repack(bool fromBe);
85  void print(void);
86 }
87 #if defined(__GNUC__)
88  __attribute__ ((__packed__))
89 #endif
90 ;
91 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
92 #pragma pack(0)
93 #endif
94 
95 
96 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
97 #pragma pack(1)
98 #endif
99 struct Star2 { // 10 byte
100  int x0:20;
101  int x1:20;
102  int dx0:14;
103  int dx1:14;
104  unsigned int bV:7;
105  unsigned int mag:5;
106  enum {MaxPosVal=((1<<19)-1)};
107  StelObjectP createStelObject(const SpecialZoneArray<Star2> *a,
108  const SpecialZoneData<Star2> *z) const;
109  void getJ2000Pos(const ZoneData *z,float movementFactor, Vec3f& pos) const {
110  pos = z->axis0;
111  pos*=((float)(x0)+movementFactor*dx0);
112  pos+=((float)(x1)+movementFactor*dx1)*z->axis1;
113  pos+=z->center;
114  }
115  float getBV(void) const {return IndexToBV(bV);}
116  QString getNameI18n(void) const {return QString();}
117  int hasComponentID(void) const {return 0;}
118  bool hasName() const {return false;}
119  void repack(bool fromBe);
120  void print(void);
121 }
122 #if defined(__GNUC__)
123  __attribute__ ((__packed__))
124 #endif
125 ;
126 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
127 #pragma pack(0)
128 #endif
129 
130 
131 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
132 #pragma pack(1)
133 #endif
134 struct Star3 { // 6 byte
135  int x0:18;
136  int x1:18;
137  unsigned int bV:7;
138  unsigned int mag:5;
139  enum {MaxPosVal=((1<<17)-1)};
140  StelObjectP createStelObject(const SpecialZoneArray<Star3> *a,
141  const SpecialZoneData<Star3> *z) const;
142  void getJ2000Pos(const ZoneData *z,float, Vec3f& pos) const {
143  pos = z->axis0;
144  pos*=(float)(x0);
145  pos+=z->center;
146  pos+=(float)(x1)*z->axis1;
147  }
148  float getBV(void) const {return IndexToBV(bV);}
149  QString getNameI18n(void) const {return QString();}
150  int hasComponentID(void) const {return 0;}
151  bool hasName() const {return false;}
152  void repack(bool fromBe);
153  void print(void);
154 }
155 #if defined(__GNUC__)
156  __attribute__ ((__packed__))
157 #endif
158 ;
159 #if (defined(__sgi) && defined(_COMPILER_VERSION) && !defined(__GNUC__))
160 #pragma pack(0)
161 #endif
162 
163 } // namespace BigStarCatalogExtension
164 
165 #endif // _STAR_HPP_