本文整理汇总了C++中SkyPoint::set方法的典型用法代码示例。如果您正苦于以下问题:C++ SkyPoint::set方法的具体用法?C++ SkyPoint::set怎么用?C++ SkyPoint::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkyPoint
的用法示例。
在下文中一共展示了SkyPoint::set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromScreen
SkyPoint EquirectangularProjector::fromScreen(const QPointF& p, dms* LST, const dms* lat) const
{
SkyPoint result;
//Convert pixel position to x and y offsets in radians
double dx = (0.5*m_vp.width - p.x())/m_vp.zoomFactor;
double dy = (0.5*m_vp.height - p.y())/m_vp.zoomFactor;
if ( m_vp.useAltAz ) {
dms az, alt;
dx = -1.0*dx; //Azimuth goes in opposite direction compared to RA
az.setRadians( dx + m_vp.focus->az().radians() );
alt.setRadians( dy + m_vp.focus->alt().radians() );
result.setAz( az.reduce() );
if ( m_vp.useRefraction )
alt = SkyPoint::unrefract( alt );
result.setAlt( alt );
result.HorizontalToEquatorial( LST, lat );
return result;
} else {
dms ra, dec;
ra.setRadians( dx + m_vp.focus->ra().radians() );
dec.setRadians( dy + m_vp.focus->dec().radians() );
result.set( ra.reduce(), dec );
result.EquatorialToHorizontal( LST, lat );
return result;
}
}
示例2: fromScreen
SkyPoint Projector::fromScreen(const QPointF& p, dms* LST, const dms* lat) const
{
dms c;
double sinc, cosc;
/** N.B. We don't cache these sin/cos values in the inverse
* projection because it causes 'shaking' when moving the sky.
*/
double sinY0, cosY0;
//Convert pixel position to x and y offsets in radians
double dx = (0.5*m_vp.width - p.x())/m_vp.zoomFactor;
double dy = (0.5*m_vp.height - p.y())/m_vp.zoomFactor;
double r = sqrt( dx*dx + dy*dy );
c.setRadians( projectionL(r) );
c.SinCos( sinc, cosc );
if( m_vp.useAltAz ) {
dx = -1.0*dx; //Azimuth goes in opposite direction compared to RA
m_vp.focus->alt().SinCos( sinY0, cosY0 );
} else {
m_vp.focus->dec().SinCos( sinY0, cosY0 );
}
double Y = asin( cosc*sinY0 + ( dy*sinc*cosY0 )/r );
double atop = dx*sinc;
double abot = r*cosY0*cosc - dy*sinY0*sinc;
double A = atan2( atop, abot );
SkyPoint result;
if ( m_vp.useAltAz ) {
dms alt, az;
alt.setRadians( Y );
az.setRadians( A + m_vp.focus->az().radians() );
if ( m_vp.useRefraction )
alt = SkyPoint::unrefract( alt );
result.setAlt( alt );
result.setAz( az );
result.HorizontalToEquatorial( LST, lat );
} else {
dms ra, dec;
dec.setRadians( Y );
ra.setRadians( A + m_vp.focus->ra().radians() );
result.set( ra.reduce(), dec );
result.EquatorialToHorizontal( LST, lat );
}
return result;
}
示例3: 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);
}
示例4: GetAllObjects
void CatalogDB::GetAllObjects(const QString &catalog,
QList< SkyObject* > &sky_list,
QList < QPair <int, QString> > &object_names,
CatalogComponent *catalog_ptr) {
sky_list.clear();
QString selected_catalog = QString::number(FindCatalog(catalog));
skydb_.open();
QSqlQuery get_query(skydb_);
get_query.prepare("SELECT Epoch, Type, RA, Dec, Magnitude, Prefix, "
"IDNumber, LongName, MajorAxis, MinorAxis, "
"PositionAngle, Flux FROM ObjectDesignation JOIN DSO "
"JOIN Catalog WHERE Catalog.id = :catID AND "
"ObjectDesignation.id_Catalog = Catalog.id AND "
"ObjectDesignation.UID_DSO = DSO.UID");
get_query.bindValue("catID", selected_catalog);
// kWarning() << get_query.lastQuery();
// kWarning() << get_query.lastError();
// kWarning() << FindCatalog(catalog);
if (!get_query.exec()) {
kWarning() << get_query.lastQuery();
kWarning() << get_query.lastError();
}
while (get_query.next()) {
int cat_epoch = get_query.value(0).toInt();
unsigned char iType = get_query.value(1).toInt();
dms RA(get_query.value(2).toDouble());
dms Dec(get_query.value(3).toDouble());
float mag = get_query.value(4).toFloat();
QString catPrefix = get_query.value(5).toString();
int id_number_in_catalog = get_query.value(6).toInt();
QString lname = get_query.value(7).toString();
float a = get_query.value(8).toFloat();
float b = get_query.value(9).toFloat();
float PA = get_query.value(10).toFloat();
float flux = get_query.value(11).toFloat();
QString name = catPrefix + ' ' + QString::number(id_number_in_catalog);
SkyPoint t;
t.set(RA, Dec);
if (cat_epoch == 1950) {
// Assume B1950 epoch
t.B1950ToJ2000(); // t.ra() and t.dec() are now J2000.0
// coordinates
} else if (cat_epoch == 2000) {
// Do nothing
{ }
} else {
// FIXME: What should we do?
// FIXME: This warning will be printed for each line in the
// catalog rather than once for the entire catalog
kWarning() << "Unknown epoch while dealing with custom "
"catalog. Will ignore the epoch and assume"
" J2000.0";
}
RA = t.ra();
Dec = t.dec();
if (iType == 0) { // Add a star
StarObject *o = new StarObject(RA, Dec, mag, lname);
sky_list.append(o);
} else { // Add a deep-sky object
DeepSkyObject *o = new DeepSkyObject(iType, RA, Dec, mag,
name, QString(), lname,
catPrefix, a, b, -PA);
o->setFlux(flux);
o->setCustomCatalog(catalog_ptr);
sky_list.append(o);
// Add name to the list of object names
if (!name.isEmpty()) {
object_names.append(qMakePair<int,QString>(iType, name));
}
}
if (!lname.isEmpty() && lname != name) {
object_names.append(qMakePair<int,QString>(iType, lname));
}
}
get_query.clear();
skydb_.close();
}