#ifndef PARTICLE_H
#define PARTICLE_H

#include "ofMain.h"
#include "ofxVectorMath.h"


// C style 80s :)

typedef struct{
	int			count;
	ofxVec2f	sum;
	float		distance;
	float		strength;
} flockingForce;
 

// C++ style 90s :)
/*
class flockingForce {
	public:
	
	int			count;
	ofxVec2f	sum;
	float		distance;
	float		strength;
	
};
*/



class particle{

	public:
        ofxVec2f pos;
        ofxVec2f vel;
        ofxVec2f frc;   // frc is also know as acceleration (newton says "f=ma")
		ofxVec2f lastPos;
			
        particle();
		virtual ~particle(){};
		void reset();
	void reset2();
        void resetForce();
		void addForce(float x, float y);
		void addRepulsionForce(float x, float y, float radius, float scale);
		void addAttractionForce(float x, float y, float radius, float scale);
		
		void addRepulsionForce(particle &p, float radius, float scale);
		void addAttractionForce(particle &p, float radius, float scale);
		void addClockwiseForce(particle &p, float radius, float scale);
		void addCounterClockwiseForce(particle &p, float radius, float scale);
		bool calDist(particle &p);
	
	
		void addDampingForce();
 
		void addForFlocking(particle &p);
		void addFlockingForce();
	
		flockingForce cohesion;
		flockingForce seperation;
		flockingForce alignment;
	
	
		void setInitialCondition(float px, float py, float vx, float vy);
        void update();
        void draw();
	
		void draw2(ofImage *);
		void draw3(ofImage *);
		void drawBoat(ofImage *);
	
		void draw4(ofImage *);
	
		vector <ofPoint> points;


	
		void bounceOffWalls();
		void bounceOffWallsSharks();

		void invertWalls();

	
		float damping;
		int leafWidth;
		int leafHeight;
	
		float rad;
		float distancePrint;
		float radiusSum;


    protected:
    private:
};

#endif // PARTICLE_H
