Commit 9e7d215a authored by Oliver Bock's avatar Oliver Bock

Improved initial settings

* Using show event to update pulse profile
* Using 60 deg inclination of magentic axis
parent e33b9c89
...@@ -78,7 +78,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -78,7 +78,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
// initial companion is "Neutron Star" // initial companion is "Neutron Star"
m_companionMass = 1.4; m_companionMass = 1.4;
m_pulsarSpinAxisInclination = 0.0; m_pulsarSpinAxisInclination = 0.0;
m_pulsarMagneticAxisInclination = 45.0; m_pulsarMagneticAxisInclination = 60.0;
m_pulsarSemiMajorAxis = 5.0; m_pulsarSemiMajorAxis = 5.0;
m_companionSemiMajorAxis = (m_pulsarMass/m_companionMass) * m_pulsarSemiMajorAxis; m_companionSemiMajorAxis = (m_pulsarMass/m_companionMass) * m_pulsarSemiMajorAxis;
// initial spin frequency of 0.5 Hz // initial spin frequency of 0.5 Hz
...@@ -102,9 +102,6 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -102,9 +102,6 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
// update camera based on settings above // update camera based on settings above
updateCameraPosition(m_mouseAngleH, m_mouseAngleV, m_cameraZoom); updateCameraPosition(m_mouseAngleH, m_mouseAngleV, m_cameraZoom);
// finally, create initial pulse profile based on settings above
updatePulseProfile();
} }
PulsarAnimationWidget::~PulsarAnimationWidget() PulsarAnimationWidget::~PulsarAnimationWidget()
...@@ -512,6 +509,14 @@ void PulsarAnimationWidget::mouseReleaseEvent(QMouseEvent *event) ...@@ -512,6 +509,14 @@ void PulsarAnimationWidget::mouseReleaseEvent(QMouseEvent *event)
updateGL(); updateGL();
} }
void PulsarAnimationWidget::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
// update and propagate pulse profile
updatePulseProfile();
}
void PulsarAnimationWidget::updateCameraPosition(const int angleH, const int angleV, const double zoom) void PulsarAnimationWidget::updateCameraPosition(const int angleH, const int angleV, const double zoom)
{ {
m_cameraPosX = sin(angleH * deg2rad) * cos(angleV * deg2rad) * zoom; m_cameraPosX = sin(angleH * deg2rad) * cos(angleV * deg2rad) * zoom;
......
...@@ -70,6 +70,7 @@ private: ...@@ -70,6 +70,7 @@ private:
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);
void showEvent(QShowEvent *event);
void updateOrbitPeriod(); void updateOrbitPeriod();
void updateOrbitRadii(); void updateOrbitRadii();
......
...@@ -226,7 +226,7 @@ ...@@ -226,7 +226,7 @@
<number>180</number> <number>180</number>
</property> </property>
<property name="value" > <property name="value" >
<number>45</number> <number>60</number>
</property> </property>
<property name="orientation" > <property name="orientation" >
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
...@@ -244,8 +244,11 @@ ...@@ -244,8 +244,11 @@
<property name="segmentStyle" > <property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum> <enum>QLCDNumber::Flat</enum>
</property> </property>
<property name="value" stdset="0" >
<double>60.000000000000000</double>
</property>
<property name="intValue" stdset="0" > <property name="intValue" stdset="0" >
<number>45</number> <number>60</number>
</property> </property>
</widget> </widget>
</item> </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