Skip to content
Snippets Groups Projects
Commit fb2caaff authored by Oliver Bock's avatar Oliver Bock
Browse files

Ensure that orbital planes overlap nicely

parent c9bfa5fa
Branches
No related tags found
No related merge requests found
......@@ -304,23 +304,33 @@ void PulsarAnimationWidget::paintGL()
if(m_cameraInteraction) {
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, translucent);
// companion
static float sizeOffset = 0.25f;
// companion's plane (only if not identical with pulsar's)
if(m_companionSemiMajorAxis != m_pulsarSemiMajorAxis) {
glPushMatrix();
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(0.0f, 0.0f, 0.0f);
// 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.5f) == 1){
glTranslatef(0.0f, 0.0f, 0.01f);
}
gluDisk(m_quadricCompanionOrbitPlane,
m_companionSemiMajorAxis - 0.25f,
m_companionSemiMajorAxis + 0.25f,
m_companionSemiMajorAxis - sizeOffset,
m_companionSemiMajorAxis + sizeOffset,
64, 1);
glPopMatrix();
}
// pulsar
// pulsar's plane
glPushMatrix();
glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glTranslatef(0.0f, 0.0f, 0.1f);
gluDisk(m_quadricPulsarOrbitPlane,
m_pulsarSemiMajorAxis - 0.25f,
m_pulsarSemiMajorAxis + 0.25f,
m_pulsarSemiMajorAxis - sizeOffset,
m_pulsarSemiMajorAxis + sizeOffset,
64, 1);
glPopMatrix();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment