中文网站上介绍星图绘制的文章挺少的,知乎这个系列介绍的挺好的

image-20221123135230526

https://zhuanlan.zhihu.com/p/82496762

下载Hipparcos Catalog,用python进行简单处理

import numpy as np
import pandas as pd

user_cols = ['hip', 'a2', 'a3', 'a4', 'ra', 'de', 'plx', 'pmra', 'pmde', 'era',
'ede', 'eplx', 'epmra', 'epmde', 'ntr', 'f2', 'f1', 'var', 'ic', 'hpmag', 'ehpmag']

df = pd.read_table("hip2.dat", sep='\s+', header=None,
engine='python', index_col=0, usecols=list(range(21)), names=user_cols)

print(df.shape)
print(df.head())
df1 = df[df.hpmag <= 6]
print(df1.shape)
print(df1.head())

(117955, 20)
a2 a3 a4 ra de plx pmra pmde era ede eplx epmra epmde ntr f2 f1 var ic hpmag ehpmag
hip
1 5 0 1 0.000016 0.019007 4.55 -4.55 -1.19 1.29 0.66 1.33 1.25 0.75 90 0.91 0 0.0 0 9.2043 0.0020
2 75 4 1 0.000066 -0.340319 20.85 182.88 -1.31 0.95 0.53 1.13 1.22 0.66 121 0.06 0 0.0 0 9.4017 0.0017
3 5 0 1 0.000087 0.678222 2.26 4.27 -3.43 0.31 0.21 0.36 0.34 0.27 129 1.56 0 0.0 0 6.6081 0.0006
4 5 0 1 0.000146 -0.905713 7.45 62.64 0.19 0.40 0.47 0.77 0.51 0.51 205 -1.50 0 0.0 0 8.1498 0.0011
5 5 0 1 0.000174 -0.708451 3.88 1.89 8.06 0.55 0.50 0.95 0.58 0.64 163 0.36 0 0.0 0 8.7077 0.0018
(4559, 20)
a2 a3 a4 ra de plx pmra pmde era ede eplx epmra epmde ntr f2 f1 var ic hpmag ehpmag
hip
88 5 0 1 0.004698 -0.851893 5.50 -18.36 -5.82 0.26 0.29 0.48 0.46 0.38 157 4.38 0 0.0 0 5.8690 0.0006
107 5 0 1 0.005826 -0.878553 6.01 7.88 11.40 0.21 0.20 0.32 0.25 0.24 170 1.00 0 0.0 0 5.6243 0.0012
122 5 0 1 0.006970 -1.345043 15.02 -57.30 -177.06 0.16 0.14 0.18 0.19 0.15 142 -0.13 1 0.0 0 4.9354 0.0006
124 5 0 1 0.007055 1.068540 1.06 -3.14 -0.74 0.20 0.19 0.27 0.26 0.21 153 1.28 0 0.0 0 5.6725 0.0006
145 5 0 1 0.007959 -0.052839 7.18 19.08 -9.66 0.28 0.17 0.30 0.32 0.16 100 1.86 0 0.0 0 5.0831 0.0006

完整处理为一个csv文件

import numpy as np
import pandas as pd
import math

user_cols = ['hip', 'a2', 'a3', 'a4', 'ra', 'de', 'plx', 'pmra', 'pmde', 'era',
'ede', 'eplx', 'epmra', 'epmde', 'ntr', 'f2', 'f1', 'var', 'ic', 'hpmag', 'ehpmag']

df = pd.read_table("hip2.dat", sep='\s+', header=None,
engine='python', index_col=0, usecols=list(range(21)), names=user_cols)

print(df.shape)
print(df.head())

df1 = df[df.hpmag <= 6]
print(df1.shape)
# print(df1.head())


df2 = df1[df1.a4 == 1]

tmp = df2['ra'] * 180 / math.pi
df2.insert(df2.shape[1], 'ra_d', tmp)
tmp = df2['ra_d'].astype(int)
df2.insert(df2.shape[1], 'ra_dh', tmp)
tmp = ((df2['ra_d'] - df2['ra_dh']) * 60).astype(int)
df2.insert(df2.shape[1], 'ra_dm', tmp)
tmp = (((df2['ra_d'] - df2['ra_dh']) * 60-df2['ra_dm'])*60)
df2.insert(df2.shape[1], 'ra_ds', tmp)

tmp = df2['ra'] * 24 / 2 / math.pi
df2.insert(df2.shape[1], 'ra_t', tmp)
tmp = df2['ra_t'].astype(int)
df2.insert(df2.shape[1], 'ra_th', tmp)
tmp = ((df2['ra_t'] - df2['ra_th']) * 60).astype(int)
df2.insert(df2.shape[1], 'ra_tm', tmp)
tmp = (((df2['ra_t'] - df2['ra_th']) * 60-df2['ra_tm'])*60)
df2.insert(df2.shape[1], 'ra_ts', tmp)

tmp = df2['de'] * 180 / math.pi
df2.insert(df2.shape[1], 'de_d', tmp)
tmp = df2['de_d'].astype(int)
df2.insert(df2.shape[1], 'de_dh', tmp)
tmp = abs((df2['de_d'] - df2['de_dh']) * 60).astype(int)
df2.insert(df2.shape[1], 'de_dm', tmp)
tmp = abs(((abs(df2['de_d'] - df2['de_dh']) * 60-abs(df2['de_dm']))*60))
df2.insert(df2.shape[1], 'de_ds', tmp)

