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
7aaa6ebf
Commit
7aaa6ebf
authored
Sep 08, 2017
by
Oliver Bock
Browse files
Repurposed old slider to control the source plane inclination
parent
3c302dfe
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/pulsaranimationwidget.cpp
View file @
7aaa6ebf
...
...
@@ -79,6 +79,7 @@ PulsarAnimationWidget::PulsarAnimationWidget(QWidget *parent) :
m_LHOAngle
=
180
;
m_LLOAngle
=
-
100
;
m_VirgoAngle
=
165
;
m_sourceInclination
=
0
;
m_pulsarRadius
=
3.0
;
m_pulsarSpinAxisInclination
=
0.0
;
...
...
@@ -392,6 +393,7 @@ void PulsarAnimationWidget::paintGL()
3.0
,
-
3.0
);
glRotatef
(
m_sourceInclination
,
0.0
,
1.0
,
0.0
);
glRotatef
(
-
45
,
0.0
,
1.0
,
0.0
);
glRotatef
(
90
,
1.0
,
0.0
,
0.0
);
...
...
@@ -619,11 +621,9 @@ void PulsarAnimationWidget::setFramePerSecond(const unsigned int fps)
m_framesPerSecond
=
fps
;
}
void
PulsarAnimationWidget
::
set
PulsarSemiMajorAxis
(
const
double
length
)
void
PulsarAnimationWidget
::
set
SourceInclination
(
const
double
degrees
)
{
m_pulsarSemiMajorAxis
=
length
;
m_companionSemiMajorAxis
=
(
m_pulsarMass
/
m_companionMass
)
*
m_pulsarSemiMajorAxis
;
updateOrbitPeriod
();
m_sourceInclination
=
degrees
;
updatePulseProfile
();
updateGL
();
...
...
src/pulsaranimationwidget.h
View file @
7aaa6ebf
...
...
@@ -51,7 +51,7 @@ public:
void
setLLOAngle
(
const
double
degrees
);
void
setVirgoAngle
(
const
int
degrees
);
void
setPulsarSpinAxisInclination
(
const
int
degrees
);
void
set
PulsarSemiMajorAxis
(
const
double
length
);
void
set
SourceInclination
(
const
double
length
);
void
setPulsarBeamAngle
(
const
int
degrees
);
void
getCameraPosition
(
double
&
cameraAngleH
,
double
&
cameraAngleV
,
double
&
cameraZoom
);
void
resetCameraPosition
(
const
double
angleH
,
const
double
angleV
,
const
double
zoom
);
...
...
@@ -121,6 +121,7 @@ private:
double
m_LLOAngle
;
double
m_VirgoAngle
;
double
m_pulsarSpinAxisInclination
;
double
m_sourceInclination
;
double
m_companionMass
;
double
m_companionSemiMajorAxis
;
...
...
src/pulsatingscience.cpp
View file @
7aaa6ebf
...
...
@@ -91,9 +91,6 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
connect
(
ui
.
actionPulseFlashes
,
SIGNAL
(
toggled
(
bool
)),
ui
.
pulsarGlWidget
,
SLOT
(
showPulseFlashes
(
bool
)));
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulsarSemiMajorAxisUpdated
(
double
)),
this
,
SLOT
(
updatePulsarSemiMajorAxisValue
(
double
)));
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulsarAnimationStep
(
double
)),
ui
.
pulseScopeWidget
,
SLOT
(
setMarker
(
double
)),
Qt
::
DirectConnection
);
...
...
@@ -226,11 +223,10 @@ void PulsatingScience::on_sliderPulsarSpinAxisInclination_valueChanged(int value
ui
.
lcdPulsarSpinAxisInclination
->
display
(
QString
::
number
(
value
));
}
void
PulsatingScience
::
on_slider
PulsarSemiMajorAxis
_valueChanged
(
int
value
)
void
PulsatingScience
::
on_slider
SourceInclination
_valueChanged
(
int
value
)
{
ui
.
pulsarGlWidget
->
setPulsarSemiMajorAxis
(
value
*
0.001
);
ui
.
lcdPulsarSemiMajorAxis
->
display
(
QString
::
number
(
value
*
0.001
,
'f'
,
1
));
ui
.
lcdPulsarSemiMajorAxis
->
setStyleSheet
(
"color: black"
);
ui
.
pulsarGlWidget
->
setSourceInclination
(
value
);
ui
.
lcdSourceInclination
->
display
(
QString
::
number
(
value
));
}
void
PulsatingScience
::
permanentOrbitsToggled
()
{
...
...
@@ -447,21 +443,6 @@ void PulsatingScience::on_actionAbout_triggered()
QMessageBox
::
about
(
this
,
tr
(
"About
\"
Pulsating Science
\"
"
),
content
);
}
void
PulsatingScience
::
updatePulsarSemiMajorAxisValue
(
double
value
)
{
ui
.
sliderPulsarSemiMajorAxis
->
setValue
(
qRound
(
value
*
1000.0
));
if
((
int
)
value
<=
1
||
(
int
)
value
>=
20
)
{
if
((
int
)
value
<
1
||
(
int
)
value
>
20
)
{
ui
.
lcdPulsarSemiMajorAxis
->
setStyleSheet
(
"color: red"
);
}
else
{
ui
.
lcdPulsarSemiMajorAxis
->
setStyleSheet
(
"color: black"
);
}
ui
.
lcdPulsarSemiMajorAxis
->
display
(
QString
::
number
(
value
,
'f'
,
1
));
}
}
void
PulsatingScience
::
toggleHiddenDemoMode
()
{
if
(
m_hiddenDemoModeActivated
)
{
...
...
@@ -529,7 +510,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
static
int
sliderLLOAngle
;
static
int
sliderVirgoAngle
;
static
int
sliderPulsarSpinAxisInclination
;
static
int
slider
PulsarSemiMajorAxis
;
static
int
slider
SourceInclination
;
static
double
cameraAngleH
;
static
double
cameraAngleV
;
...
...
@@ -541,7 +522,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
ui
.
sliderLLOAngle
->
setValue
(
sliderLLOAngle
);
ui
.
sliderPulsarSpinAxisInclination
->
setValue
(
sliderPulsarSpinAxisInclination
);
ui
.
sliderVirgoAngle
->
setValue
(
sliderVirgoAngle
);
ui
.
slider
PulsarSemiMajorAxis
->
setValue
(
sliderPulsarSemiMajorAxis
);
ui
.
slider
SourceInclination
->
setValue
(
sliderSourceInclination
);
ui
.
pulsarGlWidget
->
resetCameraPosition
(
cameraAngleH
,
cameraAngleV
,
cameraZoom
);
}
else
{
...
...
@@ -550,7 +531,7 @@ void PulsatingScience::saveOrRestoreInitialAnimationSettings()
sliderLLOAngle
=
ui
.
sliderLLOAngle
->
value
();
sliderPulsarSpinAxisInclination
=
ui
.
sliderPulsarSpinAxisInclination
->
value
();
sliderVirgoAngle
=
ui
.
sliderVirgoAngle
->
value
();
slider
PulsarSemiMajorAxis
=
ui
.
sliderPulsarSemiMajorAxis
->
value
();
slider
SourceInclination
=
ui
.
sliderSourceInclination
->
value
();
ui
.
pulsarGlWidget
->
getCameraPosition
(
cameraAngleH
,
cameraAngleV
,
cameraZoom
);
initialized
=
true
;
}
...
...
src/pulsatingscience.h
View file @
7aaa6ebf
...
...
@@ -47,7 +47,7 @@ public slots:
void
on_sliderLLOAngle_valueChanged
(
int
value
);
void
on_sliderVirgoAngle_valueChanged
(
int
value
);
void
on_sliderPulsarSpinAxisInclination_valueChanged
(
int
value
);
void
on_slider
PulsarSemiMajorAxis
_valueChanged
(
int
value
);
void
on_slider
SourceInclination
_valueChanged
(
int
value
);
void
permanentOrbitsToggled
();
void
on_actionPermanent_orbits_toggled
(
bool
checked
);
...
...
@@ -67,7 +67,6 @@ public slots:
void
on_actionWebsite_triggered
();
void
on_actionAbout_triggered
();
void
updatePulsarSemiMajorAxisValue
(
double
value
);
void
toggleHiddenDemoMode
();
void
userInactivityCallback
();
...
...
src/pulsatingscience.ui
View file @
7aaa6ebf
...
...
@@ -213,7 +213,7 @@
</widget>
</item>
<item
row=
"5"
column=
"2"
>
<widget
class=
"QLCDNumber"
name=
"lcd
PulsarSemiMajorAxis
"
>
<widget
class=
"QLCDNumber"
name=
"lcd
SourceInclination
"
>
<property
name=
"numDigits"
>
<number>
6
</number>
</property>
...
...
@@ -221,23 +221,23 @@
<enum>
QLCDNumber::Flat
</enum>
</property>
<property
name=
"value"
stdset=
"0"
>
<double>
5
.000000000000000
</double>
<double>
0
.000000000000000
</double>
</property>
</widget>
</item>
<item
row=
"5"
column=
"1"
>
<widget
class=
"QSlider"
name=
"slider
PulsarSemiMajorAxis
"
>
<widget
class=
"QSlider"
name=
"slider
SourceInclination
"
>
<property
name=
"statusTip"
>
<string>
Use this slider to adjust the
length of the semi major axis of the pulsar's elliptical orbit
</string>
<string>
Use this slider to adjust the
inclination of the source plane
</string>
</property>
<property
name=
"minimum"
>
<number>
100
0
</number>
<number>
-9
0
</number>
</property>
<property
name=
"maximum"
>
<number>
2000
0
</number>
<number>
9
0
</number>
</property>
<property
name=
"value"
>
<number>
500
0
</number>
<number>
0
</number>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -246,7 +246,7 @@
<enum>
QSlider::TicksBelow
</enum>
</property>
<property
name=
"tickInterval"
>
<number>
100
0
</number>
<number>
0
</number>
</property>
</widget>
</item>
...
...
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