Commit 56b4f038 authored by Oliver Bock's avatar Oliver Bock
Browse files

Repurposed sliders for obervatory orientations

parent 142c8c6c
......@@ -75,12 +75,14 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_pulsarRotationAngle = 0.0;
m_orbitRotationAngle = 0.0;
// initial binary system parameters (have to match GUI!)
m_pulsarMass = 1.4;
// initial parameters (have to match GUI!)
m_LHOAngle = 180;
m_LLOAngle = 0;
m_VirgoAngle = 0;
m_pulsarRadius = 3.0;
m_pulsarSpinAxisInclination = 0.0;
m_pulsarMagneticAxisInclination = 60.0;
m_pulsarSemiMajorAxis = 5.0;
// initial spin frequency of 0.5 Hz
m_pulsarRotationDelta = (360.0 * 0.5) / m_framesPerSecond;
// beam properties (keep this order!)
......@@ -309,7 +311,7 @@ void PulsarAnimationWidget::paintGL()
glRotatef(-81, 1.0, 1.0, 0.0);
glTranslatef(0.0, 0.0, m_pulsarRadius);
glRotatef(180, 0.0, 0.0, 1.0);
glRotatef(m_LHOAngle, 0.0, 0.0, 1.0);
glPushMatrix();
{
glRotatef(90, 0.0, 1.0, 0.0);
......@@ -571,41 +573,32 @@ void PulsarAnimationWidget::setPulsarSemiMajorAxis(const double length)
updateGL();
}
void PulsarAnimationWidget::setCompanionMass(const double mass)
void PulsarAnimationWidget::setLLHOAngle(const double degrees)
{
m_companionMass = mass;
m_LHOAngle = degrees + 180;
updateOrbitRadii();
updatePulseProfile();
updateGL();
}
void PulsarAnimationWidget::setPulsarMass(const double mass)
void PulsarAnimationWidget::setLLOAngle(const double degrees)
{
m_pulsarMass = mass;
updateOrbitRadii();
m_LHOAngle = degrees;
updatePulseProfile();
updateGL();
}
void PulsarAnimationWidget::setPulsarSpinFrequency(const double frequency)
void PulsarAnimationWidget::setVirgoAngle(const int degrees)
{
m_pulsarRotationDelta = (360.0 * frequency) / m_framesPerSecond;
updatePulseProfile();
}
void PulsarAnimationWidget::setPulsarSpinAxisInclination(const int degrees)
{
m_pulsarSpinAxisInclination = degrees;
m_VirgoAngle = degrees;
updatePulseProfile();
updateGL();
}
void PulsarAnimationWidget::setPulsarMagneticAxisInclination(const int degrees)
void PulsarAnimationWidget::setPulsarSpinAxisInclination(const int degrees)
{
m_pulsarMagneticAxisInclination = degrees;
m_pulsarSpinAxisInclination = degrees;
updatePulseProfile();
updateGL();
......
......@@ -47,10 +47,10 @@ public:
void setFramePerSecond(const unsigned int fps);
void setCompanionMass(const double mass);
void setPulsarMass(const double mass);
void setPulsarSpinFrequency(const double frequency);
void setLLHOAngle(const double degrees);
void setLLOAngle(const double degrees);
void setVirgoAngle(const int degrees);
void setPulsarSpinAxisInclination(const int degrees);
void setPulsarMagneticAxisInclination(const int degrees);
void setPulsarSemiMajorAxis(const double length);
void setPulsarBeamAngle(const int degrees);
void getCameraPosition(double& cameraAngleH, double& cameraAngleV, double& cameraZoom);
......@@ -117,10 +117,10 @@ private:
double m_pulsarBeamLength;
double m_pulsarBeamAngle;
double m_pulsarBeamOuterRadius;
double m_pulsarMass;
double m_pulsarSemiMajorAxis;
double m_LHOAngle;
double m_LLOAngle;
double m_VirgoAngle;
double m_pulsarSpinAxisInclination;
double m_pulsarMagneticAxisInclination;
double m_companionMass;
double m_companionSemiMajorAxis;
......
......@@ -202,28 +202,27 @@ void PulsatingScience::closeEvent(QCloseEvent *event)
}
}
void PulsatingScience::on_sliderPulsarMass_valueChanged(int value)
void PulsatingScience::on_sliderLHOAngle_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarMass(value * 0.1);
ui.lcdPulsarMass->display(QString::number(value * 0.1, 'f', 1));
ui.pulsarGlWidget->setLLHOAngle(value);
ui.lcdLHOAngle->display(QString::number(value));
}
void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
void PulsatingScience::on_sliderLLOAngle_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarSpinFrequency(value * 0.1);
ui.lcdPulsarSpinFrequency->display(QString::number(value * 0.1, 'f', 1));
ui.pulsarGlWidget->setLLOAngle(value);
ui.lcdLLOAngle->display(QString::number(value));
}
void PulsatingScience::on_sliderPulsarSpinAxisInclination_valueChanged(int value)
void PulsatingScience::on_sliderVirgoAngle_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarSpinAxisInclination(value);
ui.lcdPulsarSpinAxisInclination->display(QString::number(value));
ui.lcdVirgoAngle->display(QString::number(value));
}
void PulsatingScience::on_sliderPulsarMagneticAxisInclination_valueChanged(int value)
void PulsatingScience::on_sliderPulsarSpinAxisInclination_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarMagneticAxisInclination(value);
ui.lcdPulsarMagneticAxisInclination->display(QString::number(value));
ui.pulsarGlWidget->setPulsarSpinAxisInclination(value);
ui.lcdPulsarSpinAxisInclination->display(QString::number(value));
}
void PulsatingScience::on_sliderPulsarSemiMajorAxis_valueChanged(int value)
......@@ -525,10 +524,10 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
{
static bool initialized = false;
static int sliderPulsarMass;
static int sliderPulsarSpinFrequency;
static int sliderLHOAngle;
static int sliderLLOAngle;
static int sliderVirgoAngle;
static int sliderPulsarSpinAxisInclination;
static int sliderPulsarMagneticAxisInclination;
static int sliderPulsarSemiMajorAxis;
static double cameraAngleH;
......@@ -537,19 +536,19 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
if(initialized) {
// restore intial settings
ui.sliderPulsarMass->setValue(sliderPulsarMass);
ui.sliderPulsarSpinFrequency->setValue(sliderPulsarSpinFrequency);
ui.sliderLHOAngle->setValue(sliderLHOAngle);
ui.sliderLLOAngle->setValue(sliderLLOAngle);
ui.sliderPulsarSpinAxisInclination->setValue(sliderPulsarSpinAxisInclination);
ui.sliderPulsarMagneticAxisInclination->setValue(sliderPulsarMagneticAxisInclination);
ui.sliderVirgoAngle->setValue(sliderVirgoAngle);
ui.sliderPulsarSemiMajorAxis->setValue(sliderPulsarSemiMajorAxis);
ui.pulsarGlWidget->resetCameraPosition(cameraAngleH, cameraAngleV, cameraZoom);
}
else {
// save initial settings
sliderPulsarMass = ui.sliderPulsarMass->value();
sliderPulsarSpinFrequency = ui.sliderPulsarSpinFrequency->value();
sliderLHOAngle = ui.sliderLHOAngle->value();
sliderLLOAngle = ui.sliderLLOAngle->value();
sliderPulsarSpinAxisInclination = ui.sliderPulsarSpinAxisInclination->value();
sliderPulsarMagneticAxisInclination = ui.sliderPulsarMagneticAxisInclination->value();
sliderVirgoAngle = ui.sliderVirgoAngle->value();
sliderPulsarSemiMajorAxis = ui.sliderPulsarSemiMajorAxis->value();
ui.pulsarGlWidget->getCameraPosition(cameraAngleH, cameraAngleV, cameraZoom);
initialized = true;
......
......@@ -43,10 +43,10 @@ public:
void closeEvent(QCloseEvent *event);
public slots:
void on_sliderPulsarMass_valueChanged(int value);
void on_sliderPulsarSpinFrequency_valueChanged(int value);
void on_sliderLHOAngle_valueChanged(int value);
void on_sliderLLOAngle_valueChanged(int value);
void on_sliderVirgoAngle_valueChanged(int value);
void on_sliderPulsarSpinAxisInclination_valueChanged(int value);
void on_sliderPulsarMagneticAxisInclination_valueChanged(int value);
void on_sliderPulsarSemiMajorAxis_valueChanged(int value);
void permanentOrbitsToggled();
......
......@@ -74,15 +74,15 @@
<item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="3" column="1">
<widget class="QSlider" name="sliderPulsarMagneticAxisInclination">
<widget class="QSlider" name="sliderVirgoAngle">
<property name="statusTip">
<string>Use this slider to adjust the inclination of the magnetic pole axis with respect to the spin axis</string>
<string>Use this slider to adjust the orientation of Virgo</string>
</property>
<property name="maximum">
<number>180</number>
<number>360</number>
</property>
<property name="value">
<number>60</number>
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -107,18 +107,21 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QSlider" name="sliderPulsarMass">
<widget class="QSlider" name="sliderLHOAngle">
<property name="statusTip">
<string>Use this slider to adjust the pulsar mass</string>
<string>Use this slider to adjust the orientation of LHO</string>
</property>
<property name="minimum">
<number>14</number>
<number>0</number>
</property>
<property name="maximum">
<number>30</number>
<number>360</number>
</property>
<property name="pageStep">
<number>2</number>
<number>10</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -129,7 +132,7 @@
</widget>
</item>
<item row="0" column="2">
<widget class="QLCDNumber" name="lcdPulsarMass">
<widget class="QLCDNumber" name="lcdLHOAngle">
<property name="numDigits">
<number>6</number>
</property>
......@@ -137,7 +140,7 @@
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>1.400000000000000</double>
<double>0.000000000000000</double>
</property>
</widget>
</item>
......@@ -156,21 +159,21 @@
</widget>
</item>
<item row="1" column="1">
<widget class="QSlider" name="sliderPulsarSpinFrequency">
<widget class="QSlider" name="sliderLLOAngle">
<property name="statusTip">
<string>Use this slider to adjust the spin frequency</string>
<string>Use this slider to adjust the orientation of LLO</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>20</number>
<number>360</number>
</property>
<property name="pageStep">
<number>5</number>
<number>10</number>
</property>
<property name="value">
<number>5</number>
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -185,12 +188,12 @@
<enum>QSlider::TicksBelow</enum>
</property>
<property name="tickInterval">
<number>1</number>
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLCDNumber" name="lcdPulsarSpinFrequency">
<widget class="QLCDNumber" name="lcdLLOAngle">
<property name="numDigits">
<number>6</number>
</property>
......@@ -198,7 +201,7 @@
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>0.500000000000000</double>
<double>0.000000000000000</double>
</property>
</widget>
</item>
......@@ -269,7 +272,7 @@
</widget>
</item>
<item row="3" column="2">
<widget class="QLCDNumber" name="lcdPulsarMagneticAxisInclination">
<widget class="QLCDNumber" name="lcdVirgoAngle">
<property name="numDigits">
<number>6</number>
</property>
......@@ -277,10 +280,10 @@
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0">
<double>60.000000000000000</double>
<double>0.000000000000000</double>
</property>
<property name="intValue" stdset="0">
<number>60</number>
<number>0</number>
</property>
</widget>
</item>
......@@ -297,7 +300,7 @@
<string>Use this slider to adjust the inclination of the spin axis with respect to the orbit axis</string>
</property>
<property name="maximum">
<number>180</number>
<number>360</number>
</property>
<property name="value">
<number>0</number>
......@@ -363,7 +366,6 @@
<property name="title">
<string>&amp;Control</string>
</property>
<addaction name="separator"/>
<addaction name="actionQuit"/>
</widget>
<addaction name="menuControl"/>
......
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