#include "vector.h"

struct stCar{
	vector direction,
		   velocityV,
		   position;
	float engineForce,
		  velocityMag,
		  mass;
};

typedef struct stCar car;

vector tractionForce(car a);
vector aerodynamicDrag(float cDrag, car a);
vector rollingResistance(float cResistance, car a);
vector longitudinalForce(float cDrag, float cResistance,car a);


/*

wooden car

tractionForce = engineForce * directionVector
	aerodynamic drag.  This force is so important because it is proportional to the square of the velocity.
	aerodynamicDrag = -constantDrag * velocityVector * velocityMagnitude
	rolling resistance friction between the rubber and road surface proportional to the velocity using another constant
	rollingResistanc = -constantResistance * velocityVector
total longtitudinal force is the vector sum of these three forces. 
longitudinalForce = tractionForce + aerodynamicDrag + rollingResistance

The acceleration (a) of the car (in meters per second squared) is determined by the net force on the car (in Newton) and the car's mass M (in kilogram) via Newton's second law: 
acceleration = force / mass
The car's velocity (in meters per second) is determined by integrating the acceleration over time.  This sounds more complicated than it is, usually the following equation does the trick.  This is known as the Euler method for numerical integration. 
velocity = velocity + dt * acceleration
dt = time increment in second
car position
pos = pos + dt*v

constant
constantDrag = 0.5 * coefficientFriction * FrontalAreaOfCar * densityOfAirInRHO
densityOfAirInRHO = 1.29kg/m3
frontalAreaOfCar = ~2.2  (corvette)
coefficientFriction = 0.3 (corvette)

brake
longitudinalForce = brakingForce + aerodynamic drag + rollingResistanc
brakingForce  = -u * constantBraking
Keep in mind to stop applying the braking force as soon as the speed is reduced to zero otherwise the car will end up going in reverse. 
need better model




*/
