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

The OrbitalPhysics class is a Physics for three dimensional motion with gravity. More...

#include <orbitalphysics.h>

Inheritance diagram for OrbitalPhysics:
Physics

Public Member Functions

 OrbitalPhysics (double xWinSize, double yWinSize, double zWinSize, double massIn)
 Constructs a Physics3D object with gravity. More...
 
double calculatePE (Particle *p)
 Calculates the potential energy of the given Particle. More...
 
- Public Member Functions inherited from Physics
 Physics ()
 Constructs a Physics object. More...
 
ParticlegetCenterOfGravity ()
 Returns the centerOfGravity. More...
 
bool isOrbital ()
 Boolean for if the system is orbiting. More...
 
bool particlesOverlap (Particle *a, Particle *b)
 Determines whether or not two Particles overlap. More...
 
void resolveCollision (Particle *lP, Particle *rP, int timestep)
 Resolves a collision between two Particles. More...
 
std::valarray< double > getRelativeVelocity (Particle *a, Particle *b)
 Returns the relative velocity between two Particles. More...
 
double getMagnitude (std::valarray< double > vel)
 Returns the magnitude of a vector. More...
 
double calculateKE (Particle *p)
 Calculates the kinetic energy of a given Particle. More...
 
double randDouble (double min, double max)
 Generates a random double within a given range. More...
 
double randGamma (double mean, double var)
 Generates a random double within a given range. More...
 
int randBit ()
 Generates a 0 or 1. More...
 

Additional Inherited Members

- Protected Attributes inherited from Physics
bool orbital
 
ParticlecenterOfGravity
 
boost::mt19937 rng
 

Detailed Description

The OrbitalPhysics class is a Physics for three dimensional motion with gravity.

This physics is the same as the other Physics, but here the Particles are attracted by the center of gravity and accelerate towards it with each timestep.

Constructor & Destructor Documentation

OrbitalPhysics::OrbitalPhysics ( double  xWinSize,
double  yWinSize,
double  zWinSize,
double  massIn 
)

Constructs a Physics3D object with gravity.

This calls Physics::Physics(), then initializes the size of the space, then creates the Particle responsible for gravitation.

Parameters
xWinSizeThe size of the x dimension of this space.
yWinSizeThe size of the y dimension of this space.
zWinSizeThe size of the z dimension of this space.
massInthe mass of the Particle responsible for gravity.

Member Function Documentation

double OrbitalPhysics::calculatePE ( Particle p)
virtual

Calculates the potential energy of the given Particle.

Based on the gravitational field, and the Particle's characteristics, this determines the amount of potential energy. Note, potential energy is always a negative value, with a Particle infinitely far from the center of gravity having 0 potential energy.

Parameters
pThe Particle we are calculating the potential energy for.
Returns
The gravitational potential energy of a particle.

Reimplemented from Physics.


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