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