Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
einsteinathome
pulsatingscience
Commits
56b4f038
Commit
56b4f038
authored
Sep 07, 2017
by
Oliver Bock
Browse files
Repurposed sliders for obervatory orientations
parent
142c8c6c
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
56b4f038
...
...
@@ -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
::
set
CompanionMass
(
const
double
mas
s
)
void
PulsarAnimationWidget
::
set
LLHOAngle
(
const
double
degree
s
)
{
m_
companionMass
=
mass
;
m_
LHOAngle
=
degrees
+
180
;
updateOrbitRadii
();
updatePulseProfile
();
updateGL
();
}
void
PulsarAnimationWidget
::
set
PulsarMass
(
const
double
mas
s
)
void
PulsarAnimationWidget
::
set
LLOAngle
(
const
double
degree
s
)
{
m_pulsarMass
=
mass
;
updateOrbitRadii
();
m_LHOAngle
=
degrees
;
updatePulseProfile
();
updateGL
();
}
void
PulsarAnimationWidget
::
set
PulsarSpinFrequency
(
const
double
frequency
)
void
PulsarAnimationWidget
::
set
VirgoAngle
(
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
::
setPulsar
Magnetic
AxisInclination
(
const
int
degrees
)
void
PulsarAnimationWidget
::
setPulsar
Spin
AxisInclination
(
const
int
degrees
)
{
m_pulsar
Magnetic
AxisInclination
=
degrees
;
m_pulsar
Spin
AxisInclination
=
degrees
;
updatePulseProfile
();
updateGL
();
...
...
src/pulsaranimationwidget.h
View file @
56b4f038
...
...
@@ -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
;
...
...
src/pulsatingscience.cpp
View file @
56b4f038
...
...
@@ -202,28 +202,27 @@ void PulsatingScience::closeEvent(QCloseEvent *event)
}
}
void
PulsatingScience
::
on_slider
PulsarMass
_valueChanged
(
int
value
)
void
PulsatingScience
::
on_slider
LHOAngle
_valueChanged
(
int
value
)
{
ui
.
pulsarGlWidget
->
set
PulsarMass
(
value
*
0.1
);
ui
.
lcd
PulsarMass
->
display
(
QString
::
number
(
value
*
0.1
,
'f'
,
1
));
ui
.
pulsarGlWidget
->
set
LLHOAngle
(
value
);
ui
.
lcd
LHOAngle
->
display
(
QString
::
number
(
value
));
}
void
PulsatingScience
::
on_slider
PulsarSpinFrequency
_valueChanged
(
int
value
)
void
PulsatingScience
::
on_slider
LLOAngle
_valueChanged
(
int
value
)
{
ui
.
pulsarGlWidget
->
set
PulsarSpinFrequency
(
value
*
0.1
);
ui
.
lcd
PulsarSpinFrequency
->
display
(
QString
::
number
(
value
*
0.1
,
'f'
,
1
));
ui
.
pulsarGlWidget
->
set
LLOAngle
(
value
);
ui
.
lcd
LLOAngle
->
display
(
QString
::
number
(
value
));
}
void
PulsatingScience
::
on_slider
PulsarSpinAxisInclination
_valueChanged
(
int
value
)
void
PulsatingScience
::
on_slider
VirgoAngle
_valueChanged
(
int
value
)
{
ui
.
pulsarGlWidget
->
setPulsarSpinAxisInclination
(
value
);
ui
.
lcdPulsarSpinAxisInclination
->
display
(
QString
::
number
(
value
));
ui
.
lcdVirgoAngle
->
display
(
QString
::
number
(
value
));
}
void
PulsatingScience
::
on_sliderPulsar
Magnetic
AxisInclination_valueChanged
(
int
value
)
void
PulsatingScience
::
on_sliderPulsar
Spin
AxisInclination_valueChanged
(
int
value
)
{
ui
.
pulsarGlWidget
->
setPulsar
Magnetic
AxisInclination
(
value
);
ui
.
lcdPulsar
Magnetic
AxisInclination
->
display
(
QString
::
number
(
value
));
ui
.
pulsarGlWidget
->
setPulsar
Spin
AxisInclination
(
value
);
ui
.
lcdPulsar
Spin
AxisInclination
->
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
.
slider
PulsarMass
->
setValue
(
slider
PulsarMass
);
ui
.
slider
PulsarSpinFrequency
->
setValue
(
sliderPulsarSpinFrequency
);
ui
.
slider
LHOAngle
->
setValue
(
slider
LHOAngle
);
ui
.
slider
LLOAngle
->
setValue
(
sliderLLOAngle
);
ui
.
sliderPulsarSpinAxisInclination
->
setValue
(
sliderPulsarSpinAxisInclination
);
ui
.
slider
PulsarMagneticAxisInclination
->
setValue
(
sliderPulsarMagneticAxisInclination
);
ui
.
slider
VirgoAngle
->
setValue
(
sliderVirgoAngle
);
ui
.
sliderPulsarSemiMajorAxis
->
setValue
(
sliderPulsarSemiMajorAxis
);
ui
.
pulsarGlWidget
->
resetCameraPosition
(
cameraAngleH
,
cameraAngleV
,
cameraZoom
);
}
else
{
// save initial settings
slider
PulsarMass
=
ui
.
slider
PulsarMass
->
value
();
slider
PulsarSpinFrequency
=
ui
.
sliderPulsarSpinFrequency
->
value
();
slider
LHOAngle
=
ui
.
slider
LHOAngle
->
value
();
slider
LLOAngle
=
ui
.
sliderLLOAngle
->
value
();
sliderPulsarSpinAxisInclination
=
ui
.
sliderPulsarSpinAxisInclination
->
value
();
slider
PulsarMagneticAxisInclination
=
ui
.
sliderPulsarMagneticAxisInclination
->
value
();
slider
VirgoAngle
=
ui
.
sliderVirgoAngle
->
value
();
sliderPulsarSemiMajorAxis
=
ui
.
sliderPulsarSemiMajorAxis
->
value
();
ui
.
pulsarGlWidget
->
getCameraPosition
(
cameraAngleH
,
cameraAngleV
,
cameraZoom
);
initialized
=
true
;
...
...
src/pulsatingscience.h
View file @
56b4f038
...
...
@@ -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
();
...
...
src/pulsatingscience.ui
View file @
56b4f038
...
...
@@ -74,15 +74,15 @@
<item
row=
"1"
column=
"0"
>
<layout
class=
"QGridLayout"
name=
"gridLayout_2"
>
<item
row=
"3"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider
PulsarMagneticAxisInclination
"
>
<widget
class=
"QSlider"
name=
"slider
VirgoAngle
"
>
<property
name=
"statusTip"
>
<string>
Use this slider to adjust the
inclin
ation of
the magnetic pole axis with respect to the spin axis
</string>
<string>
Use this slider to adjust the
orient
ation of
Virgo
</string>
</property>
<property
name=
"maximum"
>
<number>
18
0
</number>
<number>
36
0
</number>
</property>
<property
name=
"value"
>
<number>
6
0
</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=
"slider
PulsarMass
"
>
<widget
class=
"QSlider"
name=
"slider
LHOAngle
"
>
<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>
3
6
0
</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=
"lcd
PulsarMass
"
>
<widget
class=
"QLCDNumber"
name=
"lcd
LHOAngle
"
>
<property
name=
"numDigits"
>
<number>
6
</number>
</property>
...
...
@@ -137,7 +140,7 @@
<enum>
QLCDNumber::Flat
</enum>
</property>
<property
name=
"value"
stdset=
"0"
>
<double>
1.4
00000000000000
</double>
<double>
0.0
00000000000000
</double>
</property>
</widget>
</item>
...
...
@@ -156,21 +159,21 @@
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider
PulsarSpinFrequency
"
>
<widget
class=
"QSlider"
name=
"slider
LLOAngle
"
>
<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>
2
0
</number>
<number>
36
0
</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=
"lcd
PulsarSpinFrequency
"
>
<widget
class=
"QLCDNumber"
name=
"lcd
LLOAngle
"
>
<property
name=
"numDigits"
>
<number>
6
</number>
</property>
...
...
@@ -198,7 +201,7 @@
<enum>
QLCDNumber::Flat
</enum>
</property>
<property
name=
"value"
stdset=
"0"
>
<double>
0.
5
00000000000000
</double>
<double>
0.
0
00000000000000
</double>
</property>
</widget>
</item>
...
...
@@ -269,7 +272,7 @@
</widget>
</item>
<item
row=
"3"
column=
"2"
>
<widget
class=
"QLCDNumber"
name=
"lcd
PulsarMagneticAxisInclination
"
>
<widget
class=
"QLCDNumber"
name=
"lcd
VirgoAngle
"
>
<property
name=
"numDigits"
>
<number>
6
</number>
</property>
...
...
@@ -277,10 +280,10 @@
<enum>
QLCDNumber::Flat
</enum>
</property>
<property
name=
"value"
stdset=
"0"
>
<double>
6
0.000000000000000
</double>
<double>
0.000000000000000
</double>
</property>
<property
name=
"intValue"
stdset=
"0"
>
<number>
6
0
</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>
18
0
</number>
<number>
36
0
</number>
</property>
<property
name=
"value"
>
<number>
0
</number>
...
...
@@ -363,7 +366,6 @@
<property
name=
"title"
>
<string>
&
Control
</string>
</property>
<addaction
name=
"separator"
/>
<addaction
name=
"actionQuit"
/>
</widget>
<addaction
name=
"menuControl"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment