From: Andre M. <mou...@gm...> - 2016-05-14 14:07:59
|
Hi, Sorry, the correct main() function is: Void main() { QDateTime date = QDateTime(QDate(2016, 4, 15), QTime(10,0,0,0), QTimeZone::utc()); setTime(date); update() Vec3d in; double ra = 16.123456; double dec = 36.46667; spheToRect(ra*M_PI/180.0, dec*M_PI/180.0, in); Vec3d out2; // <--------------------------------------------- out2 = j2000ToAltAz(in); // <--------------------------------------------- double alt1, az1; rectToSphe(&az1, &alt1, out2); qDebug() << "j2000ToAltAz.alt:" << alt1*180/M_PI; qDebug() << "j2000ToAltAz.az:" << az1*180/M_PI; } De: Andre Moutinho [mailto:mou...@gm...] Enviada em: sábado, 14 de maio de 2016 11:04 Para: Stellarium developers public mailing list (ste...@li...) Assunto: Simple J2000 to Altaz conversion help Hello all, I am trying to get the function j2000ToAltAz() work as simple as possible. But my test case is not returning a valid RA/DEC to ALT/AZ conversion. I have made getRotEquatorialToVsop87() returns Mat4d::identity() as a first approach to make code simple. I have noticed that getRotEquatorialToVsop87() uses JDE and this variable has a previous state (time) that I will not have in my application so I dont know how to solve this because my application will only plot a static stellar map for a certain date/time/location. Maybe returning an identity matrix would not change much the result. I may be trying something stupid but please forgive me because I dont have much knowledge in this subject. Hope someone can help me. Thanks a lot Andre Here is the code: // Matrices used for every coordinate transfo Mat4d matAltAzToEquinoxEqu; // Transform from topocentric altazimuthal coordinate to Earth Equatorial Mat4d matEquinoxEquToAltAz; // Transform from Earth Equatorial to topocentric (StelObserver) altazimuthal coordinate Mat4d matEquinoxEquToJ2000; // For Earth, this is almost the inverse precession matrix, =Rz(VSOPbias)Rx(eps0)Rz(-psiA)Rx(-omA)Rz(chiA) Mat4d matJ2000ToEquinoxEqu; // precession matrix Mat4d matJ2000ToAltAz; Mat4d matAltAzModelView; // Modelview matrix for observer-centric altazimuthal drawing Mat4d invertMatAltAzModelView; // Inverted modelview matrix for observer-centric altazimuthal drawing const double JD_SECOND=0.000011574074074074074074; // 1/(24*60*60)=1/86400 const double JD_MINUTE=0.00069444444444444444444; // 1/(24*60) =1/1440 const double JD_HOUR =0.041666666666666666666; // 1/24 const double JD_DAY =1.; const double ONE_OVER_JD_SECOND = 24 * 60 * 60; // 86400 QPair<double,double> JD; // From 0.14 on: JD.first=JD_UT, JD.second=DeltaT=TT-UT. To gain JD_TT, compute JDE=JD.first+JD.second or better just call getJDE() #define LATITUDE 51.76954 #define LONGITUDE 4.605606 const Mat4d matJ2000ToVsop87(Mat4d::xrotation(-23.4392803055555555556*(M_PI/180)) * Mat4d::zrotation(0.0000275*(M_PI/180))); const Mat4d matVsop87ToJ2000(matJ2000ToVsop87.transpose()); Mat4d getRotEquatorialToVsop87() { Mat4d rval = Mat4d::identity(); return rval; } Mat4d getRotAltAzToEquatorial(double JD) { double lat = LATITUDE; double lng = LONGITUDE; if( lat > 90.0 ) lat = 90.0; if( lat < -90.0 ) lat = -90.0; return Mat4d::zrotation((getSiderealTime(JD)+lng)*M_PI/180.)* Mat4d::yrotation((90.-lat)*M_PI/180.); } update() { matAltAzToEquinoxEqu = getRotAltAzToEquatorial(getJD()); matEquinoxEquToAltAz = matAltAzToEquinoxEqu.transpose(); matEquinoxEquToJ2000 = matVsop87ToJ2000 * getRotEquatorialToVsop87(); matJ2000ToEquinoxEqu = matEquinoxEquToJ2000.transpose(); matJ2000ToAltAz = matEquinoxEquToAltAz*matJ2000ToEquinoxEqu; } Vec3d j2000ToAltAz(const Vec3d& v) { return matJ2000ToAltAz*v; } void setTime(QDateTime d) { setJD(StelUtils::qDateTimeToJd(d)); } Void main() { QDateTime date = QDateTime(QDate(2016, 4, 15), QTime(10,0,0,0), QTimeZone::utc()); setTime(date); update() Vec3d in; double ra = 16.123456; double dec = 36.46667; spheToRect(ra*M_PI/180.0, dec*M_PI/180.0, in); double alt1, az1; rectToSphe(&az1, &alt1, out2); qDebug() << "j2000ToAltAz.alt:" << alt1*180/M_PI; qDebug() << "j2000ToAltAz.az:" << az1*180/M_PI; } --- Este email foi escaneado pelo Avast antivírus. https://www.avast.com/antivirus |