Skip to content
GitLab
Menu
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
efbbe3b5
Commit
efbbe3b5
authored
Sep 12, 2017
by
Oliver Bock
Browse files
Added mock-up curves for the three IFOs
parent
01f66fe5
Changes
7
Hide whitespace changes
Inline
Side-by-side
pulsatingscience.pro
View file @
efbbe3b5
...
...
@@ -26,7 +26,8 @@ QT += core \
webkit
HEADERS
+=
src
/
pulsaranimationwidget
.
h
\
src
/
pulsescopewidget
.
h
\
src
/
pulsatingscience
.
h
src
/
pulsatingscience
.
h
\
src
/
common
.
h
SOURCES
+=
src
/
pulsaranimationwidget
.
cpp
\
src
/
pulsescopewidget
.
cpp
\
src
/
pulsatingscience
.
cpp
\
...
...
src/common.h
0 → 100644
View file @
efbbe3b5
#ifndef COMMON_H
#define COMMON_H
#define PERIODS 2
#endif // COMMON_H
src/pulsaranimationwidget.cpp
View file @
efbbe3b5
...
...
@@ -24,8 +24,9 @@ const double PulsarAnimationWidget::deg2rad = PI/180.0;
PulsarAnimationWidget
::
PulsarAnimationWidget
(
QWidget
*
parent
)
:
QGLWidget
(
QGLFormat
(
QGL
::
AlphaChannel
|
QGL
::
SampleBuffers
),
parent
),
m_pulseProfile
(
360
,
0.0
)
m_curveLHO
(
360
*
PERIODS
,
0.0
),
m_curveLLO
(
360
*
PERIODS
,
0.0
),
m_curveVirgo
(
360
*
PERIODS
,
0.0
)
{
QString
msgThis
=
tr
(
"3D animation"
);
if
(
!
format
().
directRendering
())
{
...
...
@@ -571,10 +572,12 @@ void PulsarAnimationWidget::resetCameraPosition(const double angleH, const doubl
void
PulsarAnimationWidget
::
updatePulseProfile
()
{
for
(
int
x
=
0
;
x
<
360
;
++
x
)
{
m_pulseProfile
[
x
]
=
0
;
for
(
int
x
=
0
;
x
<
360
*
PERIODS
;
++
x
)
{
m_curveLHO
[
x
]
=
sin
(
x
*
deg2rad
);
m_curveLLO
[
x
]
=
cos
(
x
*
deg2rad
);
m_curveVirgo
[
x
]
=
0
;
}
// propagate new profile
emit
pulseProfileUpdated
(
m_
pulseProfile
);
emit
pulseProfileUpdated
(
m_
curveLHO
,
m_curveLLO
,
m_curveVirgo
);
}
src/pulsaranimationwidget.h
View file @
efbbe3b5
...
...
@@ -34,8 +34,9 @@
#include <GL/glu.h>
#endif
#
define PI 3.14159265
#
include "common.h"
#define PI 3.14159265
class
PulsarAnimationWidget
:
public
QGLWidget
{
...
...
@@ -54,7 +55,7 @@ public:
void
resetCameraPosition
(
const
double
angleH
,
const
double
angleV
,
const
double
zoom
);
signals:
void
pulseProfileUpdated
(
const
QVector
<
double
>&
data
);
void
pulseProfileUpdated
(
const
QVector
<
double
>&
data
LHO
,
const
QVector
<
double
>&
dataLLO
,
const
QVector
<
double
>&
dataVirgo
);
private:
void
initializeGL
();
...
...
@@ -102,7 +103,9 @@ private:
double
m_cameraPosY
;
double
m_cameraPosZ
;
QVector
<
double
>
m_pulseProfile
;
QVector
<
double
>
m_curveLHO
;
QVector
<
double
>
m_curveLLO
;
QVector
<
double
>
m_curveVirgo
;
static
const
double
deg2rad
;
};
...
...
src/pulsatingscience.cpp
View file @
efbbe3b5
...
...
@@ -58,8 +58,8 @@ PulsatingScience::PulsatingScience(QWidget *parent) : QMainWindow(parent)
m_hiddenShortcut
=
new
QShortcut
(
QKeySequence
(
Qt
::
SHIFT
+
Qt
::
ALT
+
Qt
::
Key_D
),
this
);
// establish object communications
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulseProfileUpdated
(
const
QVector
<
double
>&
)),
ui
.
pulseScopeWidget
,
SLOT
(
plot
(
const
QVector
<
double
>&
)),
Qt
::
DirectConnection
);
connect
(
ui
.
pulsarGlWidget
,
SIGNAL
(
pulseProfileUpdated
(
const
QVector
<
double
>&
,
const
QVector
<
double
>&
,
const
QVector
<
double
>&
)),
ui
.
pulseScopeWidget
,
SLOT
(
plot
(
const
QVector
<
double
>&
,
const
QVector
<
double
>&
,
const
QVector
<
double
>&
)),
Qt
::
DirectConnection
);
connect
(
m_hiddenShortcut
,
SIGNAL
(
activated
()),
this
,
SLOT
(
toggleHiddenDemoMode
()));
...
...
src/pulsescopewidget.cpp
View file @
efbbe3b5
...
...
@@ -49,17 +49,21 @@ PulseScopeWidget::PulseScopeWidget(QWidget *parent) : QGraphicsView(parent),
qWarning
()
<<
msg
.
arg
(
msgThis
);
}
m_scopeSizeH
=
360.0
;
m_scopeSizeH
=
360.0
*
PERIODS
;
m_scopeSizeV
=
2.0
;
m_path
=
NULL
;
m_pathLHO
=
NULL
;
m_pathLLO
=
NULL
;
m_pathVirgo
=
NULL
;
m_marker
=
m_scene
.
addLine
(
0.0
,
0.0
,
0.0
,
m_scopeSizeV
);
m_marker
->
setZValue
(
1
);
setScene
(
&
m_scene
);
m_data
.
fill
(
0.0
,
qRound
(
m_scopeSizeH
));
drawCurve
(
m_path
,
m_data
,
"black"
);
drawCurve
(
m_pathLHO
,
m_data
,
"black"
);
drawCurve
(
m_pathLLO
,
m_data
,
"black"
);
drawCurve
(
m_pathVirgo
,
m_data
,
"black"
);
}
PulseScopeWidget
::~
PulseScopeWidget
()
...
...
@@ -74,9 +78,11 @@ void PulseScopeWidget::resizeEvent(QResizeEvent *event)
fitInView
(
m_scene
.
itemsBoundingRect
(),
Qt
::
IgnoreAspectRatio
);
}
void
PulseScopeWidget
::
plot
(
const
QVector
<
double
>&
vector
)
void
PulseScopeWidget
::
plot
(
const
QVector
<
double
>&
dataLHO
,
const
QVector
<
double
>&
dataLLO
,
const
QVector
<
double
>&
dataVirgo
)
{
drawCurve
(
m_path
,
vector
,
"yellow"
);
drawCurve
(
m_pathLHO
,
dataLHO
,
"blue"
);
drawCurve
(
m_pathLLO
,
dataLLO
,
"red"
);
drawCurve
(
m_pathVirgo
,
dataVirgo
,
"green"
);
}
void
PulseScopeWidget
::
drawCurve
(
QGraphicsPathItem
*
path
,
const
QVector
<
double
>&
vector
,
QString
color
)
...
...
src/pulsescopewidget.h
View file @
efbbe3b5
...
...
@@ -30,6 +30,7 @@
#include <QGraphicsLineItem>
#include <QDebug>
#include "common.h"
class
PulseScopeWidget
:
public
QGraphicsView
{
...
...
@@ -42,14 +43,16 @@ public:
void
resizeEvent
(
QResizeEvent
*
event
);
public
slots
:
void
plot
(
const
QVector
<
double
>&
vector
);
void
plot
(
const
QVector
<
double
>&
dataLHO
,
const
QVector
<
double
>&
dataLLO
,
const
QVector
<
double
>&
dataVirgo
);
private:
void
drawCurve
(
QGraphicsPathItem
*
path
,
const
QVector
<
double
>&
vector
,
QString
color
);
QGraphicsScene
m_scene
;
QVector
<
double
>
m_data
;
QGraphicsPathItem
*
m_path
;
QGraphicsPathItem
*
m_pathLHO
;
QGraphicsPathItem
*
m_pathLLO
;
QGraphicsPathItem
*
m_pathVirgo
;
QGraphicsLineItem
*
m_marker
;
double
m_scopeSizeH
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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