The Physics class.
More...
#include <physics.h>
|
bool | orbital |
|
Particle * | centerOfGravity |
|
boost::mt19937 | rng |
|
Constructs a Physics object.
Constructs a Physics object by setting Orbital to false and seeding random number generators.
double Physics::calculateKE |
( |
Particle * |
p | ) |
|
Calculates the kinetic energy of a given Particle.
Returns a double representing the kinetic energy given a pointer to a Particle.
- Parameters
-
- Returns
- double
double Physics::calculatePE |
( |
Particle * |
p | ) |
|
|
virtual |
Calculates the potential energy of a given Particle.
Returns a double representing the potential energy given a pointer to a Particle.
- Parameters
-
- Returns
- double
Reimplemented in OrbitalPhysics.
Particle * Physics::getCenterOfGravity |
( |
| ) |
|
Returns the centerOfGravity.
Returns a pointer to a Particle representing the centerOfGravity.
- Returns
- pointer to a Particle.
double Physics::getMagnitude |
( |
std::valarray< double > |
vel | ) |
|
Returns the magnitude of a vector.
Returns a double representing the magnitude of a given std::valarray<double>.
- Parameters
-
- Returns
- double
std::valarray< double > Physics::getRelativeVelocity |
( |
Particle * |
a, |
|
|
Particle * |
b |
|
) |
| |
Returns the relative velocity between two Particles.
Returns a std::valarray<double> of the relative velocity between two Particles given a pointer to each Particle.
- Parameters
-
- Returns
- std::valarray<double>
virtual void Physics::initializeAcceleration |
( |
Particle * |
p | ) |
|
|
inlinevirtual |
NOT REALLY SURE.
- Parameters
-
bool Physics::isOrbital |
( |
| ) |
|
Boolean for if the system is orbiting.
Returns true if the system has orbiting Particles; false if not.
- Returns
- boolean
Determines whether or not two Particles overlap.
Returns a bool true if the two Particles overlap, otherise false.
- Parameters
-
- Returns
- bool whether or not the Particles overlap.
Generates a 0 or 1.
Returns 0 or 1 randomly generated in a normal distribution.
- Returns
- int
double Physics::randDouble |
( |
double |
min, |
|
|
double |
max |
|
) |
| |
Generates a random double within a given range.
Returns a randomly generated double in a normal distribution between a given min and max.
- Parameters
-
- Returns
- double
double Physics::randGamma |
( |
double |
mean, |
|
|
double |
var |
|
) |
| |
Generates a random double within a given range.
Returns a randomly generated double in a gamma distribution between a given min and max.
- Parameters
-
- Returns
- double
Resolves a collision between two Particles.
Resolves a collision between pointers to two given Particles at a given timestep.
- Parameters
-
virtual void Physics::updatePositionAndVelocity |
( |
Particle * |
p, |
|
|
int |
timestep |
|
) |
| |
|
pure virtual |
Updates the position and velocity of a Particle.
Updates the position and velocity of a given Particle at a given timestep. Each Algorithm implements it's own version.
- Parameters
-
p | pointer to the Particle to be updated. |
timestep | int |
The documentation for this class was generated from the following files: