3D graphical wrapper for Particle. More...
#include <qparticle3d.h>
Public Member Functions | |
QParticle3D (Particle *p) | |
Constructs a QParticle3D associated with the given Particle. More... | |
Particle * | getParticle () |
Returns the Particle associated with this QParticle3D. More... | |
void | setPosition (Position *newpos) |
Sets the current position of the QParticle3D. More... | |
void | setCollisionTimestep (int t) |
Sets the timestep for the a collision involving the Particle. More... | |
void | incrementTimestep () |
Increments the internal timestep counter. More... | |
void | draw (QGLPainter *painter) |
Draw the QParticle3D to the display. More... | |
3D graphical wrapper for Particle.
QParticle3D provides a graphical wrapper for Particle for 3D visualization. Each QParticle3D is associated witha Particle and allows that particle to be drawn into the CollisionDisplay3D.
QParticle3D::QParticle3D | ( | Particle * | p | ) |
Constructs a QParticle3D associated with the given Particle.
Initializes the actual sphere for visualization and sets the initial position of the sphere.
p | the Particle with which to associate. |
void QParticle3D::draw | ( | QGLPainter * | painter | ) |
Draw the QParticle3D to the display.
Draws the QParticle3D depending on a few different factors. If the QParticle3D is marked for collision, it will be painted red. Otherwise, it will be painted green. If the Particle represents the center of mass, it will instead be textured with an image of the earth.
painter | the object used to draw the particle to a QGLView. |
Particle * QParticle3D::getParticle | ( | ) |
Returns the Particle associated with this QParticle3D.
void QParticle3D::incrementTimestep | ( | ) |
Increments the internal timestep counter.
Increments the internal timestep counter to keep it in sync with CollisionDisplay's timestep counter.
void QParticle3D::setCollisionTimestep | ( | int | t | ) |
Sets the timestep for the a collision involving the Particle.
Once marked for a collision by this method, the QParticle3D will be drawn in red until the collision happens.
t | the timestep of the collision. |
void QParticle3D::setPosition | ( | Position * | newpos | ) |
Sets the current position of the QParticle3D.
newpos | the new position for the QParticle3D. |