summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-09-28 07:11:02 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-09-29 02:20:27 (GMT)
commitd4705745c916777eaa82606d156c23bc79d8bdef (patch)
treedebcb19be13524e3f5d5b767b62beeebb9c84909
parent7a5cca47ec521c39330a912e05c505ed2852495a (diff)
Reduce coordinates to the range properly
-rw-r--r--kstars/skyobjects/skypoint.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp
index 02d7aa6..68b845e 100644
--- a/kstars/skyobjects/skypoint.cpp
+++ b/kstars/skyobjects/skypoint.cpp
@@ -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) );
}