print(df2.shape)
print(df2.head())

df2.to_csv("df2.csv")

image-20221123175438847

生成4006个星等 小于等于6 的 单星。

研究换算公式

坐标系ICRS与ITRS相互转换,时间系统及转换 https://blog.csdn.net/wokaowokaowokao12345/article/details/127211085

研究sofa

https://zhuanlan.zhihu.com/p/226482319

http://www.iausofa.org/tandc.html

http://www.iausofa.org/2021_0512_C.html


处理星表文件 stars_0_0v0_8.cat,136KB ->139524位

139524 =32 + 20 4 + 4979 28

image-20221125114703130

image-20221125142052077


function [output] = myFunc(A, start, num)
beishu = 1;
output = 0;
for i = 1 : num
output = output + A(start + i - 1) * beishu;
beishu = beishu * 256;
end
end



clear all; close all;
fileID = fopen('stars_0_0v0_8.cat','r');
A = fread(fileID,'ubit8'); % bytes 139524 = 32 + 20 * 4 + 4979 * 28;

FileHeaderRecord = A(1:32);

magic = FileHeaderRecord(1:4);
datatype = myFunc(A, 5, 4);
MajorVersion = myFunc(A, 9, 4);
MinorVersion = myFunc(A, 13, 4);
Level = myFunc(A, 17, 4);
MagnitudeMinimum = myFunc(A, 21, 4);
MagnitudeMinimum = MagnitudeMinimum - 4294967296;
MagnitudeRange = myFunc(A, 25, 4);
MagnitudeStep = myFunc(A, 29, 4);

n=1:20;
num(n) = myFunc(A, 29+n*4, 4);

sum = sum(num);

k = 1:4979;
hip(k) = myFunc(A, 85 + k *28, 3);
component_ids(k) = A(88 + k *28);
x0(k)= myFunc(A, 89 + k *28, 4);
x0(x0(k) > intmax) = x0(x0(k) > intmax) - 4294967296;
x1(k)= myFunc(A, 93 + k *28, 4);
x1(x1(k) > intmax) = x1(x1(k) > intmax) - 4294967296;
b_v(k)= A(97 + k *28);
mag(k)= A(98+ k *28);
mag_true(k) = mag(k)*0.05-2;
sp_int(k) = myFunc(A, 99+ k *28, 2);
dx0(k) = myFunc(A, 101+ k *28, 4);
dx1(k) = myFunc(A, 105+ k *28, 4);
plx(k) = myFunc(A, 109+ k *28, 4);


x00 = x0 ./MagnitudeMinimum;
x11 = x1 ./MagnitudeMinimum;

