Skip to content

Commit

Permalink
Added 2 important factors for binoculars
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-w committed Apr 21, 2024
1 parent 4e69c2c commit d55f241
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 91 deletions.
4 changes: 4 additions & 0 deletions guide/plg_atTheTelescope.tex
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ \subsection{Configuration}
\item[Diameter] -- the diameter of the binocular objective in \mm.
\end{description}

For binoculars, we're computed two important factors in additional to exit pupil -- twilight factor and relative brightness.
Twilight factor is a number used to compare the effectiveness of binoculars used in low light. The larger the twilight factor,
the more detail you can see in low light. Relative brightness is a number used to compare the brightness of binoculars of similar
magnification. The larger the relative brightness number, the brighter the image.

\paragraph{Lenses}

Expand Down
2 changes: 1 addition & 1 deletion plugins/Oculars/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
SET(OCULARS_STELMODULE_MAJOR "1")
SET(OCULARS_STELMODULE_MINOR "2")
SET(OCULARS_STELMODULE_PATCH "4")
SET(OCULARS_STELMODULE_PATCH "5")
SET(OCULARS_VERSION "${OCULARS_STELMODULE_MAJOR}.${OCULARS_STELMODULE_MINOR}.${OCULARS_STELMODULE_PATCH}")

ADD_DEFINITIONS(-DOCULARS_PLUGIN_VERSION="${OCULARS_VERSION}")
Expand Down
53 changes: 44 additions & 9 deletions plugins/Oculars/src/gui/OcularsGuiPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ OcularsGuiPanel::OcularsGuiPanel(Oculars* plugin,
fieldTelescopeName = new QGraphicsTextItem(telescopeControls);
fieldMagnification = new QGraphicsTextItem(telescopeControls);
fieldExitPupil = new QGraphicsTextItem(telescopeControls);
fieldTwilightFactor = new QGraphicsTextItem(telescopeControls);
fieldRelativeBrightness = new QGraphicsTextItem(telescopeControls);
fieldFov = new QGraphicsTextItem(telescopeControls);
fieldRayleighCriterion = new QGraphicsTextItem(telescopeControls);
fieldDawesCriterion = new QGraphicsTextItem(telescopeControls);
Expand Down Expand Up @@ -159,6 +161,8 @@ OcularsGuiPanel::OcularsGuiPanel(Oculars* plugin,
fieldTelescopeName->setTextWidth(maxWidth);
fieldMagnification->setTextWidth(maxWidth);
fieldExitPupil->setTextWidth(maxWidth);
fieldTwilightFactor->setTextWidth(maxWidth);
fieldRelativeBrightness->setTextWidth(maxWidth);
fieldFov->setTextWidth(maxWidth);
fieldRayleighCriterion->setTextWidth(maxWidth);
fieldDawesCriterion->setTextWidth(maxWidth);
Expand Down Expand Up @@ -350,7 +354,9 @@ OcularsGuiPanel::~OcularsGuiPanel()
delete fieldPrismRotation; fieldPrismRotation = Q_NULLPTR;
delete fieldTelescopeName; fieldTelescopeName = Q_NULLPTR;
delete fieldMagnification; fieldMagnification = Q_NULLPTR;
delete fieldExitPupil; fieldExitPupil = Q_NULLPTR;
delete fieldExitPupil; fieldExitPupil = Q_NULLPTR;
delete fieldTwilightFactor; fieldTwilightFactor = Q_NULLPTR;
delete fieldRelativeBrightness; fieldRelativeBrightness = Q_NULLPTR;
delete fieldFov; fieldFov = Q_NULLPTR;
delete fieldRayleighCriterion; fieldRayleighCriterion = Q_NULLPTR;
delete fieldDawesCriterion; fieldDawesCriterion = Q_NULLPTR;
Expand Down Expand Up @@ -816,8 +822,8 @@ void OcularsGuiPanel::updateTelescopeControls()

if (ocularsPlugin->flagShowCCD)
{
int index = ocularsPlugin->selectedCCDIndex;
CCD* ccd = ocularsPlugin->ccds[index];
int indexCCD = ocularsPlugin->selectedCCDIndex;
CCD* ccd = ocularsPlugin->ccds[indexCCD];
Q_ASSERT(ccd);

const double fovX = ccd->getActualFOVx(telescope, lens);
Expand All @@ -842,28 +848,32 @@ void OcularsGuiPanel::updateTelescopeControls()

fieldMagnification->setVisible(false);
fieldExitPupil->setVisible(false);
fieldFov->setVisible(false);
fieldTwilightFactor->setVisible(false);
fieldRelativeBrightness->setVisible(false);
fieldFov->setVisible(false);
}

if (ocularsPlugin->flagShowOculars)
{
//We need the current ocular
int index = ocularsPlugin->selectedOcularIndex;
Ocular* ocular = ocularsPlugin->oculars[index];
int indexOcular = ocularsPlugin->selectedOcularIndex;
Ocular* ocular = ocularsPlugin->oculars[indexOcular];
bool showBinoFactors = false;
Q_ASSERT(ocular);

if (ocular->isBinoculars())
{
prevTelescopeButton->setVisible(false);
nextTelescopeButton->setVisible(false);
fieldTelescopeName->setVisible(false);
fieldExitPupil->setVisible(false);
fieldTelescopeName->setVisible(false);
posY = 0.;
widgetHeight = 0.;

fieldMagnification->setToolTip(q_("Magnification provided by these binoculars"));
fieldFov->setToolTip(q_("Actual field of view provided by these binoculars"));
fieldExitPupil->setToolTip(q_("Exit pupil provided by these binoculars"));
fieldTwilightFactor->setToolTip(q_("Twilight factor provided by these binoculars"));
fieldRelativeBrightness->setToolTip(q_("Relative brightness provided by these binoculars"));
}
else
{
Expand Down Expand Up @@ -896,6 +906,21 @@ void OcularsGuiPanel::updateTelescopeControls()
fieldExitPupil->setPos(posX, posY);
posY += fieldExitPupil->boundingRect().height();
widgetHeight += fieldExitPupil->boundingRect().height();
if (ocular->isBinoculars())
{
showBinoFactors = true;
QString twilightFactorLabel = QString(q_("Twilight factor: %1")).arg(QString::number(::sqrt(exitPupil), 'f', 2));
fieldTwilightFactor->setPlainText(twilightFactorLabel);
fieldTwilightFactor->setPos(posX, posY);
posY += fieldTwilightFactor->boundingRect().height();
widgetHeight += fieldTwilightFactor->boundingRect().height();

QString relativeBrightnessLabel = QString(q_("Relative brightness: %1")).arg(QString::number(exitPupil*exitPupil, 'f', 2));
fieldRelativeBrightness->setPlainText(relativeBrightnessLabel);
fieldRelativeBrightness->setPos(posX, posY);
posY += fieldRelativeBrightness->boundingRect().height();
widgetHeight += fieldRelativeBrightness->boundingRect().height();
}
}

QString fovString = QString::number(ocular->actualFOV(telescope, lens), 'f', 4) + QChar(0x00B0);
Expand All @@ -911,6 +936,8 @@ void OcularsGuiPanel::updateTelescopeControls()
fieldExitPupil->setVisible(true);
else
fieldExitPupil->setVisible(false);
fieldTwilightFactor->setVisible(showBinoFactors);
fieldRelativeBrightness->setVisible(showBinoFactors);
}

double diameter = telescope->diameter();
Expand Down Expand Up @@ -969,7 +996,7 @@ void OcularsGuiPanel::updateTelescopeControls()
fieldVisualResolution->setPlainText(visualResolutionLabel);
fieldVisualResolution->setToolTip(q_("Visual resolution is based on eye properties and magnification"));
fieldVisualResolution->setPos(posX, posY);
posY += fieldVisualResolution->boundingRect().height();
//posY += fieldVisualResolution->boundingRect().height();
widgetHeight += fieldVisualResolution->boundingRect().height();

fieldVisualResolution->setVisible(true);
Expand Down Expand Up @@ -1131,6 +1158,8 @@ void OcularsGuiPanel::setControlsColor(const QColor& color)
Q_ASSERT(fieldTelescopeName);
Q_ASSERT(fieldMagnification);
Q_ASSERT(fieldExitPupil);
Q_ASSERT(fieldTwilightFactor);
Q_ASSERT(fieldRelativeBrightness);
Q_ASSERT(fieldFov);
Q_ASSERT(fieldRayleighCriterion);
Q_ASSERT(fieldDawesCriterion);
Expand All @@ -1154,6 +1183,8 @@ void OcularsGuiPanel::setControlsColor(const QColor& color)
fieldMagnification->setDefaultTextColor(color);
fieldFov->setDefaultTextColor(color);
fieldExitPupil->setDefaultTextColor(color);
fieldTwilightFactor->setDefaultTextColor(color);
fieldRelativeBrightness->setDefaultTextColor(color);
fieldRayleighCriterion->setDefaultTextColor(color);
fieldDawesCriterion->setDefaultTextColor(color);
fieldAbbeyCriterion->setDefaultTextColor(color);
Expand All @@ -1178,6 +1209,8 @@ void OcularsGuiPanel::setControlsFont(const QFont& font)
Q_ASSERT(fieldTelescopeName);
Q_ASSERT(fieldMagnification);
Q_ASSERT(fieldExitPupil);
Q_ASSERT(fieldTwilightFactor);
Q_ASSERT(fieldRelativeBrightness);
Q_ASSERT(fieldFov);
Q_ASSERT(fieldRayleighCriterion);
Q_ASSERT(fieldDawesCriterion);
Expand All @@ -1201,6 +1234,8 @@ void OcularsGuiPanel::setControlsFont(const QFont& font)
fieldMagnification->setFont(font);
fieldFov->setFont(font);
fieldExitPupil->setFont(font);
fieldTwilightFactor->setFont(font);
fieldRelativeBrightness->setFont(font);
fieldRayleighCriterion->setFont(font);
fieldDawesCriterion->setFont(font);
fieldAbbeyCriterion->setFont(font);
Expand Down
2 changes: 2 additions & 0 deletions plugins/Oculars/src/gui/OcularsGuiPanel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ private slots:
QGraphicsTextItem* fieldTelescopeName;
QGraphicsTextItem* fieldMagnification;
QGraphicsTextItem* fieldExitPupil;
QGraphicsTextItem* fieldTwilightFactor;
QGraphicsTextItem* fieldRelativeBrightness;
QGraphicsTextItem* fieldFov;
QGraphicsTextItem* fieldRayleighCriterion;
QGraphicsTextItem* fieldDawesCriterion;
Expand Down
Loading

0 comments on commit d55f241

Please sign in to comment.