Space Comps
 All Classes Files Functions Variables
Public Member Functions | List of all members
QParticle3D Class Reference

3D graphical wrapper for Particle. More...

#include <qparticle3d.h>

Public Member Functions

 QParticle3D (Particle *p)
 Constructs a QParticle3D associated with the given Particle. More...
 
ParticlegetParticle ()
 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

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.

Parameters
pthe Particle with which to associate.

Member Function Documentation

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.

Parameters
painterthe object used to draw the particle to a QGLView.
Particle * QParticle3D::getParticle ( )

Returns the Particle associated with this QParticle3D.

Returns
the associated Particle.
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.

Parameters
tthe timestep of the collision.
void QParticle3D::setPosition ( Position newpos)

Sets the current position of the QParticle3D.

Parameters
newposthe new position for the QParticle3D.

The documentation for this class was generated from the following files: