summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-10-04 16:21:21 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-10-04 16:21:21 (GMT)
commit68523926371d99c8427654fff1dcf12b0a5cf263 (patch)
tree382b33cd0feb597db3d49b337658796c529c6ab6
parentdea375ddd969a93ec0268de70743637c9c9aa1df (diff)
Fix bug with horizontal grid (revert to old way of calculating cosAlt if new way produced 0 value)
-rw-r--r--kstars/skycomponents/noprecessindex.cpp2
-rw-r--r--kstars/skyobjects/skypoint.cpp14
2 files changed, 8 insertions, 8 deletions
diff --git a/kstars/skycomponents/noprecessindex.cpp b/kstars/skycomponents/noprecessindex.cpp
index d7d48aa..76f9c73 100644
--- a/kstars/skycomponents/noprecessindex.cpp
+++ b/kstars/skycomponents/noprecessindex.cpp
@@ -1,5 +1,5 @@
/***************************************************************************
- noprecessindex.h - K Desktop Planetarium
+ noprecessindex.cpp - K Desktop Planetarium
-------------------
begin : 2007-08-04
copyright : (C) 2007 James B. Bowlin
diff --git a/kstars/skyobjects/skypoint.cpp b/kstars/skyobjects/skypoint.cpp
index 16f9927..5380e38 100644
--- a/kstars/skyobjects/skypoint.cpp
+++ b/kstars/skyobjects/skypoint.cpp
@@ -62,7 +62,7 @@ SkyPoint::~SkyPoint(){
}
void SkyPoint::EquatorialToHorizontal( const dms *LST, const dms *lat ) {
- qDebug() << "NOTE: This EquatorialToHorizontal overload (using dms pointers instead of CachingDms pointers) is deprecated and should be replaced with CachingDms prototype wherever speed is desirable!";
+// qDebug() << "NOTE: This EquatorialToHorizontal overload (using dms pointers instead of CachingDms pointers) is deprecated and should be replaced with CachingDms prototype wherever speed is desirable!";
CachingDms _LST( *LST ), _lat( *lat );
EquatorialToHorizontal( &_LST, &_lat );
}
@@ -85,8 +85,8 @@ void SkyPoint::EquatorialToHorizontal( const CachingDms *LST, const CachingDms *
sinAlt = sindec*sinlat + cosdec*coslat*cosHA;
AltRad = asin( sinAlt );
- // cosAlt = cos( AltRad );
cosAlt = sqrt( 1 - sinAlt * sinAlt ); // Avoid trigonometric function. Return value of asin is always in [-pi/2, pi/2] and in this domain cosine is always non-negative, so we can use this.
+ if(cosAlt == 0) cosAlt = cos( AltRad );
double arg = ( sindec - sinlat*sinAlt )/( coslat*cosAlt );
if ( arg <= -1.0 ) AzRad = dms::PI;
@@ -747,12 +747,12 @@ double SkyPoint::vREarth(long double jd0)
double sinRA, sinDec, cosRA, cosDec;
/* u_radial = unitary vector in the direction of the source
- Vlsr = Vhel + Vsun.u_radial
- = Vgeo + VEarth.u_radial + Vsun.u_radial =>
+ Vlsr = Vhel + Vsun.u_radial
+ = Vgeo + VEarth.u_radial + Vsun.u_radial =>
- Vgeo = (Vlsr -Vsun.u_radial) - VEarth.u_radial
- = Vhel - VEarth.u_radial
- = Vhel - (vx, vy, vz).(cos d cos a,cos d sen a,sen d)
+ Vgeo = (Vlsr -Vsun.u_radial) - VEarth.u_radial
+ = Vhel - VEarth.u_radial
+ = Vhel - (vx, vy, vz).(cos d cos a,cos d sen a,sen d)
*/
/* We need an auxiliary SkyPoint since we need the