Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pulsatingscience
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
pulsatingscience
Commits
660d7a24
Commit
660d7a24
authored
7 years ago
by
Oliver Bock
Browse files
Options
Downloads
Patches
Plain Diff
Simple fixed disk for source plane (removed obsolete pulsar beam cones)
parent
a8002d68
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/pulsaranimationwidget.cpp
+13
-176
13 additions, 176 deletions
src/pulsaranimationwidget.cpp
with
13 additions
and
176 deletions
src/pulsaranimationwidget.cpp
+
13
−
176
View file @
660d7a24
...
...
@@ -311,15 +311,15 @@ void PulsarAnimationWidget::paintGL()
}
glPopMatrix
();
//
enable wireframe mode
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_
LINE
);
//
back to solid rendering
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_
FILL
);
// draw
pulsar
// draw
source
glPushMatrix
();
{
glTranslatef
(
sin
(
m_orbitRotationAngle
*
deg2rad
)
*
m_pulsarSemiMajorAxis
,
0
.0
,
cos
(
m_orbitRotationAngle
*
deg2rad
)
*
m_pulsarSemiMajorAxis
);
glTranslatef
(
3.0
,
3
.0
,
0.0
);
glPushMatrix
();
{
...
...
@@ -349,189 +349,26 @@ void PulsarAnimationWidget::paintGL()
gluDisk
(
m_quadricPulsarSpinAxisTop2
,
0
,
0.020
,
32
,
8
);
}
glPopMatrix
();
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
}
// draw sphere, with proper lighting
glEnable
(
GL_LIGHTING
);
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT
,
no_mat
);
glMaterialfv
(
GL_FRONT
,
GL_DIFFUSE
,
mat_diffuse
);
gluSphere
(
m_quadricPulsar
,
m_pulsarRadius
,
32
,
32
);
glDisable
(
GL_LIGHTING
);
}
glPopMatrix
();
// first cone
glPushMatrix
();
{
glRotatef
(
90.0
,
1.0
,
0.0
,
0.0
);
glRotatef
(
m_pulsarSpinAxisInclination
,
0.0
,
1.0
,
0.0
);
glRotatef
(
-
m_pulsarRotationAngle
-
90.0
,
0.0
,
0.0
,
1.0
);
glRotatef
(
-
m_pulsarMagneticAxisInclination
,
1.0
,
0.0
,
0.0
);
// draw magnetic axis (for both cones)
if
(
m_showRotationAxes
)
{
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glColor3f
(
1.0
f
,
1.0
f
,
0.0
f
);
glPushMatrix
();
{
glTranslatef
(
0.0
,
0.0
,
-
4.5
);
gluCylinder
(
m_quadricPulsarMagneticAxis
,
0.020
,
0.020
,
9.0
,
32
,
1
);
}
glPopMatrix
();
glPushMatrix
();
{
glTranslatef
(
0.0
,
0.0
,
-
4.5
);
gluDisk
(
m_quadricPulsarSpinAxisTop1
,
0
,
0.020
,
32
,
8
);
}
glPopMatrix
();
glPushMatrix
();
{
glTranslatef
(
0.0
,
0.0
,
4.5
);
gluDisk
(
m_quadricPulsarSpinAxisTop2
,
0
,
0.020
,
32
,
8
);
}
glPopMatrix
();
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
}
glTranslatef
(
0.0
,
0.0
,
-
(
m_pulsarBeamLength
+
m_pulsarRadius
+
0.1
));
// draw first cone's outer layer
glBegin
(
GL_TRIANGLE_FAN
);
{
// Pinnacle of cone is shared vertex for fan, moved up z-axis
// to produce a cone instead of a circle
glColor4f
(
1.0
f
,
1.0
f
,
0.0
f
,
0.33
f
);
glVertex3f
(
0.0
f
,
0.0
f
,
m_pulsarBeamLength
);
// Loop around in a circle and specify even points along the circle
// as the vertices of the triangle fan (32 sections)
for
(
angle
=
0.0
f
;
angle
<
(
2.0
f
*
PI
);
angle
+=
(
PI
/
32.0
f
))
{
// Calculate x and y position of the next vertex
x
=
m_pulsarBeamOuterRadius
*
sin
(
angle
);
y
=
m_pulsarBeamOuterRadius
*
cos
(
angle
);
// Specify the next vertex for the triangle fan
glVertex2f
(
x
,
y
);
}
}
glEnd
();
// draw first cone's "base" (textured bottom to visualize beam intensity)
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glColor4f
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
// create texture coordinates and enable texturing
gluQuadricTexture
(
m_quadricPulsarCone1Shell
,
GL_TRUE
);
glBindTexture
(
GL_TEXTURE_2D
,
m_beamTexture
);
glEnable
(
GL_TEXTURE_2D
);
gluDisk
(
m_quadricPulsarCone1Shell
,
0
,
m_pulsarBeamOuterRadius
,
32
,
1
);
// disable texturing
glDisable
(
GL_TEXTURE_2D
);
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_LINE
);
}
glPopMatrix
();
// second cone (pointing towards from camera)
glPushMatrix
();
{
glRotatef
(
-
90.0
,
1.0
,
0.0
,
0.0
);
glRotatef
(
-
m_pulsarSpinAxisInclination
,
0.0
,
1.0
,
0.0
);
glRotatef
(
m_pulsarRotationAngle
-
90.0
,
0.0
,
0.0
,
1.0
);
glRotatef
(
m_pulsarMagneticAxisInclination
,
1.0
,
0.0
,
0.0
);
glTranslatef
(
0.0
,
0.0
,
-
(
m_pulsarBeamLength
+
m_pulsarRadius
+
0.1
));
// draw second cone's outer layer
glBegin
(
GL_TRIANGLE_FAN
);
{
// Pinnacle of cone is shared vertex for fan, moved up z-axis
// to produce a cone instead of a circle
glColor4f
(
1.0
f
,
1.0
f
,
0.0
f
,
0.33
f
);
glVertex3f
(
0.0
f
,
0.0
f
,
m_pulsarBeamLength
);
// Loop around in a circle and specify even points along the circle
// as the vertices of the triangle fan (32 sections)
for
(
angle
=
0.0
f
;
angle
<
(
2.0
f
*
PI
);
angle
+=
(
PI
/
32.0
f
))
{
// Calculate x and y position of the next vertex
x
=
m_pulsarBeamOuterRadius
*
sin
(
angle
);
y
=
m_pulsarBeamOuterRadius
*
cos
(
angle
);
// Specify the next vertex for the triangle fan
glVertex2f
(
x
,
y
);
}
}
glEnd
();
// draw second cone's "base" (textured bottom to visualize beam intensity)
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
glColor4f
(
1.0
f
,
1.0
f
,
1.0
f
,
1.0
f
);
// create texture coordinates and enable texturing
gluQuadricTexture
(
m_quadricPulsarCone2Shell
,
GL_TRUE
);
glBindTexture
(
GL_TEXTURE_2D
,
m_beamTexture
);
glEnable
(
GL_TEXTURE_2D
);
gluDisk
(
m_quadricPulsarCone2Shell
,
0
,
m_pulsarBeamOuterRadius
,
32
,
1
);
// disable texturing
glDisable
(
GL_TEXTURE_2D
);
}
glPopMatrix
();
}
glPopMatrix
();
// back to solid rendering
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
);
// draw orbital planes
if
(
m_cameraInteraction
||
m_showOrbits
)
{
// draw disc
glMaterialfv
(
GL_FRONT
,
GL_AMBIENT_AND_DIFFUSE
,
translucent
);
glEnable
(
GL_LIGHTING
);
static
double
sizeOffset
=
0.25
;
// companion's plane (only if not identical with pulsar's)
if
(
m_companionSemiMajorAxis
!=
m_pulsarSemiMajorAxis
)
{
glPushMatrix
();
{
glRotatef
(
90.0
,
1.0
,
0.0
,
0.0
);
// separate them slightly in case of overlap
// based on ugly mass diff check (no collision detection)
// single known problematic pair: (m_c=1.4, m_p=1.5)
if
((
int
)(
10
*
(
m_pulsarMass
-
m_companionMass
)
+
0.5
)
==
1
){
glTranslatef
(
0.0
,
0.0
,
0.01
);
}
gluDisk
(
m_quadricCompanionOrbitPlane
,
m_companionSemiMajorAxis
-
sizeOffset
,
m_companionSemiMajorAxis
+
sizeOffset
,
64
,
1
);
}
glPopMatrix
();
}
// pulsar's plane
glPushMatrix
();
{
glRotatef
(
90.0
,
1.0
,
0.0
,
0.0
);
gluDisk
(
m_quadricPulsarOrbitPlane
,
m_pulsarSemiMajorAxis
-
sizeOffset
,
m_pulsarSemiMajorAxis
+
sizeOffset
,
0
,
2
,
64
,
1
);
}
glPopMatrix
();
glDisable
(
GL_LIGHTING
);
}
glPopMatrix
();
}
glPopMatrix
();
// save current state (the following is using parallel projection)
glMatrixMode
(
GL_PROJECTION
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment