Galaxy.h

Classes

Galaxy -- Simple class to represent a Galaxy as a collection of Stars. (full description)
Star -- Simple class which represents a star as a point mass. (full description)

class Galaxy

Types

enum PLOT_MODE

POSITION
VELOCITY

Interface

Public Members
Galaxy(Vector<Double>& position, Vector<Double>& velocity, Double mass, Double size, uInt numStars, uInt numRings, Double inclination, Double positionAngle, Int xSize, Int ySize)
~Galaxy()
void computeStep(List<void *>& galaxyList, Double timeStep, Double dampingFactor = 1.0)
void update()
void applyForceToStars(List<void *>& galaxyList, Double timeStep, Double dampingFactor)
void rotate(Matrix<Double>& rotMatrix)
void draw(PixelCanvas *pixelCanvas)
Double force(Double distance)
Double getMass()
Vector<Double>& getPosition()
Vector<Double>& getVelocity()
void setPlotMode(Galaxy::PLOT_MODE plotMode)
void setScale(Int xSize, Int ySize)

Description

Member Description

enum PLOT_MODE

Galaxy(Vector<Double>& position, Vector<Double>& velocity, Double mass, Double size, uInt numStars, uInt numRings, Double inclination, Double positionAngle, Int xSize, Int ySize)

Constructor

~Galaxy()

Destructor

void computeStep(List<void *>& galaxyList, Double timeStep, Double dampingFactor = 1.0)

Compute a new position, applying the force of the Galaxies in the List but do not update current position and velocity

void update()

update position and velocity to new value

void applyForceToStars(List<void *>& galaxyList, Double timeStep, Double dampingFactor)

Compute a new position for the Stars in this Galaxy

void rotate(Matrix<Double>& rotMatrix)

Rotate position and velocity

void draw(PixelCanvas *pixelCanvas)

Draw the Galaxy on the PixelCanvas

Double force(Double distance)

magnitude of the force for this galaxy

Double getMass()

Return the Mass of the Galaxy

Vector<Double>& getPosition()

Return the position of the Galaxy

Vector<Double>& getVelocity()

Return the Velocity of the Galaxy

void setPlotMode(Galaxy::PLOT_MODE plotMode)

Set the plot mode

void setScale(Int xSize, Int ySize)


class Star

Interface

Star(Vector<Double>& position, Vector<Double>& velocity, Int xSize, Int ySize)
~Star()
void draw(PixelCanvas *pixelCanvas)
void applyForce(List<void *>& galaxyList, Double timeStep, Double dampingFactor)
void rotate(Matrix<Double>& rotMatrix)
void setPlotMode(Galaxy::PLOT_MODE newPlotMode)
void setScale(Int xSize, Int ySize)

Description

Member Description

Star(Vector<Double>& position, Vector<Double>& velocity, Int xSize, Int ySize)

Constructor

~Star()

Destructor

void draw(PixelCanvas *pixelCanvas)

Draw the current position on the PixelCanvas

void applyForce(List<void *>& galaxyList, Double timeStep, Double dampingFactor)

Compute new position by applying the forces of the Galaxies in the List

void rotate(Matrix<Double>& rotMatrix)

Rotate position and velocity

void setPlotMode(Galaxy::PLOT_MODE newPlotMode)

Set the plot mode

void setScale(Int xSize, Int ySize)