Commit d4705745 authored by Akarsh Simha's avatar Akarsh Simha
Browse files

Reduce coordinates to the range properly

parent 7a5cca47
......@@ -154,7 +154,7 @@ void SkyPoint::HorizontalToEquatorial( const dms *LST, const dms *lat ) {
if ( sinAz > 0.0 ) HARad = 2.0*dms::PI - HARad; // resolve acos() ambiguity
RA.setRadians( LST->radians() - HARad );
RA.setD( RA.reduce().Degrees() ); // 0 <= RA < 24
RA.reduceToRange( dms::ZERO_TO_2PI );
}
void SkyPoint::findEcliptic( const CachingDms *Obliquity, dms &EcLong, dms &EcLat ) {
......@@ -167,7 +167,7 @@ void SkyPoint::findEcliptic( const CachingDms *Obliquity, dms &EcLong, dms &EcLa
double y = sinRA*cosOb + tanDec*sinOb;
double ELongRad = atan2( y, cosRA );
EcLong.setRadians( ELongRad );
EcLong.reduce(); // FIXME: dms::reduce() doesn't work like this!!
EcLong.reduceToRange( dms::ZERO_TO_2PI );
EcLat.setRadians( asin( sinDec*cosOb - cosDec*sinOb*sinRA ) );
}
......@@ -182,7 +182,7 @@ void SkyPoint::setFromEcliptic( const CachingDms *Obliquity, const dms& EcLong,
double y = sinLong*cosObliq - (sinLat/cosLat)*sinObliq;
// double RARad = atan2( y, cosLong );
RA.setUsing_atan2( y, cosLong );
RA.reduce(); // FIXME: dms::reduce() doesn't work like this
RA.reduceToRange( dms::ZERO_TO_2PI );
Dec.setUsing_asin( sinDec );
}
......@@ -220,7 +220,7 @@ void SkyPoint::precess( const KSNumbers *num ) {
//Extract RA, Dec from the vector:
RA.setUsing_atan2( v[1], v[0] );
RA.reduce(); // FIXME!!! This is useless, because dms::reduce() does not affect the dms, it returns a new dms.
RA.reduceToRange( dms::ZERO_TO_2PI );
Dec.setUsing_asin( v[2] );
}
......@@ -473,7 +473,6 @@ void SkyPoint::precessFromAnyEpoch(long double jd0, long double jdf){
RA.setUsing_atan2( v[1], v[0] );
Dec.setUsing_asin( v[2] );
// FIXME: bad practice with CachingDms
RA.reduceToRange( dms::ZERO_TO_2PI );
return;
......@@ -504,7 +503,7 @@ void SkyPoint::Equatorial1950ToGalactic(dms &galLong, dms &galLat) {
Dec.SinCos(sinDEC,cosDEC);
galLong.setRadians( c.radians() - atan2( sina_RA, cosa_RA*sinb-tanDEC*cosb) );
galLong = galLong.reduce(); // FIXME!!!
galLong.reduceToRange( dms::ZERO_TO_2PI );
galLat.setRadians( asin(sinDEC*sinb+cosDEC*cosb*cosa_RA) );
}
......@@ -523,7 +522,7 @@ void SkyPoint::GalacticToEquatorial1950(const dms* galLong, const dms* galLat) {
b.SinCos(sinb,cosb);
RA.setRadians(c.radians() + atan2(singLong_a,cosgLong_a*sinb-tangLat*cosb) );
RA = RA.reduce(); // FIXME!!!
RA.reduceToRange( dms::ZERO_TO_2PI );
Dec.setRadians( asin(singLat*sinb+cosgLat*cosb*cosgLong_a) );
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment