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

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

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