QTime SkyObject::transitTimeUT( const KStarsDateTime &dt, const GeoLocation *geo ) { dms LST = geo->GSTtoLST( dt.gst() ); //dSec is the number of seconds until the object transits. dms HourAngle = dms( LST.Degrees() - ra()->Degrees() ); int dSec = int( -3600.*HourAngle.Hours() ); //dt0 is the first guess at the transit time. KStarsDateTime dt0 = dt.addSecs( dSec ); //recompute object's position at UT0 and then find //transit time of this refined position SkyPoint sp = recomputeCoords( dt0, geo ); const dms *ram = sp.ra0(); HourAngle = dms ( LST.Degrees() - ram->Degrees() ); dSec = int( -3600.*HourAngle.Hours() ); return dt.addSecs( dSec ).time(); }
QTime SkyObject::riseSetTime( const KStarsDateTime &dt, const GeoLocation *geo, bool rst ) { //this object does not rise or set; return an invalid time if ( checkCircumpolar(geo->lat()) ) return QTime( 25, 0, 0 ); //First of all, if the object is below the horizon at date/time dt, adjust the time //to bring it above the horizon KStarsDateTime dt2 = dt; SkyPoint p = recomputeCoords( dt, geo ); p.EquatorialToHorizontal( &(geo->GSTtoLST( dt.gst() )), geo->lat() ); if ( p.alt()->Degrees() < 0.0 ) { if ( p.az()->Degrees() < 180.0 ) { //object has not risen yet dt2 = dt.addSecs( 12.*3600. ); } else { //object has already set dt2 = dt.addSecs( -12.*3600. ); } } return geo->UTtoLT( KStarsDateTime( dt2.date(), riseSetTimeUT( dt2, geo, rst ) ) ).time(); }
SkyPoint SkyPoint::timeTransformed( const SkyPoint *p, const KStarsDateTime &dt, const GeoLocation *geo, const double hour ) { Q_ASSERT( p ); if( !p ) return SkyPoint( NaN::d, NaN::d ); // Jasem 2015-08-24 Using correct procedure to find altitude SkyPoint sp = *p; // make a copy KStarsDateTime targetDateTime = dt.addSecs( hour * 3600.0 ); dms LST = geo->GSTtoLST( targetDateTime.gst() ); sp.EquatorialToHorizontal( &LST, geo->lat() ); return sp; }