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

The Physics2D class is a Physics that works specifically in two d. More...

#include <physics2d.h>

Inheritance diagram for Physics2D:
Physics

Public Member Functions

 Physics2D (double xWinSize, double yWinSize)
 Constructs a Physics2D object. 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...
 
virtual double calculatePE (Particle *p)
 Calculates the potential energy of a given Particle. More...
 
virtual void initializeAcceleration (Particle *p)
 NOT REALLY SURE. 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...
 

Protected Member Functions

void fixWallCollision (Particle *p, double newXpos, double newYpos, double newXvel, double newYvel, int timestep)
 

Protected Attributes

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

Detailed Description

The Physics2D class is a Physics that works specifically in two d.

This is useful because it simplifies calculations especially related to checking if particles are bouncing off the walls of the space because it doesn't have to worry about the z dimension.

Constructor & Destructor Documentation

Physics2D::Physics2D ( double  xWinSize,
double  yWinSize 
)

Constructs a Physics2D object.

This calls Physics::Physics(), then initializes the size of the space.

Parameters
xWinSizeThe size of the x dimension of this space.
yWinSizeThe size of the y dimension of this space.

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