Пример #1
0
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;
}
Пример #2
0
void KSPlanetBase::localizeCoords( const KSNumbers *num, const dms *lat, const dms *LST ) {
	//convert geocentric coordinates to local apparent coordinates (topocentric coordinates)
	dms HA, HA2; //Hour Angle, before and after correction
	double rsinp, rcosp, u, sinHA, cosHA, sinDec, cosDec, D;
	double cosHA2;
	double r = Rearth * AU_KM; //distance from Earth, in km
	u = atan( 0.996647*tan( lat->radians() ) );
	rsinp = 0.996647*sin( u );
	rcosp = cos( u );
	HA.setD( LST->Degrees() - ra()->Degrees() );
	HA.SinCos( sinHA, cosHA );
	dec()->SinCos( sinDec, cosDec );

	D = atan( ( rcosp*sinHA )/( r*cosDec/6378.14 - rcosp*cosHA ) );
	dms temp;
	temp.setRadians( ra()->radians() - D );
	setRA( temp );

	HA2.setD( LST->Degrees() - ra()->Degrees() );
	cosHA2 = cos( HA2.radians() );
	temp.setRadians( atan( cosHA2*( r*sinDec/6378.14 - rsinp )/( r*cosDec*cosHA/6378.14 - rcosp ) ) );
	setDec( temp );

	EquatorialToEcliptic( num->obliquity() );
}
Пример #3
0
void KSPlanetBase::localizeCoords( const KSNumbers *num, const dms *lat, const dms *LST ) {
    //convert geocentric coordinates to local apparent coordinates (topocentric coordinates)
    dms HA, HA2; //Hour Angle, before and after correction
    double rsinp, rcosp, u, sinHA, cosHA, sinDec, cosDec, D;
    double cosHA2;
    double r = Rearth * AU_KM; //distance from Earth, in km
    u = atan( 0.996647*tan( lat->radians() ) );
    rsinp = 0.996647*sin( u );
    rcosp = cos( u );
    HA.setD( LST->Degrees() - ra().Degrees() );
    HA.SinCos( sinHA, cosHA );
    dec().SinCos( sinDec, cosDec );

    D = atan2( rcosp*sinHA, r*cosDec/6378.14 - rcosp*cosHA );
    dms temp;
    temp.setRadians( ra().radians() - D );
    setRA( temp );

    HA2.setD( LST->Degrees() - ra().Degrees() );
    cosHA2 = cos( HA2.radians() );

    //temp.setRadians( atan2( cosHA2*( r*sinDec/6378.14 - rsinp ), r*cosDec*cosHA/6378.14 - rcosp ) );
    // The atan2() version above makes the planets move crazy in the htm branch -jbb
    temp.setRadians( atan( cosHA2*( r*sinDec/6378.14 - rsinp )/( r*cosDec*cosHA/6378.14 - rcosp ) ) );

    setDec( temp );

    //Make sure Dec is between -90 and +90
    if ( dec().Degrees() > 90.0 ) {
        setDec( 180.0 - dec().Degrees() );
        setRA( ra().Hours() + 12.0 );
        ra().reduce();
    }
    if ( dec().Degrees() < -90.0 ) {
        setDec( 180.0 + dec().Degrees() );
        setRA( ra().Hours() + 12.0 );
        ra().reduce();
    }

    EquatorialToEcliptic( num->obliquity() );
}
Пример #4
0
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;
}
Пример #5
0
ConstellationsArt::ConstellationsArt(dms midpointra, dms midpointdec, double pa, double w, double h, QString abbreviation, QString filename)
{
    positionAngle = pa;
    abbrev = abbreviation;
    imageFileName = filename;

    width = w;
    height = h;

    //loadImage();

    //This sets both current and J2000 RA/DEC to the values ra and dec.
    setRA(midpointra);
    setDec(midpointdec);
}
Пример #6
0
void StarObject::init( const starData *stardata ) 
{
    double ra, dec;
    ra = stardata->RA / 1000000.0;
    dec = stardata->Dec / 100000.0;
    setType( SkyObject::STAR );
    setMag( stardata->mag / 100.0 );
    setRA0( ra );
    setDec0( dec );
    setRA( ra );
    setDec( dec );
    SpType[0] = stardata->spec_type[0];
    SpType[1] = stardata->spec_type[1];
    PM_RA = stardata->dRA / 10.0;
    PM_Dec = stardata->dDec / 10.0;
    Parallax = stardata->parallax / 10.0;
    Multiplicity = stardata->flags & 0x02;
    Variability = stardata->flags & 0x04 ;
    updateID = updateNumID = 0;
    HD = stardata->HD;
    B = V = 99.9;

    // DEBUG Edit. For testing proper motion. Uncomment all related blocks to test.
    // WARNING: You can debug only ONE STAR AT A TIME, because
    //          the StarObject::Trail is static. It has to be
    //          static, because otherwise, we can run into segfaults
    //          due to the memcpy() that we do to create stars
    /*
    testStar = false;
    if( stardata->HD == 103095 && Trail.size() == 0 ) {
      // Populate Trail with various positions
        kDebug() << "TEST STAR FOUND!";
        testStar = true;
        KSNumbers num( J2000 ); // Some estimate, doesn't matter.
        long double jy;
        for( jy = -10000.0; jy <= 10000.0; jy += 500.0 ) {
            num.updateValues( J2000 + jy * 365.238 );
            double ra, dec;
            getIndexCoords( &num, &ra, &dec );
            Trail.append( new SkyPoint( ra / 15.0, dec ) );
        }
        kDebug() << "Populated the star's trail with " << Trail.size() << " entries.";
    }
    */
    // END DEBUG.


}
Пример #7
0
void StarObject::init( const deepStarData *stardata ) 
{
    double ra, dec, BV_Index;
  
    ra = stardata->RA / 1000000.0;
    dec = stardata->Dec / 100000.0;
    setType( SkyObject::STAR );

    if( stardata->V == 30000 && stardata->B != 30000 )
      setMag( ( stardata->B - 1600 ) / 1000.0 ); // FIXME: Is it okay to make up stuff like this?
    else
      setMag( stardata->V / 1000.0 );

    setRA0( ra );
    setDec0( dec );
    setRA( ra );
    setDec( dec );

    SpType[1] = '?';
    SpType[0] = 'B';
    if( stardata->B == 30000 || stardata->V == 30000 ) {
      BV_Index = -100;
      SpType[0] = '?';
    }
    else {
      BV_Index = ( stardata->B - stardata->V ) / 1000.0;
      ( BV_Index > 0.0 ) && ( SpType[0] = 'A' );
      ( BV_Index > 0.325 ) && ( SpType[0] = 'F' );
      ( BV_Index > 0.575 ) && ( SpType[0] = 'G' );
      ( BV_Index > 0.975 ) && ( SpType[0] = 'K' );
      ( BV_Index > 1.6 ) && ( SpType[0] = 'M' );
    }

    PM_RA = stardata->dRA / 100.0;
    PM_Dec = stardata->dDec / 100.0;
    Parallax = 0.0;
    Multiplicity = 0;
    Variability = 0;
    updateID = updateNumID = 0;
    B = stardata->B / 1000.0;
    V = stardata->V / 1000.0;
}
Пример #8
0
SkyPoint SkyObject::recomputeCoords( const KStarsDateTime &dt, const GeoLocation *geo ) {
	//store current position
	SkyPoint original( ra(), dec() );

	// compute coords for new time jd
	KSNumbers num( dt.djd() );
	if ( isSolarSystem() && geo ) {
		dms LST = geo->GSTtoLST( dt.gst() );
		updateCoords( &num, true, geo->lat(), &LST );
	} else {
		updateCoords( &num );
	}

	//the coordinates for the date dt:
	SkyPoint sp = SkyPoint( ra(), dec() );

	// restore original coords
	setRA( original.ra()->Hours() );
	setDec( original.dec()->Degrees() );

	return sp;
}