Commit 5cfdb8f7 authored by Oliver Bock's avatar Oliver Bock
Browse files

Added inclination angle of magnetic axis (with respect to spin axis)

parent 96ea06bd
...@@ -48,6 +48,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) : ...@@ -48,6 +48,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
setPulsarRotationDelta(0.5f); setPulsarRotationDelta(0.5f);
setOrbitRotationDelta(0.2f); setOrbitRotationDelta(0.2f);
setOrbitRadius(4.0f); setOrbitRadius(4.0f);
setPulsarMagneticAxisInclination(90);
m_pulsarRotationAngle = 0.0f; m_pulsarRotationAngle = 0.0f;
m_orbitRotationAngle = 0.0f; m_orbitRotationAngle = 0.0f;
...@@ -175,13 +176,15 @@ void PulsarAnimationWidget::paintGL() ...@@ -175,13 +176,15 @@ void PulsarAnimationWidget::paintGL()
glMaterialfv(GL_FRONT, GL_SPECULAR, coneSpecular); glMaterialfv(GL_FRONT, GL_SPECULAR, coneSpecular);
glPushMatrix(); glPushMatrix();
glRotatef(m_pulsarRotationAngle-90, 0.0f, 1.0f, 0.0f); glRotatef(m_pulsarRotationAngle - 90.0f, 0.0f, 1.0f, 0.0f);
glRotatef(-m_pulsarMagneticAxisInclination + 90.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(0.0f, 0.0f, -4.0f); glTranslatef(0.0f, 0.0f, -4.0f);
gluCylinder(m_quadricPulsarCone1, 0.5f, 0.0f, 3.0f, 32, 32); gluCylinder(m_quadricPulsarCone1, 0.5f, 0.0f, 3.0f, 32, 32);
glPopMatrix(); glPopMatrix();
glPushMatrix(); glPushMatrix();
glRotatef(m_pulsarRotationAngle+90, 0.0f, 1.0f, 0.0f); glRotatef(m_pulsarRotationAngle + 90.0f, 0.0f, 1.0f, 0.0f);
glRotatef(m_pulsarMagneticAxisInclination - 90.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(0.0f, 0.0f, -4.0f); glTranslatef(0.0f, 0.0f, -4.0f);
gluCylinder(m_quadricPulsarCone2, 0.5f, 0.0f, 3.0f, 32, 32); gluCylinder(m_quadricPulsarCone2, 0.5f, 0.0f, 3.0f, 32, 32);
glPopMatrix(); glPopMatrix();
...@@ -236,6 +239,8 @@ void PulsarAnimationWidget::updateFrame() ...@@ -236,6 +239,8 @@ void PulsarAnimationWidget::updateFrame()
void PulsarAnimationWidget::mousePressEvent(QMouseEvent *event) void PulsarAnimationWidget::mousePressEvent(QMouseEvent *event)
{ {
Q_UNUSED(event);
m_cameraInteraction = true; m_cameraInteraction = true;
updateGL(); updateGL();
} }
...@@ -309,3 +314,10 @@ void PulsarAnimationWidget::setOrbitRadius(const float radius) ...@@ -309,3 +314,10 @@ void PulsarAnimationWidget::setOrbitRadius(const float radius)
m_pulsarOrbitRadius = radius; m_pulsarOrbitRadius = radius;
m_companionOrbitRadius = radius; m_companionOrbitRadius = radius;
} }
void PulsarAnimationWidget::setPulsarMagneticAxisInclination(const int degrees)
{
m_pulsarMagneticAxisInclination = degrees;
updateGL();
}
...@@ -41,6 +41,7 @@ public: ...@@ -41,6 +41,7 @@ public:
void setPulsarRotationDelta(const float frequency); void setPulsarRotationDelta(const float frequency);
void setOrbitRotationDelta(const float frequency); void setOrbitRotationDelta(const float frequency);
void setOrbitRadius(const float radius); void setOrbitRadius(const float radius);
void setPulsarMagneticAxisInclination(const int degrees);
public slots: public slots:
...@@ -79,6 +80,8 @@ protected: ...@@ -79,6 +80,8 @@ protected:
float m_pulsarOrbitRadius; float m_pulsarOrbitRadius;
float m_companionOrbitRadius; float m_companionOrbitRadius;
int m_pulsarMagneticAxisInclination;
bool m_cameraInteraction; bool m_cameraInteraction;
int m_mouseLastX; int m_mouseLastX;
int m_mouseLastY; int m_mouseLastY;
......
...@@ -54,6 +54,12 @@ void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value) ...@@ -54,6 +54,12 @@ void PulsatingScience::on_sliderPulsarSpinFrequency_valueChanged(int value)
ui.lcdPulsarSpinFrequency->display(QString::number(value / 10.0, 'f', 1)); ui.lcdPulsarSpinFrequency->display(QString::number(value / 10.0, 'f', 1));
} }
void PulsatingScience::on_sliderPulsarMagneticAxisInclination_valueChanged(int value)
{
ui.pulsarGlWidget->setPulsarMagneticAxisInclination(value);
ui.lcdPulsarMagneticAxisInclination->display(QString::number(value));
}
void PulsatingScience::on_sliderOrbitRadius_valueChanged(int value) void PulsatingScience::on_sliderOrbitRadius_valueChanged(int value)
{ {
ui.pulsarGlWidget->setOrbitRadius(value); ui.pulsarGlWidget->setOrbitRadius(value);
......
...@@ -34,6 +34,7 @@ public: ...@@ -34,6 +34,7 @@ public:
public slots: public slots:
void on_sliderPulsarSpinFrequency_valueChanged(int value); void on_sliderPulsarSpinFrequency_valueChanged(int value);
void on_sliderPulsarMagneticAxisInclination_valueChanged(int value);
void on_sliderOrbitRadius_valueChanged(int value); void on_sliderOrbitRadius_valueChanged(int value);
void on_sliderOrbitFrequency_valueChanged(int value); void on_sliderOrbitFrequency_valueChanged(int value);
......
...@@ -92,21 +92,21 @@ ...@@ -92,21 +92,21 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" > <item row="2" column="0" >
<widget class="QLabel" name="label_2" > <widget class="QLabel" name="label_2" >
<property name="text" > <property name="text" >
<string>Orbit Radius:</string> <string>Orbit Radius:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0" > <item row="3" column="0" >
<widget class="QLabel" name="label_3" > <widget class="QLabel" name="label_3" >
<property name="text" > <property name="text" >
<string>Orbit Frequency:</string> <string>Orbit Frequency:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1" > <item row="2" column="1" >
<widget class="QSlider" name="sliderOrbitRadius" > <widget class="QSlider" name="sliderOrbitRadius" >
<property name="minimum" > <property name="minimum" >
<number>1</number> <number>1</number>
...@@ -131,7 +131,7 @@ ...@@ -131,7 +131,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2" > <item row="2" column="2" >
<widget class="QLCDNumber" name="lcdOrbitRadius" > <widget class="QLCDNumber" name="lcdOrbitRadius" >
<property name="numDigits" > <property name="numDigits" >
<number>6</number> <number>6</number>
...@@ -144,7 +144,7 @@ ...@@ -144,7 +144,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="2" > <item row="3" column="2" >
<widget class="QLCDNumber" name="lcdOrbitFrequency" > <widget class="QLCDNumber" name="lcdOrbitFrequency" >
<property name="numDigits" > <property name="numDigits" >
<number>6</number> <number>6</number>
...@@ -157,7 +157,7 @@ ...@@ -157,7 +157,7 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="1" > <item row="3" column="1" >
<widget class="QSlider" name="sliderOrbitFrequency" > <widget class="QSlider" name="sliderOrbitFrequency" >
<property name="minimum" > <property name="minimum" >
<number>0</number> <number>0</number>
...@@ -179,6 +179,42 @@ ...@@ -179,6 +179,42 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Mag. Axis (incl.)</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QSlider" name="sliderPulsarMagneticAxisInclination" >
<property name="maximum" >
<number>90</number>
</property>
<property name="value" >
<number>90</number>
</property>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="tickPosition" >
<enum>QSlider::TicksBelow</enum>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLCDNumber" name="lcdPulsarMagneticAxisInclination" >
<property name="numDigits" >
<number>6</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="intValue" stdset="0" >
<number>90</number>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
<item row="0" column="0" > <item row="0" column="0" >
...@@ -227,7 +263,7 @@ ...@@ -227,7 +263,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>550</width> <width>550</width>
<height>21</height> <height>31</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuView" > <widget class="QMenu" name="menuView" >
......
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