hebing = [hip.' component_ids.' x0.' x1.' b_v.' mag.' mag_true.' sp_int.' dx0.' dx1.' plx.' x00.' x11.'];
% xlswrite('test.xlsx',hebing);

fclose(fileID);

20个zone的星数为

184 174 317 235 209 254 201 210 311 341 179 158 298 383 290 206 165 346 293 225

总和为4979

image-20221125230432393

image-20221125153158442

验证了hip 和星图和星等。


C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\gui\SkyGui.cpp

void InfoPanel::setTextFromObjects(const QList< StelObjectP >& selected) {

138,28: QString s = selected[0]->getInfoString(core, infoTextFilters);

StarWrapper.cpp

QString StarWrapper1::getInfoString(const StelCore *core, const InfoStringGroup& flags) const {
oss << getCommonInfoString(core, flags);

调用StelObject.cpp的

QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGroup& flags) const {

StelCore *core = StelApp::getInstance().getCore();

QFlags(Name|CatalogNumber|Magnitude|RaDecJ2000|RaDecOfDate|AltAzi|Distance|Elongation|Size|Velocity|ProperMotion|Extra|HourAngle|AbsoluteMagnitude|GalacticCoord|SupergalacticCoord|OtherCoord|ObjectType|EclipticCoordJ2000|EclipticCoordOfDate|IAUConstellation|SiderealTime|RTSTime|SolarLunarPosition)

在wrapper中的getAltAzPosApparent(core) 可以得到, s->getHip()也能得到 那么select 到底是怎么关联过来的呢

image-20221126191150684

StelUtils::rectToSphe(&az, &alt, getAltAzPosGeometric(core));
    if (flags & AltAzi) {
// calculate alt az
double az, alt;
StelUtils::rectToSphe(&az, &alt, getAltAzPosGeometric(core));
qDebug() << " 0 " << az << alt;
double direction = 3.; // N is zero, E is 90 degrees
if (useSouthAzimuth)
direction = 2.;
az = direction * M_PI - az;
if (az > M_PI * 2)
az -= M_PI * 2;
if (withAtmosphere && (alt_app > -2.0 * M_PI / 180.0)) { // Don't show refracted altitude much below horizon where model is meaningless.
if (withDecimalDegree) {
firstCoordinate = StelUtils::radToDecDegStr(az);
secondCoordinate = StelUtils::radToDecDegStr(alt_app);
} else {
firstCoordinate = StelUtils::radToDmsStr(az, true);
secondCoordinate = StelUtils::radToDmsStr(alt_app, true);
}
} else {
if (withDecimalDegree) {
firstCoordinate = StelUtils::radToDecDegStr(az);
secondCoordinate = StelUtils::radToDecDegStr(alt);
} else {
firstCoordinate = StelUtils::radToDmsStr(az, true);
secondCoordinate = StelUtils::radToDmsStr(alt, true);
}
}

// TRANSLATORS: Azimuth/Altitude
const QString AzAlt = (withDesignations ? "A/a" : qc_("Az./Alt.", "celestial coordinate system"));

if (withTables)
res += QString("<tr><td>%1:</td><td style='text-align:right;'>%2/</td><td style='text-align:right;'>%3</td><td>%4</td></tr>").arg(AzAlt, firstCoordinate, secondCoordinate, apparent);
else
res += QString("%1: %2/%3 %4<br/>").arg(AzAlt, firstCoordinate, secondCoordinate, apparent);
res += getExtraInfoStrings(AltAzi).join("");
// qDebug() << " 1 " << res; // 高度方位
qDebug() << " 1 " << QString("%1: %2/%3 %4<br/>").arg(AzAlt, firstCoordinate, secondCoordinate, apparent);
qDebug() << " 2 " << az << alt;
}

在SkyGui.cpp中

        StelCore *core = StelApp::getInstance().getCore();

// qDebug() << "getAltAzPosGeometric " << selected[0]->getInfoString(core);

double az, alt;
StelUtils::rectToSphe(&az, &alt, selected[0]->getAltAzPosGeometric(core));
double direction = 3.; // N is zero, E is 90 degrees
az = direction * M_PI - az;
if (az > M_PI * 2)
az -= M_PI * 2;
double az_app, alt_app;
StelUtils::rectToSphe(&az_app, &alt_app, selected[0]->getAltAzPosApparent(core));
QString res, firstCoordinate, secondCoordinate;

firstCoordinate = StelUtils::radToDmsStr(az, true);
secondCoordinate = StelUtils::radToDmsStr(alt, true);
qDebug() << "AzAlt " << firstCoordinate << " " << secondCoordinate << " " << alt_app << (alt_app > -2.0 * M_PI / 180.0);


可以显示选中星体的信息。

getAltAzPosGeometric



研究 Star1

在 C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\util\ConvertCatToNative.C 文件中

int main(int argc,char *argv[]) {
PerformConversion(argv[1],argv[2]);
void PerformConversion(const char *fname_in,const char *fname_out) {
Convert<Star1>(f_in,f_out,from_be,nr_of_stars);
void Convert(FILE *f_in,FILE *f_out,bool from_be,unsigned int nr_of_stars) {
s.repack(from_be);
void Star1::repack(bool from_be) {
const int _hip = UnpackBits(from_be,(const char*)this, 0,24);
const unsigned int _cids = UnpackUBits(from_be,(const char*)this,24, 8);
const int _x0 = UnpackBits(from_be,(const char*)this,32,32);
const int _x1 = UnpackBits(from_be,(const char*)this,64,32);
const unsigned int _b_v = UnpackUBits(from_be,(const char*)this, 96, 8);
const unsigned int _mag = UnpackUBits(from_be,(const char*)this,104, 8);
const unsigned int _sp_int = UnpackUBits(from_be,(const char*)this,112,16);
const int _dx0 = UnpackBits(from_be,(const char*)this,128,32);
const int _dx1 = UnpackBits(from_be,(const char*)this,160,32);
const int _plx = UnpackBits(from_be,(const char*)this,192,32);
hip = _hip;
component_ids = _cids;
x0 = _x0;
x1 = _x1;
b_v = _b_v;
mag = _mag;
sp_int = _sp_int;
dx0 = _dx0;
dx1 = _dx1;
plx = _plx;
}
struct Star1 { // 28 byte
int hip:24; // 17 bits needed
unsigned char component_ids; // 5 bits needed
Int32 x0; // 32 bits needed
Int32 x1; // 32 bits needed
unsigned char b_v; // 7 bits needed
unsigned char mag; // 8 bits needed
Uint16 sp_int; // 14 bits needed
Int32 dx0,dx1,plx;
void repack(bool from_be);
void print(void);
}

研究s->getHip() , 哪里的s呢

QString StarWrapper1::getInfoString(const StelCore *core, const InfoStringGroup& flags) const
const QString varType = StarMgr::getGcvsVariabilityType(s->getHip());
class StelObject : public StelRegionObject
{

class StarWrapperBase : public StelObject
{
protected:
StarWrapperBase(void) {}
virtual ~StarWrapperBase(void) Q_DECL_OVERRIDE {}
virtual QString getType(void) const Q_DECL_OVERRIDE {return STAR_TYPE;}
virtual QString (void) const Q_DECL_OVERRIDE {return N_("star"); }
virtual QString getObjectTypeI18n(void) const Q_DECL_OVERRIDE {return q_(getObjectType()); }

virtual QString getEnglishName(void) const Q_DECL_OVERRIDE {return QString();}
virtual QString getNameI18n(void) const Q_DECL_OVERRIDE = 0;
virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const Q_DECL_OVERRIDE;
virtual float getBV(void) const = 0;
};

template <class Star> class StarWrapper : public StarWrapperBase
{
protected:
StarWrapper(const SpecialZoneArray<Star> *array,
const SpecialZoneData<Star> *zone,
const Star *star) : a(array), z(zone), s(star) {}
virtual Vec3d getJ2000EquatorialPos(const StelCore* core) const Q_DECL_OVERRIDE
virtual Vec3f getInfoColor(void) const Q_DECL_OVERRIDE
virtual float getVMagnitude(const StelCore* core) const Q_DECL_OVERRIDE
virtual float getBV(void) const Q_DECL_OVERRIDE {return s->getBV();}
virtual QString getEnglishName(void) const Q_DECL_OVERRIDE {return QString();}
virtual QString getNameI18n(void) const Q_DECL_OVERRIDE {return s->getNameI18n();}
protected:
const SpecialZoneArray<Star> *const a;
const SpecialZoneData<Star> *const z;
const Star *const s;
};
class StarWrapper1 : public StarWrapper<Star1>
{
public:
StarWrapper1(const SpecialZoneArray<Star1> *array,
const SpecialZoneData<Star1> *zone,
const Star1 *star) : StarWrapper<Star1>(array,zone,star) {}

//! StarWrapper1 supports the following InfoStringGroup flags: <ul>
//! <li> Name
//! <li> CatalogNumber
//! <li> Magnitude
//! <li> RaDecJ2000
//! <li> RaDec
//! <li> AltAzi
//! <li> Extra (spectral type, parallax)
//! <li> Distance
//! <li> PlainText </ul>
//! @param core the StelCore object.
//! @param flags a set of InfoStringGroup items to include in the return value.
//! @return a QString containing an HMTL encoded description of the StarWrapper1.
virtual QString getInfoString(const StelCore *core, const InfoStringGroup& flags) const Q_DECL_OVERRIDE;
//! In addition to the entries from StelObject::getInfoMap(), StarWrapper1 objects provide
//! - variable-star (no|eruptive|pulsating|rotating|cataclysmic|eclipsing-binary)
//! - star-type (star|double-star)
//! - bV : B-V Color Index
//! A few tags are only present if data known, or for variable or double stars from the WDS catalog
//! - absolute-mag
//! - distance-ly
//! - parallax
//! - spectral-class
//! - period (days)
//! - wds-year (year of validity of wds... fields)
//! - wds-position-angle
//! - wds-separation (arcseconds; 0 for spectroscopic binaries)
virtual QVariantMap getInfoMap(const StelCore *core) const Q_DECL_OVERRIDE;
virtual QString getEnglishName(void) const Q_DECL_OVERRIDE;
virtual QString getID(void) const Q_DECL_OVERRIDE;
virtual QString getObjectType() const Q_DECL_OVERRIDE;
virtual QString getObjectTypeI18n() const Q_DECL_OVERRIDE;
};

按键按下之后发生的事

void StelMovementMgr::handleMouseClicks(QMouseEvent* event) {
case Qt::LeftButton :
objectMgr->findAndSelect(core, event->x(), event->y(), event->modifiers().testFlag(Qt::ControlModifier) ? StelModule::AddToSelection : StelModule::ReplaceSelection);
bool StelObjectMgr::findAndSelect(const StelCore* core, int x, int y, StelModule::StelModuleSelectAction action) {
StelObjectP tempselect = cleverFind(core, x, y);
StelObjectP StelObjectMgr::cleverFind(const StelCore* core, int x, int y) const {
return cleverFind(core, v2000);
StelObjectP StelObjectMgr::cleverFind(const StelCore* core, const Vec3d& v) const {
for (const auto* m : objectsModules) { // StelObjectMgr.cpp
candidates += m->searchAround(v, fov_around, core); // 点一下
}

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\modules\StarMgr.cpp

QList<StelObjectP > StarMgr::searchAround(const Vec3d& vv, double limFov, const StelCore* core) const
for (GeodesicSearchBorderIterator it1(*geodesic_search_result, z->level); (zone = it1.next()) >= 0;)
qDebug() << " 1111 eee " << eee++;
z->searchAround(core, zone, v, f, result);

qDebug() << “ 2222 now2 “ << bbb++; // 2531次
return s->createStelObject(a, z);

// qDebug() << “ 2222 now “ << aaa++; //24920次
StelObjectP so = s->createStelObject(a, z);

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\modules\ZoneArray.cpp的result.push_back(s->createStelObject(this, z)); // 调用27多次 点击也是这里调用

void SpecialZoneArray<Star>::searchAround(const StelCore* core, int index, const Vec3d &v, double cosLimFov, QList<StelObjectP > &result) {
for (const Star* s=z->getStars();s<z->getStars()+z->size;++s)
result.push_back(s->createStelObject(this, z));

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\modules\StarWrapper.cpp中

StelObjectP Star1::createStelObject(const SpecialZoneArray<Star1> *a, const SpecialZoneData<Star1> *z) const
return StelObjectP(new StarWrapper1(a,z,this), true); //27479次
class StarWrapper1 : public StarWrapper<Star1> {
public:
StarWrapper1(const SpecialZoneArray<Star1> *array,
const SpecialZoneData<Star1> *zone,
const Star1 *star) : StarWrapper<Star1>(array, zone, star) {}
template <class Star> 
class StarWrapper : public StarWrapperBase {
protected:
StarWrapper(const SpecialZoneArray<Star> *array,
const SpecialZoneData<Star> *zone,
const Star *star) : a(array), z(zone), s(star) {}
StarWrapper.s .a .z

研究如何算j2000的赤经赤纬

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\StelObject.cpp文件中

QString StelObject::getCommonInfoString(const StelCore *core, const InfoStringGroup& flags) const {
if (flags & RaDecJ2000) {
double dec_j2000, ra_j2000;
StelUtils::rectToSphe(&ra_j2000, &dec_j2000, getJ2000EquatorialPos(core));
qDebug() << " getJ2000EquatorialPos222 " << getJ2000EquatorialPos(core);
if (withDecimalDegree) {
firstCoordinate = StelUtils::radToDecDegStr(ra_j2000, 5, false, true);
secondCoordinate = StelUtils::radToDecDegStr(dec_j2000);
} else {
firstCoordinate = StelUtils::radToHmsStr(ra_j2000, true);
secondCoordinate = StelUtils::radToDmsStr(dec_j2000, true);
}
}

getJ2000EquatorialPos调用

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\modules\StarWrapper.hpp中的

template <class Star> 
class StarWrapper : public StarWrapperBase
protected:
StarWrapper(const SpecialZoneArray<Star> *array, const SpecialZoneData<Star> *zone, const Star *star) : a(array), z(zone), s(star) {}
virtual Vec3d getJ2000EquatorialPos(const StelCore* core) const Q_DECL_OVERRIDE
s->getJ2000Pos(z, (M_PI / 180.) * (0.0001 / 3600.) * ((core->getJDE() - d2000) / 365.25) / a->star_position_scale, v);

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\modules\Star.hpp

struct Star1 { // 28 byte
public:
void getJ2000Pos(const ZoneData *z,float movementFactor, Vec3f& pos) const {
pos = z->axis0;
pos*=(static_cast<float>(getX0())+movementFactor*getDx0());
pos+=(static_cast<float>(getX1())+movementFactor*getDx1())*z->axis1;
pos+=z->center;

C:\Users\hp\Desktop\stellarium-0.22.2\stellarium-0.22.2\src\core\StelGeodesicGrid.cpp中

StelGeodesicGrid::StelGeodesicGrid(const int lev) : maxLevel(lev < 0 ? 0 : lev)
for (int i=0;i<20;i++)
initTriangle(0, i, icosahedron_corners[corners[0]], icosahedron_corners[corners[1]], icosahedron_corners[corners[2]]); // 20次
static const float icosahedron_G = 0.5f * (1.0f + std::sqrt(5.0f));
static const float icosahedron_b = 1.0f / std::sqrt(1.0f + icosahedron_G*icosahedron_G);
static const float icosahedron_a = icosahedron_b * icosahedron_G;

static const Vec3f icosahedron_corners[12] = {
Vec3f( icosahedron_a, -icosahedron_b, 0.0),
Vec3f( icosahedron_a, icosahedron_b, 0.0),
Vec3f(-icosahedron_a, icosahedron_b, 0.0),
Vec3f(-icosahedron_a, -icosahedron_b, 0.0),
Vec3f( 0.0, icosahedron_a, -icosahedron_b),
Vec3f( 0.0, icosahedron_a, icosahedron_b),
Vec3f( 0.0, -icosahedron_a, icosahedron_b),
Vec3f( 0.0, -icosahedron_a, -icosahedron_b),
Vec3f(-icosahedron_b, 0.0, icosahedron_a),
Vec3f( icosahedron_b, 0.0, icosahedron_a),
Vec3f( icosahedron_b, 0.0, -icosahedron_a),
Vec3f(-icosahedron_b, 0.0, -icosahedron_a)

0 [0.850651, -0.525731, 0]
1 [0.850651, 0.525731, 0]
2 [-0.850651, 0.525731, 0]
3 [-0.850651, -0.525731, 0]
4 [0, 0.850651, -0.525731]
5 [0, 0.850651, 0.525731]
6 [0, -0.850651, 0.525731]
7 [0, -0.850651, -0.525731]
8 [-0.525731, 0, 0.850651]
9 [0.525731, 0, 0.850651]
10 [0.525731, 0, -0.850651]
11 [-0.525731, 0, -0.850651]

0 [0.850651, 0.525731, 0] [0.850651, -0.525731, 0] [0.525731, 0, -0.850651]
1 [0.850651, -0.525731, 0] [0.850651, 0.525731, 0] [0.525731, 0, 0.850651]
2 [0.850651, -0.525731, 0] [0.525731, 0, 0.850651] [0, -0.850651, 0.525731]
3 [0.525731, 0, 0.850651] [-0.525731, 0, 0.850651] [0, -0.850651, 0.525731]
4 [0.850651, -0.525731, 0] [0, -0.850651, -0.525731] [0.525731, 0, -0.850651]
5 [0, -0.850651, 0.525731] [0, -0.850651, -0.525731] [0.850651, -0.525731, 0
6 [0, -0.850651, -0.525731] [0, -0.850651, 0.525731] [-0.850651, -0.525731, 0]
7 [0, -0.850651, 0.525731] [-0.525731, 0, 0.850651] [-0.850651, -0.525731, 0]
8 [-0.525731, 0, -0.850651] [0.525731, 0, -0.850651] [0, -0.850651, -0.525731]
9 [0, -0.850651, -0.525731] [-0.850651, -0.525731, 0] [-0.525731, 0, -0.850651]
10 [-0.850651, -0.525731, 0] [-0.850651, 0.525731, 0] [-0.525731, 0, -0.850651]
11 [-0.850651, 0.525731, 0] [-0.850651, -0.525731, 0] [-0.525731, 0, 0.850651]
12 [0.525731, 0, -0.850651] [-0.525731, 0, -0.850651] [0, 0.850651, -0.525731]
13 [-0.850651, 0.525731, 0] [0, 0.850651, -0.525731] [-0.525731, 0, -0.850651]
14 [0, 0.850651, 0.525731] [0, 0.850651, -0.525731] [-0.850651, 0.525731, 0]
15 [-0.850651, 0.525731, 0] [-0.525731, 0, 0.850651] [0, 0.850651, 0.525731]
16 [0, 0.850651, -0.525731] [0.850651, 0.525731, 0] [0.525731, 0, -0.850651]
17 [0, 0.850651, -0.525731] [0, 0.850651, 0.525731] [0.850651, 0.525731, 0
18 [0, 0.850651, 0.525731] [0.525731, 0, 0.850651] [0.850651, 0.525731, 0
19 [-0.525731, 0, 0.850651] [0.525731, 0, 0.850651] [0, 0.850651, 0.525731]

正二十面体(Regular icosahedron ) 是由20个等边三角形所组成的正多面体,共有12个顶点,30条棱,20个面。为五个柏拉图多面体之一。

StelApp::getInstance().getCore()->getGeodesicGrid(maxGeodesicGridLevel)->visitTriangles(maxGeodesicGridLevel, initTriangleFunc, this); // 1次
void StelGeodesicGrid::visitTriangles(int maxVisitLevel,
VisitFunc *func,
void *context) const { // 1次
if (func && maxVisitLevel >= 0) { // 1次
if (maxVisitLevel > maxLevel) maxVisitLevel = maxLevel;
for (int i = 0; i < 20; i++) { // 20次
const int *const corners = icosahedron_triangles[i].corners;
visitTriangles(0, i,
icosahedron_corners[corners[0]],
icosahedron_corners[corners[1]],
icosahedron_corners[corners[2]],
maxVisitLevel, func, context);
void StelGeodesicGrid::visitTriangles(int lev, int index,
const Vec3f &c0,
const Vec3f &c1,
const Vec3f &c2,
int maxVisitLevel,
VisitFunc *func,
void *context) const {
qDebug() << " initTriangle maxVisitLevel222 " << lev << index << maxVisitLevel << maxLevel;
(*func)(lev, index, c0, c1, c2, context); // 20 * 调用一次

Triangle &t(triangles[lev][index]);
lev++;
if (lev <= maxVisitLevel) {
qDebug() << " initTriangle maxVisitLevel333 " << maxLevel;
index *= 4;
visitTriangles(lev, index + 0, c0, t.e2, t.e1, maxVisitLevel, func, context);
visitTriangles(lev, index + 1, t.e2, c1, t.e0, maxVisitLevel, func, context);
visitTriangles(lev, index + 2, t.e1, t.e0, c2, maxVisitLevel, func, context);
visitTriangles(lev, index + 3, t.e0, t.e1, t.e2, maxVisitLevel, func, context);
static void initTriangleFunc(int lev, int index, const Vec3f &c0, const Vec3f &c1, const Vec3f &c2, void *context) {  // 100次调用
StarMgr::initTriangle(int lev, int index, const Vec3f &c0, const Vec3f &c1, const Vec3f &c2) { // 100次调用

有2层level ,第一层的index为20 第二层为80;

0 0 0 [0.850651, 0.525731, 0] [0.850651, -0.525731, 0] [0.525731, 0, -0.850651]
1 1 0 [0.850651, 0.525731, 0] [1, 0, 0] [0.809017, 0.309017, -0.5]
2 1 1 [1, 0, 0] [0.850651, -0.525731, 0] [0.809017, -0.309017, -0.5]
3 1 2 [0.809017, 0.309017, -0.5] [0.809017, -0.309017, -0.5] [0.525731, 0, -0.850651]
4 1 3 [0.809017, -0.309017, -0.5] [0.809017, 0.309017, -0.5] [1, 0, 0]
5 0 1 [0.850651, -0.525731, 0] [0.850651, 0.525731, 0] [0.525731, 0, 0.850651]
6 1 4 [0.850651, -0.525731, 0] [1, 0, 0] [0.809017, -0.309017, 0.5]
7 1 5 [1, 0, 0] [0.850651, 0.525731, 0] [0.809017, 0.309017, 0.5]
8 1 6 [0.809017, -0.309017, 0.5] [0.809017, 0.309017, 0.5] [0.525731, 0, 0.850651]
9 1 7 [0.809017, 0.309017, 0.5] [0.809017, -0.309017, 0.5] [1, 0, 0]
10 0 2 [0.850651, -0.525731, 0] [0.525731, 0, 0.850651] [0, -0.850651, 0.525731]
11 1 8 [0.850651, -0.525731, 0] [0.809017, -0.309017, 0.5] [0.5, -0.809017, 0.309017]
12 1 9 [0.809017, -0.309017, 0.5] [0.525731, 0, 0.850651] [0.309017, -0.5, 0.809017]
13 1 10 [0.5, -0.809017, 0.309017] [0.309017, -0.5, 0.809017] [0, -0.850651, 0.525731]
14 1 11 [0.309017, -0.5, 0.809017] [0.5, -0.809017, 0.309017] [0.809017, -0.309017, 0.5]
15 0 3 [0.525731, 0, 0.850651] [-0.525731, 0, 0.850651] [0, -0.850651, 0.525731]
16 1 12 [0.525731, 0, 0.850651] [0, 0, 1] [0.309017, -0.5, 0.809017]
17 1 13 [0, 0, 1] [-0.525731, 0, 0.850651] [-0.309017, -0.5, 0.809017]
18 1 14 [0.309017, -0.5, 0.809017] [-0.309017, -0.5, 0.809017] [0, -0.850651, 0.525731]
19 1 15 [-0.309017, -0.5, 0.809017] [0.309017, -0.5, 0.809017] [0, 0, 1]
20 0 4 [0.850651, -0.525731, 0] [0, -0.850651, -0.525731] [0.525731, 0, -0.850651]
21 1 16 [0.850651, -0.525731, 0] [0.5, -0.809017, -0.309017] [0.809017, -0.309017, -0.5]
22 1 17 [0.5, -0.809017, -0.309017] [0, -0.850651, -0.525731] [0.309017, -0.5, -0.809017]
23 1 18 [0.809017, -0.309017, -0.5] [0.309017, -0.5, -0.809017] [0.525731, 0, -0.850651]
24 1 19 [0.309017, -0.5, -0.809017] [0.809017, -0.309017, -0.5] [0.5, -0.809017, -0.309017]
25 0 5 [0, -0.850651, 0.525731] [0, -0.850651, -0.525731] [0.850651, -0.525731, 0]
26 1 20 [0, -0.850651, 0.525731] [0, -1, 0] [0.5, -0.809017, 0.309017]
27 1 21 [0, -1, 0] [0, -0.850651, -0.525731] [0.5, -0.809017, -0.309017]
28 1 22 [0.5, -0.809017, 0.309017] [0.5, -0.809017, -0.309017] [0.850651, -0.525731, 0]
29 1 23 [0.5, -0.809017, -0.309017] [0.5, -0.809017, 0.309017] [0, -1, 0]
30 0 6 [0, -0.850651, -0.525731] [0, -0.850651, 0.525731] [-0.850651, -0.525731, 0]
31 1 24 [0, -0.850651, -0.525731] [0, -1, 0] [-0.5, -0.809017, -0.309017]
32 1 25 [0, -1, 0] [0, -0.850651, 0.525731] [-0.5, -0.809017, 0.309017]
33 1 26 [-0.5, -0.809017, -0.309017] [-0.5, -0.809017, 0.309017] [-0.850651, -0.525731, 0]
34 1 27 [-0.5, -0.809017, 0.309017] [-0.5, -0.809017, -0.309017] [0, -1, 0]
35 0 7 [0, -0.850651, 0.525731] [-0.525731, 0, 0.850651] [-0.850651, -0.525731, 0]
36 1 28 [0, -0.850651, 0.525731] [-0.309017, -0.5, 0.809017] [-0.5, -0.809017, 0.309017]
37 1 29 [-0.309017, -0.5, 0.809017] [-0.525731, 0, 0.850651] [-0.809017, -0.309017, 0.5]
38 1 30 [-0.5, -0.809017, 0.309017] [-0.809017, -0.309017, 0.5] [-0.850651, -0.525731, 0]
39 1 31 [-0.809017, -0.309017, 0.5] [-0.5, -0.809017, 0.309017] [-0.309017, -0.5, 0.809017]
40 0 8 [-0.525731, 0, -0.850651] [0.525731, 0, -0.850651] [0, -0.850651, -0.525731]
41 1 32 [-0.525731, 0, -0.850651] [0, 0, -1] [-0.309017, -0.5, -0.809017]
42 1 33 [0, 0, -1] [0.525731, 0, -0.850651] [0.309017, -0.5, -0.809017]
43 1 34 [-0.309017, -0.5, -0.809017] [0.309017, -0.5, -0.809017] [0, -0.850651, -0.525731]
44 1 35 [0.309017, -0.5, -0.809017] [-0.309017, -0.5, -0.809017] [0, 0, -1]
45 0 9 [0, -0.850651, -0.525731] [-0.850651, -0.525731, 0] [-0.525731, 0, -0.850651]
46 1 36 [0, -0.850651, -0.525731] [-0.5, -0.809017, -0.309017] [-0.309017, -0.5, -0.809017]
47 1 37 [-0.5, -0.809017, -0.309017] [-0.850651, -0.525731, 0] [-0.809017, -0.309017, -0.5]
48 1 38 [-0.309017, -0.5, -0.809017] [-0.809017, -0.309017, -0.5] [-0.525731, 0, -0.850651]
49 1 39 [-0.809017, -0.309017, -0.5] [-0.309017, -0.5, -0.809017] [-0.5, -0.809017, -0.309017]
50 0 10 [-0.850651, -0.525731, 0] [-0.850651, 0.525731, 0] [-0.525731, 0, -0.850651]
51 1 40 [-0.850651, -0.525731, 0] [-1, 0, 0] [-0.809017, -0.309017, -0.5]
52 1 41 [-1, 0, 0] [-0.850651, 0.525731, 0] [-0.809017, 0.309017, -0.5]
53 1 42 [-0.809017, -0.309017, -0.5] [-0.809017, 0.309017, -0.5] [-0.525731, 0, -0.850651]
54 1 43 [-0.809017, 0.309017, -0.5] [-0.809017, -0.309017, -0.5] [-1, 0, 0]
55 0 11 [-0.850651, 0.525731, 0] [-0.850651, -0.525731, 0] [-0.525731, 0, 0.850651]
56 1 44 [-0.850651, 0.525731, 0] [-1, 0, 0] [-0.809017, 0.309017, 0.5]
57 1 45 [-1, 0, 0] [-0.850651, -0.525731, 0] [-0.809017, -0.309017, 0.5]
58 1 46 [-0.809017, 0.309017, 0.5] [-0.809017, -0.309017, 0.5] [-0.525731, 0, 0.850651]
59 1 47 [-0.809017, -0.309017, 0.5] [-0.809017, 0.309017, 0.5] [-1, 0, 0]
60 0 12 [0.525731, 0, -0.850651] [-0.525731, 0, -0.850651] [0, 0.850651, -0.525731]
61 1 48 [0.525731, 0, -0.850651] [0, 0, -1] [0.309017, 0.5, -0.809017]
62 1 49 [0, 0, -1] [-0.525731, 0, -0.850651] [-0.309017, 0.5, -0.809017]
63 1 50 [0.309017, 0.5, -0.809017] [-0.309017, 0.5, -0.809017] [0, 0.850651, -0.525731]
64 1 51 [-0.309017, 0.5, -0.809017] [0.309017, 0.5, -0.809017] [0, 0, -1]
65 0 13 [-0.850651, 0.525731, 0] [0, 0.850651, -0.525731] [-0.525731, 0, -0.850651]
66 1 52 [-0.850651, 0.525731, 0] [-0.5, 0.809017, -0.309017] [-0.809017, 0.309017, -0.5]
67 1 53 [-0.5, 0.809017, -0.309017] [0, 0.850651, -0.525731] [-0.309017, 0.5, -0.809017]
68 1 54 [-0.809017, 0.309017, -0.5] [-0.309017, 0.5, -0.809017] [-0.525731, 0, -0.850651]
69 1 55 [-0.309017, 0.5, -0.809017] [-0.809017, 0.309017, -0.5] [-0.5, 0.809017, -0.309017]
70 0 14 [0, 0.850651, 0.525731] [0, 0.850651, -0.525731] [-0.850651, 0.525731, 0]
71 1 56 [0, 0.850651, 0.525731] [0, 1, 0] [-0.5, 0.809017, 0.309017]
72 1 57 [0, 1, 0] [0, 0.850651, -0.525731] [-0.5, 0.809017, -0.309017]
73 1 58 [-0.5, 0.809017, 0.309017] [-0.5, 0.809017, -0.309017] [-0.850651, 0.525731, 0]
74 1 59 [-0.5, 0.809017, -0.309017] [-0.5, 0.809017, 0.309017] [0, 1, 0]
75 0 15 [-0.850651, 0.525731, 0] [-0.525731, 0, 0.850651] [0, 0.850651, 0.525731]
76 1 60 [-0.850651, 0.525731, 0] [-0.809017, 0.309017, 0.5] [-0.5, 0.809017, 0.309017]
77 1 61 [-0.809017, 0.309017, 0.5] [-0.525731, 0, 0.850651] [-0.309017, 0.5, 0.809017]
78 1 62 [-0.5, 0.809017, 0.309017] [-0.309017, 0.5, 0.809017] [0, 0.850651, 0.525731]
79 1 63 [-0.309017, 0.5, 0.809017] [-0.5, 0.809017, 0.309017] [-0.809017, 0.309017, 0.5]
80 0 16 [0, 0.850651, -0.525731] [0.850651, 0.525731, 0] [0.525731, 0, -0.850651]
81 1 64 [0, 0.850651, -0.525731] [0.5, 0.809017, -0.309017] [0.309017, 0.5, -0.809017]
82 1 65 [0.5, 0.809017, -0.309017] [0.850651, 0.525731, 0] [0.809017, 0.309017, -0.5]
83 1 66 [0.309017, 0.5, -0.809017] [0.809017, 0.309017, -0.5] [0.525731, 0, -0.850651]
84 1 67 [0.809017, 0.309017, -0.5] [0.309017, 0.5, -0.809017] [0.5, 0.809017, -0.309017]
85 0 17 [0, 0.850651, -0.525731] [0, 0.850651, 0.525731] [0.850651, 0.525731, 0]
86 1 68 [0, 0.850651, -0.525731] [0, 1, 0] [0.5, 0.809017, -0.309017]
87 1 69 [0, 1, 0] [0, 0.850651, 0.525731] [0.5, 0.809017, 0.309017]
88 1 70 [0.5, 0.809017, -0.309017] [0.5, 0.809017, 0.309017] [0.850651, 0.525731, 0]
89 1 71 [0.5, 0.809017, 0.309017] [0.5, 0.809017, -0.309017] [0, 1, 0]
90 0 18 [0, 0.850651, 0.525731] [0.525731, 0, 0.850651] [0.850651, 0.525731, 0]
91 1 72 [0, 0.850651, 0.525731] [0.309017, 0.5, 0.809017] [0.5, 0.809017, 0.309017]
92 1 73 [0.309017, 0.5, 0.809017] [0.525731, 0, 0.850651] [0.809017, 0.309017, 0.5]
93 1 74 [0.5, 0.809017, 0.309017] [0.809017, 0.309017, 0.5] [0.850651, 0.525731, 0]
94 1 75 [0.809017, 0.309017, 0.5] [0.5, 0.809017, 0.309017] [0.309017, 0.5, 0.809017]
95 0 19 [-0.525731, 0, 0.850651] [0.525731, 0, 0.850651] [0, 0.850651, 0.525731]
96 1 76 [-0.525731, 0, 0.850651] [0, 0, 1] [-0.309017, 0.5, 0.809017]
97 1 77 [0, 0, 1] [0.525731, 0, 0.850651] [0.309017, 0.5, 0.809017]
98 1 78 [-0.309017, 0.5, 0.809017] [0.309017, 0.5, 0.809017] [0, 0.850651, 0.525731]
99 1 79 [0.309017, 0.5, 0.809017] [-0.309017, 0.5, 0.809017] [0, 0, 1]

自己研究了两周还是没结果,很失落,写不出第二周的总结,因为第二周没有收获。第三周末尾和一位天文学专业的同学请教了,才发现自己这2周方向都错了,顶多算是对c++代码的一次学习。