Commit 7aaa6ebf authored by Oliver Bock's avatar Oliver Bock
Browse files

Repurposed old slider to control the source plane inclination

parent 3c302dfe
......@@ -79,6 +79,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_LHOAngle = 180;
m_LLOAngle = -100;
m_VirgoAngle = 165;
m_sourceInclination = 0;
m_pulsarRadius = 3.0;
m_pulsarSpinAxisInclination = 0.0;
......@@ -392,6 +393,7 @@ void PulsarAnimationWidget::paintGL()
3.0,
-3.0);
glRotatef(m_sourceInclination, 0.0, 1.0, 0.0);
glRotatef(-45, 0.0, 1.0, 0.0);
glRotatef(90, 1.0, 0.0, 0.0);
......@@ -619,11 +621,9 @@ void PulsarAnimationWidget::setFramePerSecond(const unsigned int fps)
m_framesPerSecond = fps;
}
void PulsarAnimationWidget::setPulsarSemiMajorAxis(const double length)
void PulsarAnimationWidget::setSourceInclination(const double degrees)
{
m_pulsarSemiMajorAxis = length;
m_companionSemiMajorAxis = (m_pulsarMass/m_companionMass) * m_pulsarSemiMajorAxis;
updateOrbitPeriod();
m_sourceInclination = degrees;
updatePulseProfile();
updateGL();
......
......@@ -51,7 +51,7 @@ public:
void setLLOAngle(const double degrees);
void setVirgoAngle(const int degrees);
void setPulsarSpinAxisInclination(const int degrees);
void setPulsarSemiMajorAxis(const double length);
void setSourceInclination(const double length);
void setPulsarBeamAngle(const int degrees);
void getCameraPosition(double& cameraAngleH, double& cameraAngleV, double& cameraZoom);
void resetCameraPosition(const double angleH, const double angleV, const double zoom);
......@@ -121,6 +121,7 @@ private:
double m_LLOAngle;
double m_VirgoAngle;
double m_pulsarSpinAxisInclination;
double m_sourceInclination;
double m_companionMass;
double m_companionSemiMajorAxis;
......
......@@ -91,9 +91,6 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect(ui.actionPulseFlashes, SIGNAL(toggled(bool)),
ui.pulsarGlWidget, SLOT(showPulseFlashes(bool)));
connect(ui.pulsarGlWidget, SIGNAL(pulsarSemiMajorAxisUpdated(double)),
this, SLOT(updatePulsarSemiMajorAxisValue(double)));
connect(ui.pulsarGlWidget, SIGNAL(pulsarAnimationStep(double)),
ui.pulseScopeWidget, SLOT(setMarker(double)), Qt::DirectConnection);
......@@ -226,11 +223,10 @@ void PulsatingScience::on_sliderPulsarSpinAxisInclination_valueChanged(int value
ui.lcdPulsarSpinAxisInclination->display(QString::number(value));
}
void PulsatingScience::on_sliderPulsarSemiMajorAxis_valueChanged(int value)
void PulsatingScience::on_sliderSourceInclination_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarSemiMajorAxis(value * 0.001);
ui.lcdPulsarSemiMajorAxis->display(QString::number(value * 0.001, 'f', 1));
ui.lcdPulsarSemiMajorAxis->setStyleSheet("color: black");
ui.pulsarGlWidget->setSourceInclination(value);
ui.lcdSourceInclination->display(QString::number(value));
}
void PulsatingScience::permanentOrbitsToggled() {
......@@ -447,21 +443,6 @@ void PulsatingScience::on_actionAbout_triggered()
QMessageBox::about(this, tr("About \"Pulsating Science\""), content);
}
void PulsatingScience::updatePulsarSemiMajorAxisValue(double value)
{
ui.sliderPulsarSemiMajorAxis->setValue(qRound(value * 1000.0));
if((int)value <= 1 || (int)value >= 20) {
if((int)value < 1 || (int)value > 20) {
ui.lcdPulsarSemiMajorAxis->setStyleSheet("color: red");
}
else {
ui.lcdPulsarSemiMajorAxis->setStyleSheet("color: black");
}
ui.lcdPulsarSemiMajorAxis->display(QString::number(value, 'f', 1));
}
}
void PulsatingScience::toggleHiddenDemoMode()
{
if(m_hiddenDemoModeActivated) {
......@@ -529,7 +510,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
static int sliderLLOAngle;
static int sliderVirgoAngle;
static int sliderPulsarSpinAxisInclination;
static int sliderPulsarSemiMajorAxis;
static int sliderSourceInclination;
static double cameraAngleH;
static double cameraAngleV;
......@@ -541,7 +522,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
ui.sliderLLOAngle->setValue(sliderLLOAngle);
ui.sliderPulsarSpinAxisInclination->setValue(sliderPulsarSpinAxisInclination);
ui.sliderVirgoAngle->setValue(sliderVirgoAngle);
ui.sliderPulsarSemiMajorAxis->setValue(sliderPulsarSemiMajorAxis);
ui.sliderSourceInclination->setValue(sliderSourceInclination);
ui.pulsarGlWidget->resetCameraPosition(cameraAngleH, cameraAngleV, cameraZoom);
}
else {
......@@ -550,7 +531,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
sliderLLOAngle = ui.sliderLLOAngle->value();
sliderPulsarSpinAxisInclination = ui.sliderPulsarSpinAxisInclination->value();
sliderVirgoAngle = ui.sliderVirgoAngle->value();
sliderPulsarSemiMajorAxis = ui.sliderPulsarSemiMajorAxis->value();
sliderSourceInclination = ui.sliderSourceInclination->value();
ui.pulsarGlWidget->getCameraPosition(cameraAngleH, cameraAngleV, cameraZoom);
initialized = true;
}
......
......@@ -47,7 +47,7 @@ public slots:
void on_sliderLLOAngle_valueChanged(int value);
void on_sliderVirgoAngle_valueChanged(int value);
void on_sliderPulsarSpinAxisInclination_valueChanged(int value);
void on_sliderPulsarSemiMajorAxis_valueChanged(int value);
void on_sliderSourceInclination_valueChanged(int value);
void permanentOrbitsToggled();
void on_actionPermanent_orbits_toggled(bool checked);
......@@ -67,7 +67,6 @@ public slots:
void on_actionWebsite_triggered();
void on_actionAbout_triggered();
void updatePulsarSemiMajorAxisValue(double value);
void toggleHiddenDemoMode();
void userInactivityCallback();
......
......@@ -213,7 +213,7 @@
</widget>
</item>
<item row="5" column="2">
<widget class="QLCDNumber" name="lcdPulsarSemiMajorAxis">
<widget class="QLCDNumber" name="lcdSourceInclination">
<property name="numDigits">
<number>6</number>
</property>
......@@ -221,23 +221,23 @@
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>5.000000000000000</double>
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QSlider" name="sliderPulsarSemiMajorAxis">
<widget class="QSlider" name="sliderSourceInclination">
<property name="statusTip">
<string>Use this slider to adjust the length of the semi major axis of the pulsar's elliptical orbit</string>
<string>Use this slider to adjust the inclination of the source plane</string>
</property>
<property name="minimum">
<number>1000</number>
<number>-90</number>
</property>
<property name="maximum">
<number>20000</number>
<number>90</number>
</property>
<property name="value">
<number>5000</number>
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -246,7 +246,7 @@
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>1000</number>
<number>0</number>
</property>
</widget>
</item>
......
Markdown is supported
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