summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkarsh Simha <akarsh@kde.org>2016-08-25 10:48:12 (GMT)
committerAkarsh Simha <akarsh@kde.org>2016-08-25 10:48:12 (GMT)
commitb8bc83de4b36164dc15f142dca2d14f97288c9dd (patch)
treed55143a3070082a0fe501d228276f0a3a0375d52
parent41fc26a668080126ec0ce9349ff22195c26dc5b4 (diff)
[EXPERIMENTAL] In the projector, don't reduce an angle twice.
In the toScreenVec() and drawPointSource() which are called many many many times per draw, every operation counts. Reduce the number of reduce() operations. Tested briefly, but more testing needed to confirm that this is okay.
-rw-r--r--kstars/projections/projector.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/kstars/projections/projector.cpp b/kstars/projections/projector.cpp
index 205bde7..0ad729c 100644
--- a/kstars/projections/projector.cpp
+++ b/kstars/projections/projector.cpp
@@ -457,14 +457,14 @@ Vector2f Projector::toScreenVec(const SkyPoint* o, bool oRefract, bool* onVisibl
Y = SkyPoint::refract( o->alt() ).radians(); //account for atmospheric refraction
else
Y = o->alt().radians();
- dX = m_vp.focus->az().reduce().radians() - o->az().reduce().radians();
+ dX = m_vp.focus->az().radians() - o->az().radians();
} else {
- dX = o->ra().reduce().radians() - m_vp.focus->ra().reduce().radians();
+ dX = o->ra().radians() - m_vp.focus->ra().radians();
Y = o->dec().radians();
}
if( !( std::isfinite( Y ) && std::isfinite( dX ) ) ) {
- qDebug() << "Assert in Projector::toScreenVec is going to fail!!";
+ qDebug() << "Assert in Projector::toScreenVec failed!";
qDebug() << "using AltAz?" << m_vp.useAltAz << " Refract? " << oRefract;
const SkyObject *obj;
qDebug() << "Point supplied has RA0 = " << o->ra0().toHMSString() << " Dec0 = " << o->dec0().toDMSString() << "; alt = " << o->alt().toDMSString() << "; az = " << o->az().toDMSString();
@@ -473,10 +473,9 @@ Vector2f Projector::toScreenVec(const SkyPoint* o, bool oRefract, bool* onVisibl
}
qDebug() << "dX = " << dX << " and isfinite(dX) is" << std::isfinite(dX);
qDebug() << "Y = " << Y << " and isfinite(Y) is" << std::isfinite(Y);
+ Q_ASSERT( false );
}
- Q_ASSERT( std::isfinite( Y ) && std::isfinite( dX ) );
-
dX = KSUtils::reduceAngle(dX, -dms::PI, dms::PI);
//Convert dX, Y coords to screen pixel coords, using GNU extension if available
@@ -502,4 +501,3 @@ Vector2f Projector::toScreenVec(const SkyPoint* o, bool oRefract, bool* onVisibl
return Vector2f( 0.5*m_vp.width - m_vp.zoomFactor*k*cosY*sindX,
0.5*m_vp.height - m_vp.zoomFactor*k*( m_cosY0*sinY - m_sinY0*cosY*cosdX ) );
}
-