Commit 00c3f98a authored by nobody's avatar nobody

This commit was manufactured by cvs2svn to create tag

'KDE_3_1_5_RELEASE'.

svn path=/tags/KDE_3_1_5_RELEASE/kdeedu/kstars/; revision=275604
parents 4a918643 152179b5
......@@ -41,7 +41,7 @@
AstroCalc::AstroCalc( QWidget* parent ) :
KDialogBase( parent, "starscalculator", true,
i18n("KStars Calculator"), Ok | Cancel ) {
i18n("KStars Calculator"), Close ) {
split = new QSplitter ( this );
setMainWidget(split);
......
......@@ -1242,7 +1242,7 @@ Lewiston : New York : USA
Lewistown : Montana : USA : 47 : 4 : 58 : N : 109 : 25 : 1 : W : -7.0 : US
Lexington : Kentucky : USA : 38 : 2 : 49 : N : 84 : 29 : 45 : W : -5.0 : US
Leopold Figl : : Austria : 48 : 5 : 0 : N : 15 : 25 : 30 : E : 1.0 : EU
Lhasa : : Tibet : 29 : 40 : 59 : N : 91 : 12 : 0 : E : 8.0 : CH
Lhasa : Tibet : China : 29 : 40 : 59 : N : 91 : 12 : 0 : E : 8.0 : CH
Libreville : : Gabon : 0 : 36 : 0 : N : 9 : 18 : 0 : E : 1.0 : --
Lihue : Hawaii : USA : 21 : 58 : 48 : N : 159 : 22 : 30 : W :-10.0 : US
Lima : Ohio : USA : 40 : 44 : 34 : N : 84 : 6 : 19 : W : -5.0 : US
......@@ -1457,7 +1457,7 @@ Montpelier : Vermont : USA
Montpellier : : France : 43 : 37 : 59 : N : 3 : 52 : 59 : E : 1.0 : EU
Montreal : Quebec : Canada : 45 : 30 : 0 : N : 73 : 34 : 47 : W : -5.0 : US
Moore : Oklahoma : USA : 35 : 20 : 12 : N : 97 : 29 : 17 : W : -6.0 : US
Moose Jaw : Saskatchewan : Canada : 50 : 22 : 11 : N : 105 : 31 : 48 : W : -6.0 : US
Moose Jaw : Saskatchewan : Canada : 50 : 22 : 11 : N : 105 : 31 : 48 : W : -6.0 : --
Morehead : Kentucky : USA : 38 : 10 : 1 : N : 83 : 25 : 1 : W : -5.0 : US
Morgan City : Louisiana : USA : 29 : 41 : 53 : N : 91 : 12 : 24 : W : -6.0 : US
Morgantown : West Virginia : USA : 39 : 37 : 54 : N : 79 : 57 : 11 : W : -5.0 : US
......@@ -1787,7 +1787,7 @@ Prescott : Arizona : USA
Preston : Idaho : USA : 42 : 4 : 58 : N : 111 : 54 : 0 : W : -7.0 : US
Pretoria : : South Africa : 25 : 51 : 0 : S : 28 : 0 : 0 : E : 2.0 : --
Primghar : Iowa : USA : 43 : 2 : 59 : N : 95 : 20 : 59 : W : -6.0 : US
Prince Albert : Saskatchewan : Canada : 55 : 23 : 48 : N : 111 : 7 : 30 : W : -6.0 : US
Prince Albert : Saskatchewan : Canada : 55 : 23 : 48 : N : 111 : 7 : 30 : W : -6.0 : --
Prince George : British Columbia : Canada : 53 : 55 : 12 : N : 122 : 41 : 23 : W : -8.0 : US
Prince Rupert : British Columbia : Canada : 54 : 18 : 36 : N : 130 : 22 : 47 : W : -8.0 : US
Princeton : Missouri : USA : 40 : 22 : 58 : N : 93 : 34 : 1 : W : -6.0 : US
......@@ -1833,7 +1833,7 @@ Redding : California : USA
Redondo Beach : California : USA : 33 : 49 : 36 : N : 118 : 23 : 13 : W : -8.0 : US
Redwood City : California : USA : 37 : 28 : 0 : N : 122 : 15 : 0 : W : -8.0 : US
Regensburg : : Germany : 49 : 01 : 00 : N : 12 : 06 : 00 : E : 1.0 : EU
Regina : Saskatchewan : Canada : 50 : 30 : 0 : N : 104 : 30 : 0 : W : -6.0 : US
Regina : Saskatchewan : Canada : 50 : 30 : 0 : N : 104 : 30 : 0 : W : -6.0 : --
Rehovot : : Israel : 31 : 53 : 49 : N : 34 : 49 : 8 : E : 2.0 : ZN
Reims : : France : 49 : 16 : 0 : N : 4 : 0 : 0 : E : 1.0 : EU
Remscheid : : Germany : 51 : 11 : 00 : N : 7 : 12 : 00 : E : 1.0 : EU
......@@ -1964,7 +1964,7 @@ Sapporo : : Japan
Sarajevo : : Bosnia and Herzegovina : 43 : 49 : 55 : N : 18 : 20 : 6 : E : 1.0 : EU
Sarasota : Florida : USA : 27 : 20 : 12 : N : 82 : 31 : 54 : W : -5.0 : US
Sargent : Nebraska : USA : 41 : 40 : 1 : N : 99 : 37 : 58 : W : -6.0 : US
Saskatoon : Saskatchewan : Canada : 52 : 8 : 59 : N : 106 : 35 : 59 : W : -6.0 : US
Saskatoon : Saskatchewan : Canada : 52 : 8 : 59 : N : 106 : 35 : 59 : W : -6.0 : --
Sault St. Marie : Michigan : USA : 46 : 28 : 58 : N : 84 : 20 : 59 : W : -5.0 : US
Savannah : Georgia : USA : 32 : 4 : 41 : N : 81 : 5 : 36 : W : -5.0 : US
Scarborough : Ontario : Canada : 43 : 40 : 12 : N : 79 : 22 : 12 : W : -5.0 : US
......@@ -2114,7 +2114,7 @@ Superior : Wisconsin : USA
Sutherland : : South Africa : 32 : 22 : 8 : S : 20 : 56 : 44 : E : 2.0 : --
Suwon : Gyeonggi : Korea : 37 : 16 : 0 : N : 126 : 09 : 0 : E : 9.0 : SK
Swannanoa : North Carolina : USA : 35 : 35 : 41 : N : 82 : 33 : 25 : W : -5.0 : US
Swift Current : Saskatchewan : Canada : 50 : 16 : 48 : N : 107 : 45 : 0 : W : -6.0 : US
Swift Current : Saskatchewan : Canada : 50 : 16 : 48 : N : 107 : 45 : 0 : W : -6.0 : --
Sydney : New South Wales : Australia : 33 : 54 : 59 : S : 151 : 16 : 59 : E :+10.0 : AU
Sydney : Nova Scotia : Canada : 46 : 8 : 24 : N : 60 : 4 : 47 : W : -4.0 : US
Syracuse : New York : USA : 43 : 3 : 3 : N : 76 : 9 : 14 : W : -5.0 : US
......
......@@ -1479,7 +1479,7 @@
1496 PER 04 04 31.8 +52 39 41 3 II1p 9.6 6.00
1497 TAU 04 02 06.8 +23 07 58 8 S0 14.3 1.80 1.2 60 14331 2929
1498 ERI 04 00 19.4 -12 01 12 0 *3
1499 PER 04 03 14.4 +36 22 03 5 EN 5.0 160.00 40.0 California Nebula
1499 PER 04 03 14.4 +36 22 03 5 EN 5.0 160.00 40.0 California Nebula
1500 DOR 03 58 14.0 -52 19 44 8 E 14.7 1.10 0.9 14187
1501 CAM 04 06 59.4 +60 55 15 6 PN 13.3 0.87
1502 CAM 04 07 49.2 +62 19 54 3 II3p 6.9 8.00
......@@ -6908,7 +6908,7 @@
6997 CYG 20 56 39.0 +44 37 54 3 III2 10.0 7.00
6998 MIC 21 01 37.7 -28 01 56 8 E 15.2 0.70 0.7 65925
6999 MIC 21 01 59.6 -28 03 34 8 S0 15.0 0.90 0.7 65940
7000 CYG 21 59 00.0 +44 31 00 5 EN 4.0 120.00 30.0 North American Nebula
7000 CYG 20 58 48.0 +44 20 00 5 EN 4.0 120.00 100.0 North American Nebula
7001 AQR 21 01 07.7 -00 11 43 8 Sab 14.3 1.40 1.1 162 65905 11663
7002 IND 21 03 45.0 -49 01 47 8 E 13.4 1.50 1.2 3 66009
7003 DEL 21 00 42.3 +17 48 15 8 Sb-c 13.8 1.10 0.8 120 65887 11662
......@@ -173,14 +173,22 @@ DetailDialog::RiseSetBox::RiseSetBox( SkyObject *o, QDateTime lt, GeoLocation *g
QTime LST = KSUtils::UTtoLST( ut, geo->lng() );
dms LSTd; LSTd.setH( LST.hour(), LST.minute(), LST.second() );
QTime rt = o->riseTime( jd, geo );
//QTime tt = o->transitTime( lt, LSTd );
dms raz = o->riseSetTimeAz(jd, geo, true ); //true = use rise time
//If transit time is before rise time, use transit time for tomorrow
QTime tt = o->transitTime( jd, geo );
dms talt = o->transitAltitude( jd, geo );
if ( tt < rt ) {
tt = o->transitTime( jd+1.0, geo );
talt = o->transitAltitude( jd+1.0, geo );
}
//If set time is before rise time, use transit time for tomorrow
QTime st = o->setTime( jd, geo );
dms raz = o->riseSetTimeAz(jd, geo, true ); //true = use rise time
dms saz = o->riseSetTimeAz(jd, geo, false ); //false = use set time
//dms talt = o->transitAltitude( geo );
dms talt = o->transitAltitude( jd, geo );
if ( st < rt ) {
st = o->setTime( jd+1.0, geo );
saz = o->riseSetTimeAz(jd+1.0, geo, false ); //false = use set time
}
RTimeLabel = new QLabel( i18n( "Rise time:" ), this );
TTimeLabel = new QLabel( i18n( "Transit time:" ), this );
......
......@@ -27,7 +27,6 @@
#include <qhbox.h>
#include <qlineedit.h>
#include <qstring.h>
#include <qregexp.h>
#include <qwidget.h>
#include <qregexp.h>
......
......@@ -30,6 +30,9 @@ void KSNumbers::updateValues( long double jd ) {
//Julian Centuries since J2000.0
T = ( jd - J2000 ) / 36525.;
//Julian Centuries since B1950.0
TB = ( jd - 2433282.4235 ) / 36524.2199;
// Julian Millenia since J2000.0
jm = T / 10.0;
......@@ -115,4 +118,39 @@ void KSNumbers::updateValues( long double jd ) {
P2[0][2] = CX*SY;
P2[1][2] = -1.0*SX*SY;
P2[2][2] = CY;
// eqnCorr.setD ( (0.0775 + 0.0850 * TB)/3600. );
//Compute Precession Matrices from B1950 to 1984 using Newcomb formulae
XB.setD( 0.217697 );
YB.setD( 0.189274 );
ZB.setD( 0.217722 );
XB.SinCos( SXB, CXB );
YB.SinCos( SYB, CYB );
ZB.SinCos( SZB, CZB );
//P1B is used to precess from 1984 to B1950:
P1B[0][0] = CXB*CYB*CZB - SXB*SZB;
P1B[1][0] = CXB*CYB*SZB + SXB*CZB;
P1B[2][0] = CXB*SYB;
P1B[0][1] = -1.0*SXB*CYB*CZB - CXB*SZB;
P1B[1][1] = -1.0*SXB*CYB*SZB + CXB*CZB;
P1B[2][1] = -1.0*SXB*SYB;
P1B[0][2] = -1.0*SYB*CZB;
P1B[1][2] = -1.0*SYB*SZB;
P1B[2][2] = CYB;
//P2 is used to precess from B1950 to 1984 (it is the transpose of P1)
P2B[0][0] = CXB*CYB*CZB - SXB*SZB;
P2B[1][0] = -1.0*SXB*CYB*CZB - CXB*SZB;
P2B[2][0] = -1.0*SYB*CZB;
P2B[0][1] = CXB*CYB*SZB + SXB*CZB;
P2B[1][1] = -1.0*SXB*CYB*SZB + CXB*CZB;
P2B[2][1] = -1.0*SYB*SZB;
P2B[0][2] = CXB*SYB;
P2B[1][2] = -1.0*SXB*SYB;
P2B[2][2] = CYB;
}
......@@ -85,19 +85,26 @@ public:
/**@returns element of P1 precession array at position [i1][i2] */
double p1( int i1, int i2 ) const { return P1[i1][i2]; }
/**@returns element of P1 precession array at position [i1][i2] */
double p1b( int i1, int i2 ) const { return P1B[i1][i2]; }
/**@returns element of P2 precession array at position [i1][i2] */
double p2( int i1, int i2 ) const { return P2[i1][i2]; }
/**@returns element of P2 precession array at position [i1][i2] */
double p2b( int i1, int i2 ) const { return P2B[i1][i2]; }
/**@short update all values for the date given as an argument. */
void updateValues( long double jd );
private:
dms Obliquity, K, L, L0, LM, M, M0, O, P;
dms XP, YP, ZP;
dms XP, YP, ZP, XB, YB, ZB;
double CX, SX, CY, SY, CZ, SZ;
double P1[3][3], P2[3][3];
double CXB, SXB, CYB, SYB, CZB, SZB;
double P1[3][3], P2[3][3], P1B[3][3], P2B[3][3];
double deltaObliquity, deltaEcLong;
double e, T;
double e, T, TB;
long double days;
double jm;
......
......@@ -17,7 +17,7 @@
#include <qstring.h>
#include <qimage.h>
#include <qvector.h>
#include <qptrvector.h>
#include <qdict.h>
#include "ksplanetbase.h"
#include "dms.h"
......
......@@ -91,7 +91,6 @@ KStars::KStars( KStarsData* kd )
KStars::~KStars()
{
kdDebug() << "in kstars destructor..." << endl;
saveOptions();
clearCachedFindDialog();
......
......@@ -9,6 +9,7 @@ Comment=Desktop Planetarium
Comment[af]=Werkskerm Planetarium
Comment[bg]=Планетариум за рабоно място
Comment[bs]=Planetarium na desktopu
Comment[ca]=Planetari per a l'escriptori
Comment[da]=Planetarieprogram
Comment[de]=Das Planetarium für den Schreibtisch
Comment[el]=Πλανητάριο για την επιφάνεια εργασίας
......@@ -18,14 +19,17 @@ Comment[fr]=Planétarium pour le bureau
Comment[he]=פלנטריום שולחני
Comment[hr]=Planetarij za radnu površinu
Comment[hu]=mini planetárium
Comment[is]=Planetarium á skjáborðið
Comment[it]=Planetario per il desktop
Comment[ja]=デスクトッププラネタリウム
Comment[lt]=Darbastalio planetariumas
Comment[lv]=Darbvirsmas Planetārijs
Comment[mn]=Дэлгэцэн дээрх Оддын Хотхон
Comment[nb]=Skrivebordsplanetarium
Comment[nl]=Desktop-planetarium
Comment[nn]=Skrivebordsplanetarium
Comment[nso]=Planetarium ya Desktop
Comment[pl]=Planetarium na pulpicie
Comment[pt]=Planetário
Comment[pt_BR]=Planetário do Ambiente de trabalho
Comment[ru]=Настольный планетарий
......@@ -42,6 +46,7 @@ Terminal=0
Name=KStars
Name[af]=K-sterre
Name[fo]=KStjørnur
Name[mn]=K-Од
Name[pl]=Gwiazdy
Name[pt_BR]=Estrelas
Name[sv]=Kstars
......
......@@ -22,9 +22,15 @@
void KStars::loadOptions()
{
KConfig *conf = kapp->config();
//Check if kstarsrc exists. If not, we are using default options (need to know for setting initial focus point)
if ( conf->hasGroup( "Location" ) ) useDefaultOptions = false;
else useDefaultOptions = true;
//Check if kstarsrc exists. If not, we are using default options
//(need to know for setting initial focus point).
//We used to use hasGroup() here, but I have reason to suspect that this
//this causes a crash on some systems (see bug #44869). At Kevin
//Krammer's suggestion, using findResource("kstarsrc") instead.
//if ( conf->hasGroup( "Location" ) ) useDefaultOptions = false;
//else useDefaultOptions = true;
if ( data()->stdDirs->findResource( "config", "kstarsrc" ).isNull() ) useDefaultOptions = true;
else useDefaultOptions = false;
// Get initial Location from config()
conf->setGroup( "Location" );
......
......@@ -304,7 +304,7 @@ void KStars::initActions() {
void KStars::initStatusBar() {
statusBar()->insertItem( i18n( " Welcome to KStars " ), 0, 1, true );
statusBar()->setItemAlignment( 0, AlignLeft | AlignVCenter );
QString s = "00:00:00, +00:00:00";
QString s = "00h 00m 00s, +00d 00\'00\"";
statusBar()->insertItem( s, 1, 1, true );
statusBar()->setItemAlignment( 1, AlignRight | AlignVCenter );
......@@ -366,10 +366,33 @@ void KStars::datainitFinished(bool worked) {
pd->buildGUI();
updateTime();
clock->start();
show();
//Check whether initial position is below the horizon.
//We sued to just call slotCenter() in buildGUI() which performs this check.
//However, on a Gentoo system, if the messagebox is shown before show() is called,
//the program exits. It does not crash (at least there are no error messages),
//it simply exits. Very strange.
if ( options()->useAltAz && options()->drawGround &&
map()->focus()->alt().Degrees() < -1.0 ) {
QString caption = i18n( "Initial Position is Below Horizon" );
QString message = i18n( "The initial position is below the horizon.\nWould you like to reset to the default position?" );
if ( KMessageBox::warningYesNo( this, message, caption,
KStdGuiItem::yes(), KStdGuiItem::no(), "dag_start_below_horiz" ) == KMessageBox::Yes ) {
map()->setClickedObject( NULL );
map()->setFoundObject( NULL );
options()->isTracking = false;
options()->setSnapNextFocus(true);
SkyPoint DefaultFocus;
DefaultFocus.setAz( 180.0 );
DefaultFocus.setAlt( 45.0 );
DefaultFocus.HorizontalToEquatorial( LSTh(), geo()->lat() );
map()->setDestination( &DefaultFocus );
}
}
// just show dialog if option is set (don't force it)
KTipDialog::showTip( "kstars/tips" );
}
......@@ -493,21 +516,22 @@ void KStars::privatedata::buildGUI() {
}
}
ks->map()->slotCenter();
// ks->map()->slotCenter();
} else {
ks->map()->setClickedPoint( &newPoint );
ks->map()->slotCenter();
// ks->map()->slotCenter();
}
ks->map()->setDestination( ks->map()->clickedPoint() );
ks->map()->destination()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->map()->setFocus( ks->map()->destination() );
ks->map()->focus()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->map()->destination()->EquatorialToHorizontal( ks->LSTh(), ks->geo()->lat() );
ks->setHourAngle();
ks->map()->setOldFocus( ks->map()->focus() );
ks->map()->oldfocus()->setAz( ks->map()->focus()->az() );
ks->map()->oldfocus()->setAlt( ks->map()->focus()->alt() );
ks->map()->oldfocus()->setAz( ks->map()->focus()->az().Degrees() );
ks->map()->oldfocus()->setAlt( ks->map()->focus()->alt().Degrees() );
kapp->dcopClient()->resume();
......
......@@ -19,7 +19,6 @@
#include "modcalcprec.h"
#include "dms.h"
#include "dmsbox.h"
#include "timebox.h"
#include "skyobject.h"
#include "ksutils.h"
#include "kssun.h"
......@@ -288,6 +287,7 @@ void modCalcDayLength::slotComputePosTime()
{
long double jd0 = computeJdFromCalendar();
getGeoLocation();
KSNumbers * num = new KSNumbers(jd0);
KSSun *Sun = new KSSun((KStars*) parent()->parent()->parent());
......
......@@ -14,7 +14,6 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "modcalcprec.h"
#include "modcalcprec.moc"
#include "dms.h"
......@@ -47,7 +46,7 @@ modCalcPrec::modCalcPrec(QWidget *parentSplit, const char *name) : QWidget(paren
InputBox->setTitle( i18n("Original Coordinates") );
QHBox * buttonBox = new QHBox(InputBox);
QPushButton * Compute = new QPushButton( i18n( "Compute" ), buttonBox);
QPushButton * Clear = new QPushButton( i18n( "Clear" ), buttonBox );
......@@ -112,7 +111,7 @@ modCalcPrec::modCalcPrec(QWidget *parentSplit, const char *name) : QWidget(paren
epochfBox->setMargin(6);
epochfBox->setSpacing(6);
D1Lay->setMargin(14);
D1Lay->addWidget(rafdecfBox);
......@@ -167,7 +166,7 @@ double modCalcPrec::setCurrentEpoch () {
}
double modCalcPrec::getEpoch (QString eName) {
double epoch = eName.toDouble();
return epoch;
......@@ -187,7 +186,7 @@ void modCalcPrec::slotClearCoords (void) {
void modCalcPrec::slotComputeCoords (void) {
SkyPoint sp;
sp = getEquCoords();
double epoch0 = getEpoch( epoch0Name->text() );
double epochf = getEpoch( epochfName->text() );
......@@ -200,7 +199,7 @@ void modCalcPrec::showEquCoords ( SkyPoint sp ) {
rafBox->show( sp.ra() );
decfBox->show( sp.dec() );
}
double modCalcPrec::JdtoEpoch (long double jd) {
......@@ -223,74 +222,210 @@ long double modCalcPrec::epochToJd (double epoch) {
}
SkyPoint modCalcPrec::precess (dms RA0, dms Dec0, double epoch0, double epochf) {
SkyPoint modCalcPrec::B1950ToJ2000 (dms RA0, dms Dec0) {
double cosRA0, sinRA0, cosDec0, sinDec0;
dms RA, Dec;
double v[3], s[3];
double v[3], s[3];
long double jd0 = epochToJd ( epoch0 );
long double jdf = epochToJd ( epochf );
// 1984 January 1 0h
KSNumbers *num = new KSNumbers (2445700.5);
RA0.SinCos( sinRA0, cosRA0 );
Dec0.SinCos( sinDec0, cosDec0 );
// Eterms due to aberration
SkyPoint sPoint = SkyPoint (RA0, Dec0);
sPoint.addEterms();
sPoint.ra().SinCos( sinRA0, cosRA0 );
sPoint.dec().SinCos( sinDec0, cosDec0 );
//Need to first precess to J2000.0 coords
// Precession from B1950 to J1984
s[0] = cosRA0*cosDec0;
s[1] = sinRA0*cosDec0;
s[2] = sinDec0;
for ( unsigned int i=0; i<3; ++i ) {
v[i] = num->p2b( 0, i )*s[0] + num->p2b( 1, i )*s[1] +
num->p2b( 2, i )*s[2];
}
if ( jd0 != J2000 ) {
//v is a column vector representing input coordinates.
// RA zero-point correction at 1984 day 1, 0h.
RA.setRadians( atan2( v[1],v[0] ) );
Dec.setRadians( asin( v[2] ) );
KSNumbers *num = new KSNumbers (jd0);
RA.setH( RA.Hours() + 0.06390/3600. );
RA.SinCos( sinRA0, cosRA0 );
Dec.SinCos( sinDec0, cosDec0 );
v[0] = cosRA0*cosDec0;
v[1] = sinRA0*cosDec0;
v[2] = sinDec0;
s[0] = cosRA0*cosDec0;
s[1] = sinRA0*cosDec0;
s[2] = sinDec0;
//s is the product of P1 and v; s represents the
//coordinates precessed to J2000
for ( unsigned int i=0; i<3; ++i ) {
s[i] = num->p1( 0, i )*v[0] + num->p1( 1, i )*v[1] +
num->p1( 2, i )*v[2];
}
delete num;
// Precession from 1984 to J2000.
} else {
//Input coords already in J2000, set s accordingly.
s[0] = cosRA0*cosDec0;
s[1] = sinRA0*cosDec0;
s[2] = sinDec0;
for ( unsigned int i=0; i<3; ++i ) {
v[i] = num->p1( 0, i )*s[0] +
num->p1( 1, i )*s[1] +
num->p1( 2, i )*s[2];
}
KSNumbers *num = new KSNumbers (jdf);
//Multiply P2 and s to get v, the vector representing the new coords.
RA.setRadians( atan2( v[1],v[0] ) );
Dec.setRadians( asin( v[2] ) );
delete num;
sPoint.setRA(RA);
sPoint.setDec(Dec);
return sPoint;
}
SkyPoint modCalcPrec::J2000ToB1950 (dms RA0, dms Dec0) {
double cosRA0, sinRA0, cosDec0, sinDec0;
dms RA, Dec;
double v[3], s[3];
// 1984 January 1 0h
KSNumbers *num = new KSNumbers (2445700.5);
RA0.SinCos(sinRA0,cosRA0);
Dec0.SinCos(sinDec0,cosDec0);
s[0] = cosRA0*cosDec0;
s[1] = sinRA0*cosDec0;
s[2] = sinDec0;
// Precession from 1984 to J2000.
for ( unsigned int i=0; i<3; ++i ) {
v[i] = num->p2( 0, i )*s[0] + num->p2( 1, i )*s[1] +
v[i] = num->p2( 0, i )*s[0] +
num->p2( 1, i )*s[1] +
num->p2( 2, i )*s[2];
}
delete num;
//Extract RA, Dec from the vector:
// RA.setRadians( atan( v[1]/v[0] ) );
RA.setRadians( atan2( v[1],v[0] ) );
Dec.setRadians( asin( v[2] ) );
//resolve ambiguity of atan()
// if ( v[0] < 0.0 ) {
// RA.setD( RA.Degrees() + 180.0 );
// } else if( v[1] < 0.0 ) {
// RA.setD( RA.Degrees() + 360.0 );
// }
// RA zero-point correction at 1984 day 1, 0h.
RA.setH( RA.Hours() - 0.06390/3600. );
RA.SinCos( sinRA0, cosRA0 );
Dec.SinCos( sinDec0, cosDec0 );
// Precession from B1950 to J1984
s[0] = cosRA0*cosDec0;
s[1] = sinRA0*cosDec0;
s[2] = sinDec0;
for ( unsigned int i=0; i<3; ++i ) {
v[i] = num->p1b( 0, i )*s[0] + num->p1b( 1, i )*s[1] +
num->p1b( 2, i )*s[2];
}
if (RA.Degrees() < 0.0 )
RA.setD( RA.Degrees() + 360.0 );
RA.setRadians( atan2( v[1],v[0] ) );
Dec.setRadians( asin( v[2] ) );
// Eterms due to aberration
SkyPoint sPoint = SkyPoint (RA, Dec);
sPoint.subtractEterms();
delete num;
return sPoint;
}
SkyPoint modCalcPrec::precess (dms RA0, dms Dec0, double epoch0, double epochf) {
double cosRA0, sinRA0, cosDec0, sinDec0;
dms RA, Dec;
double v[3], s[3];
long double jd0 = epochToJd ( epoch0 );
long double jdf = epochToJd ( epochf );
RA0.SinCos( sinRA0, cosRA0 );
Dec0.SinCos( sinDec0, cosDec0 );
if ( jd0 == B1950) {
SkyPoint sp = SkyPoint(RA0, Dec0);
sp.B1950ToJ2000();
RA0.setD( sp.ra().Degrees() );
Dec0.setD( sp.dec().Degrees() );
jd0 = J2000;
}
if (jd0 !=jdf) {
// The original coordinate is referred to the FK5 system and
// is NOT J2000.
if ( jd0 != J2000 ) {
//v is a column vector representing input coordinates.
KSNumbers *num = new KSNumbers (jd0);
v[0] = cosRA0*cosDec0;
v[1] = sinRA0*cosDec0;
v[2] = sinDec0;
//Need to first precess to J2000.0 coords
//s is the product of P1 and v; s represents the
//coordinates precessed to J2000
for ( unsigned int i=0; i<3; ++i ) {
s[i] = num->p1( 0, i )*v[0] +
num->p1( 1, i )*v[1] +