/***************************************************************************
 *            physics.h
 *
 *  Thu Jan 27 15:45:30 2005
 *  Copyright  2005  Peter Baldwin
 *  pgbaldwi@uwaterloo.ca
 ****************************************************************************/

#ifndef _PHYSICS_H
#define _PHYSICS_H

#include "vector.h"

//physical object
typedef struct {
	vector pos;
	vector vel;
	double mass;
	double uimpact; //coefficient of impact: 
					// percentage of energy which is lost in a collision
					// i.e. uimpact of 0 implies perfectly elastic collision
	
} pObject;

//physical circle
typedef struct {
	pObject *o;
	const double radius;
} pCircle;

//physical rectangle
typedef struct {
	pObject *o;
	const double w, h;
} pRectangle;

//collision detection and reaction
bool pCollisionCircCirc(pCircle *a, pCircle *b);
bool pCollisionCircRect(pCircle *a, pRectangle *b);
bool pCollisionRectRect(pRectangle *a, pRectangle *b);
void pMove(pObject *obj, vector fnet, double t);

#endif /* _PHYSICS_H */
