本文整理汇总了C++中SkyPoint::dec方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyPoint::dec方法的具体用法?C++ SkyPoint::dec怎么用?C++ SkyPoint::dec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyPoint
的用法示例。
在下文中一共展示了SkyPoint::dec方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: riseSetTimeUT
QTime SkyObject::riseSetTimeUT( const KStarsDateTime &dt, const GeoLocation *geo, bool riseT ) {
// First trial to calculate UT
QTime UT = auxRiseSetTimeUT( dt, geo, ra(), dec(), riseT );
// We iterate once more using the calculated UT to compute again
// the ra and dec for that time and hence the rise/set time.
// Also, adjust the date by +/- 1 day, if necessary
KStarsDateTime dt0 = dt;
dt0.setTime( UT );
if ( riseT && dt0 > dt ) {
dt0 = dt0.addDays( -1 );
} else if ( ! riseT && dt0 < dt ) {
dt0 = dt0.addDays( 1 );
}
SkyPoint sp = recomputeCoords( dt0, geo );
UT = auxRiseSetTimeUT( dt0, geo, sp.ra(), sp.dec(), riseT );
// We iterate a second time (For the Moon the second iteration changes
// aprox. 1.5 arcmin the coordinates).
dt0.setTime( UT );
sp = recomputeCoords( dt0, geo );
UT = auxRiseSetTimeUT( dt0, geo, sp.ra(), sp.dec(), riseT );
return UT;
}
示例2: addEterms
void SkyPoint::addEterms(void) {
SkyPoint spd = Eterms();
RA = RA + spd.ra();
Dec = Dec + spd.dec();
}
示例3: bendlight
bool SkyPoint::bendlight() {
// NOTE: This should be applied before aberration
// NOTE: One must call checkBendLight() before unnecessarily calling this.
// We correct for GR effects
// NOTE: This code is buggy. The sun needs to be initialized to
// the current epoch -- but we are not certain that this is the
// case. We have, as of now, no way of telling if the sun is
// initialized or not. If we initialize the sun here, we will be
// slowing down the program rather substantially and potentially
// introducing bugs. Therefore, we just ignore this problem, and
// hope that whenever the user is interested in seeing the effects
// of GR, we have the sun initialized correctly. This is usually
// the case. When the sun is not correctly initialized, rearth()
// is not computed, so we just assume it is nominally equal to 1
// AU to get a reasonable estimate.
Q_ASSERT( m_Sun );
double corr_sec = 1.75 * m_Sun->physicalSize() / ( ( std::isfinite( m_Sun->rearth() ) ? m_Sun->rearth() : 1 ) * AU_KM * angularDistanceTo( static_cast<const SkyPoint *>(m_Sun) ).sin() );
Q_ASSERT( corr_sec > 0 );
SkyPoint sp = moveAway( *m_Sun, corr_sec );
setRA( sp.ra() );
setDec( sp.dec() );
return true;
}
示例4: moveAway
SkyPoint SkyPoint::moveAway( const SkyPoint &from, double dist ) const {
dms lat1, dtheta;
if( dist == 0.0 ) {
qDebug() << "moveAway called with zero distance!";
return *this;
}
double dst = fabs( dist * dms::DegToRad / 3600.0 ); // In radian
// Compute the bearing angle w.r.t. the RA axis ("latitude")
dms dRA( ra() - from.ra() );
dms dDec( dec() - from.dec() );
double bearing = atan2( dRA.sin() / dRA.cos(), dDec.sin() ); // Do not use dRA = PI / 2!!
//double bearing = atan2( dDec.radians() , dRA.radians() );
double dir0 = (dist >= 0 ) ? bearing : bearing + dms::PI; // in radian
dist = fabs( dist ); // in radian
lat1.setRadians( asin( dec().sin() * cos( dst ) +
dec().cos() * sin( dst ) * cos( dir0 ) ) );
dtheta.setRadians( atan2( sin( dir0 ) * sin( dst ) * dec().cos(),
cos( dst ) - dec().sin() * lat1.sin() ) );
return SkyPoint( ra() + dtheta, lat1 );
}
示例5: drawCompassLabels
void Ecliptic::drawCompassLabels() {
const Projector* proj = SkyMap::Instance()->projector();
KStarsData* data = KStarsData::Instance();
SkyLabeler* skyLabeler = SkyLabeler::Instance();
// Set proper color for labels
QColor color( data->colorScheme()->colorNamed( "CompassColor" ) );
skyLabeler->setPen( QPen( QBrush(color), 1, Qt::SolidLine) );
KSNumbers num( data->ut().djd() );
dms elat(0.0), elng(0.0);
QString label;
for( int ra = 0; ra < 23; ra += 6 ) {
elng.setH( ra );
SkyPoint o;
o.setFromEcliptic( num.obliquity(), elng, elat );
o.setRA0( o.ra() );
o.setDec0( o.dec() );
o.EquatorialToHorizontal( data->lst(), data->geo()->lat() );
bool visible;
QPointF cpoint = proj->toScreen( &o, false, &visible );
if( visible && proj->checkVisibility( &o ) ) {
label.setNum( o.ra().reduce().Degrees() );
skyLabeler->drawGuideLabel( cpoint, label, 0.0 );
}
}
}
示例6: num
Ecliptic::Ecliptic(SkyComposite *parent ) :
LineListIndex( parent, i18n("Ecliptic") ),
m_label( name() )
{
KStarsData *data = KStarsData::Instance();
KSNumbers num( data->ut().djd() );
dms elat(0.0), elng(0.0);
const double eps = 0.1;
const double minRa = 0.0;
const double maxRa = 23.0;
const double dRa = 2.0;
const double dRa2 = 2. / 5.;
for(double ra = minRa; ra < maxRa; ra += dRa ) {
LineList* lineList = new LineList();
for(double ra2 = ra; ra2 <= ra + dRa + eps; ra2 += dRa2 ) {
elng.setH( ra2 );
SkyPoint* o = new SkyPoint();
o->setFromEcliptic( num.obliquity(), elng, elat );
o->setRA0( o->ra().Hours() );
o->setDec0( o->dec().Degrees() );
o->EquatorialToHorizontal( data->lst(), data->geo()->lat() );
lineList->append( o );
}
appendLine( lineList );
}
}
示例7: slotCompute
void modCalcAltAz::slotCompute()
{
//Determine whether we are calculating Alt/Az coordinates from RA/Dec,
//or vice versa. We calculate Alt/Az by default, unless the signal
//was sent by changing the Az or Alt value.
if ( sender()->objectName() == "Az" || sender()->objectName() == "Alt" ) {
//Validate Az and Alt coordinates
bool ok( false );
dms alt;
dms az = Az->createDms( true, &ok );
if ( ok ) alt = Alt->createDms( true, &ok );
if ( ok ) {
SkyPoint sp;
sp.setAz( az );
sp.setAlt( alt );
sp.HorizontalToEquatorial( &LST, geoPlace->lat() );
RA->showInHours( sp.ra() );
Dec->showInDegrees( sp.dec() );
}
} else {
//Validate RA and Dec coordinates
bool ok( false );
dms ra;
dms dec = Dec->createDms( true, &ok );
if ( ok ) ra = RA->createDms( false, &ok );
if ( ok ) {
SkyPoint sp( ra, dec );
sp.EquatorialToHorizontal( &LST, geoPlace->lat() );
Az->showInDegrees( sp.az() );
Alt->showInDegrees( sp.alt() );
}
}
}
示例8: subtractEterms
void SkyPoint::subtractEterms(void) {
SkyPoint spd = Eterms();
RA = RA - spd.ra();
Dec = Dec - spd.dec();
}
示例9: bendlight
bool SkyPoint::bendlight() {
// NOTE: This should be applied before aberration
// NOTE: One must call checkBendLight() before unnecessarily calling this.
// We correct for GR effects
Q_ASSERT( m_Sun );
double corr_sec = 1.75 * m_Sun->physicalSize() / ( m_Sun->rearth() * AU_KM * angularDistanceTo( static_cast<const SkyPoint *>(m_Sun) ).sin() );
Q_ASSERT( corr_sec > 0 );
SkyPoint sp = moveAway( *m_Sun, corr_sec );
setRA( sp.ra() );
setDec( sp.dec() );
return true;
}
示例10: findPA
void KSPlanetBase::findPA( const KSNumbers *num ) {
//Determine position angle of planet (assuming that it is aligned with
//the Ecliptic, which is only roughly correct).
//Displace a point along +Ecliptic Latitude by 1 degree
SkyPoint test;
dms newELat( ecLat().Degrees() + 1.0 );
test.setFromEcliptic( num->obliquity(), ecLong(), newELat );
double dx = ra().Degrees() - test.ra().Degrees();
double dy = test.dec().Degrees() - dec().Degrees();
double pa;
if ( dy ) {
pa = atan2( dx, dy )*180.0/dms::PI;
} else {
pa = dx < 0 ? 90.0 : -90.0;
}
setPA( pa );
}
示例11: vRSun
double SkyPoint::vRSun(long double jd0) {
double ca, sa, cd, sd, vsun;
double cosRA, sinRA, cosDec, sinDec;
/* Sun apex (where the sun goes) coordinates */
dms asun(270.9592); // Right ascention: 18h 3m 50.2s [J2000]
dms dsun(30.00467); // Declination: 30^o 0' 16.8'' [J2000]
vsun=20.; // [km/s]
asun.SinCos(sa,ca);
dsun.SinCos(sd,cd);
/* We need an auxiliary SkyPoint since we need the
* source referred to the J2000 equinox and we do not want to ovewrite
* the current values
*/
SkyPoint aux;
aux.set(RA0,Dec0);
aux.precessFromAnyEpoch(jd0, J2000);
aux.ra().SinCos( sinRA, cosRA );
aux.dec().SinCos( sinDec, cosDec );
/* Computation is done performing the scalar product of a unitary vector
in the direction of the source with the vector velocity of Sun, both being in the
LSR reference system:
Vlsr = Vhel + Vsun.u_radial =>
Vlsr = Vhel + vsun(cos D cos A,cos D sen A,sen D).(cos d cos a,cos d sen a,sen d)
Vhel = Vlsr - Vsun.u_radial
*/
return vsun *(cd*cosDec*(cosRA*ca + sa*sinRA) + sd*sinDec);
}
示例12: processLines
void modCalcVlsr::processLines( QTextStream &istream ) {
// we open the output file
// QTextStream istream(&fIn);
QString outputFileName;
outputFileName = OutputFileBoxBatch->url().toLocalFile();
QFile fOut( outputFileName );
fOut.open(QIODevice::WriteOnly);
QTextStream ostream(&fOut);
QString line;
QChar space = ' ';
int i = 0;
long double jd0;
SkyPoint spB;
double sra, cra, sdc, cdc;
dms raB, decB, latB, longB;
QString epoch0B;
double vhB, vgB, vtB, vlsrB, heightB;
double vtopo[3];
QTime utB;
QDate dtB;
KStarsDateTime dt0B;
while ( ! istream.atEnd() ) {
line = istream.readLine();
line.trimmed();
//Go through the line, looking for parameters
QStringList fields = line.split( ' ' );
i = 0;
// Read Ut and write in ostream if corresponds
if(UTCheckBatch->isChecked() ) {
utB = QTime::fromString( fields[i] );
i++;
} else
utB = UTBoxBatch->time();
if ( AllRadioBatch->isChecked() )
ostream << KGlobal::locale()->formatTime( utB ) << space;
else
if(UTCheckBatch->isChecked() )
ostream << KGlobal::locale()->formatTime( utB ) << space;
// Read date and write in ostream if corresponds
if(DateCheckBatch->isChecked() ) {
dtB = QDate::fromString( fields[i] );
i++;
} else
dtB = DateBoxBatch->date();
if ( AllRadioBatch->isChecked() )
ostream << KGlobal::locale()->formatDate( dtB, KLocale::LongDate ).append(space);
else
if(DateCheckBatch->isChecked() )
ostream << KGlobal::locale()->formatDate( dtB, KLocale::LongDate ).append(space);
// Read RA and write in ostream if corresponds
if(RACheckBatch->isChecked() ) {
raB = dms::fromString( fields[i],false);
i++;
} else
raB = RABoxBatch->createDms(false);
if ( AllRadioBatch->isChecked() )
ostream << raB.toHMSString() << space;
else
if(RACheckBatch->isChecked() )
ostream << raB.toHMSString() << space;
// Read DEC and write in ostream if corresponds
if(DecCheckBatch->isChecked() ) {
decB = dms::fromString( fields[i], true);
i++;
} else
decB = DecBoxBatch->createDms();
if ( AllRadioBatch->isChecked() )
ostream << decB.toDMSString() << space;
else
if(DecCheckBatch->isChecked() )
ostream << decB.toDMSString() << space;
// Read Epoch and write in ostream if corresponds
if(EpochCheckBatch->isChecked() ) {
epoch0B = fields[i];
i++;
} else
epoch0B = EpochBoxBatch->text();
if ( AllRadioBatch->isChecked() )
ostream << epoch0B << space;
//.........这里部分代码省略.........
示例13: processLines
void modCalcAzel::processLines( QTextStream &istream ) {
// we open the output file
// QTextStream istream(&fIn);
QString outputFileName;
outputFileName = OutputLineEditBatch->text();
QFile fOut( outputFileName );
fOut.open(IO_WriteOnly);
QTextStream ostream(&fOut);
QString line;
QString space = " ";
int i = 0;
long double jd0, jdf;
dms LST;
SkyPoint sp;
dms raB, decB, latB, longB, azB, elB;
double epoch0B;
QTime utB;
ExtDate dtB;
while ( ! istream.eof() ) {
line = istream.readLine();
line.stripWhiteSpace();
//Go through the line, looking for parameters
QStringList fields = QStringList::split( " ", line );
i = 0;
// Read Ut and write in ostream if corresponds
if(utCheckBatch->isChecked() ) {
utB = QTime::fromString( fields[i] );
i++;
} else
utB = utBoxBatch->time();
if ( allRadioBatch->isChecked() )
ostream << utB.toString() << space;
else
if(utCheckBatch->isChecked() )
ostream << utB.toString() << space;
// Read date and write in ostream if corresponds
if(dateCheckBatch->isChecked() ) {
dtB = ExtDate::fromString( fields[i] );
i++;
} else
dtB = dateBoxBatch->date();
if ( allRadioBatch->isChecked() )
ostream << dtB.toString().append(space);
else
if(dateCheckBatch->isChecked() )
ostream << dtB.toString().append(space);
// Read Longitude and write in ostream if corresponds
if (longCheckBatch->isChecked() ) {
longB = dms::fromString( fields[i],TRUE);
i++;
} else
longB = longBoxBatch->createDms(TRUE);
if ( allRadioBatch->isChecked() )
ostream << longB.toDMSString() << space;
else
if (longCheckBatch->isChecked() )
ostream << longB.toDMSString() << space;
// Read Latitude
if (latCheckBatch->isChecked() ) {
latB = dms::fromString( fields[i], TRUE);
i++;
} else
latB = latBoxBatch->createDms(TRUE);
if ( allRadioBatch->isChecked() )
ostream << latB.toDMSString() << space;
else
if (latCheckBatch->isChecked() )
ostream << latB.toDMSString() << space;
// Read Epoch and write in ostream if corresponds
if(epochCheckBatch->isChecked() ) {
epoch0B = fields[i].toDouble();
i++;
} else
epoch0B = getEpoch( epochBoxBatch->text() );
if ( allRadioBatch->isChecked() )
ostream << epoch0B << space;
else
if(epochCheckBatch->isChecked() )
ostream << epoch0B << space;
//.........这里部分代码省略.........
示例14: showEquCoords
void modCalcAzel::showEquCoords ( SkyPoint sp )
{
raBox->show( sp.ra(), FALSE );
decBox->show( sp.dec() );
showEpoch( getDateTime() );
}
示例15: kDebug
QList<const StarObject *> StarHopper::computePath( const SkyPoint &src, const SkyPoint &dest, float fov_, float maglim_ ) {
fov = fov_;
maglim = maglim_;
start = &src;
end = &dest;
came_from.clear();
result_path.clear();
// Implements the A* search algorithm
QList<SkyPoint const *> cSet;
QList<SkyPoint const *> oSet;
QHash<SkyPoint const *, double> g_score;
QHash<SkyPoint const *, double> f_score;
QHash<SkyPoint const *, double> h_score;
kDebug() << "StarHopper is trying to compute a path from source: " << src.ra().toHMSString() << src.dec().toDMSString() << " to destination: " << dest.ra().toHMSString() << dest.dec().toDMSString() << "; a starhop of " << src.angularDistanceTo( &dest ).Degrees() << " degrees!";
oSet.append( &src );
g_score[ &src ] = 0;
h_score[ &src ] = src.angularDistanceTo( &dest ).Degrees()/fov;
f_score[ &src ] = h_score[ &src ];
while( !oSet.isEmpty() ) {
kDebug() << "Next step";
// Find the node with the lowest f_score value
SkyPoint const *curr_node = NULL;
double lowfscore = 1.0e8;
foreach( const SkyPoint *sp, oSet ) {
if( f_score[ sp ] < lowfscore ) {
lowfscore = f_score[ sp ];
curr_node = sp;
}
}
kDebug() << "Lowest fscore (vertex distance-plus-cost score) is " << lowfscore << " with coords: " << curr_node->ra().toHMSString() << curr_node->dec().toDMSString() << ". Considering this node now.";
if( curr_node == &dest || (curr_node != &src && h_score[ curr_node ] < 0.5) ) {
// We are at destination
reconstructPath( came_from[ curr_node ] );
kDebug() << "We've arrived at the destination! Yay! Result path count: " << result_path.count();
// Just a test -- try to print out useful instructions to the debug console. Once we make star hopper unexperimental, we should move this to some sort of a display
kDebug() << "Star Hopping Directions: ";
const SkyPoint *prevHop = start;
foreach( const StarObject *hopStar, result_path ) {
QString direction;
double pa; // should be 0 to 2pi
dms angDist = prevHop->angularDistanceTo( hopStar, &pa );
dms dmsPA;
dmsPA.setRadians( pa );
direction = KSUtils::toDirectionString( dmsPA );
kDebug() << " Slew " << angDist.Degrees() << " degrees " << direction << " to find a " << hopStar->spchar() << " star of mag " << hopStar->mag();
prevHop = hopStar;
}
kDebug() << " The destination is within a field-of-view";
return result_path;
}