/* Obstruction.h
 *
 * Interface definition for the Obstruction class, which stores obstruction
 * data and can detect path intersection (collision).
 */

#ifndef OBSTRUCTION_H_INCLUDED
#define OBSTRUCTION_H_INCLUDED 1

#include "Tuple.h"
#include "Tuplex.h"
#include "Path.h"

class Obstruction
{
protected:
	// Constants
	static const double EPSILON;
	static const double BUFFER;
	static const double DEF_DAMPING;
	static const double DEF_FRICTION;

	// Member Variables
	double damping_;	// Affects bouncing
	double friction_;	// Affects rolling (and some of bouncing)

	// Private functions
	static const double max(const double& a, const double& b)
		{return a >= b ? a : b;}
	static const double min(const double& a, const double& b)
		{return a <= b ? a : b;}

public:
	// Constructors/Destructor
	Obstruction(double damping = DEF_DAMPING, double friction = DEF_FRICTION);
	virtual ~Obstruction();

	// Member Functions
	virtual void			draw(bool light) const;	// Draw the obstruction
	virtual const double	pathIntersect(	// Check if path hits obstruction
		const Path& path,
		double radius) const;
	virtual const Tuple		calcNormal(		// Find normal relative to some pos
		const Tuple& point) const;

	// Accessors
	virtual const bool isHole() const {return false;}
	double	damping() const		{return damping_;}
	double	friction() const	{return friction_;}
};

#endif // OBSTRUCTION_H_INCLUDED
