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

[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.
parent 41fc26a6
......@@ -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 ) );
}
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