-
Notifications
You must be signed in to change notification settings - Fork 0
/
flock.hpp
53 lines (42 loc) · 1.33 KB
/
flock.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <QVector>
class Landscape;
class LandscapeScene;
class Boid;
class Simulation;
class Flock {
public:
Flock(
Landscape *landscapeView, LandscapeScene *landscapeScene,
int moveWeight, int matchWeight,
int avoidWeight, int targetWeight,
Simulation *sim
);
~Flock();
void createBoids(int numBoids);
Boid* spawnBoid();
QVector<Boid*> getBoids();
int numberOfBoids();
void addBoid(Boid *boid);
void removeBoid();
void updateBoids(Flock *flockToAvoid, int ticksOffset);
QPointF centreOfFlock();
void setMoveWeight(int newWeight);
void setMatchWeight(int newWeight);
void setAvoidWeight(int newWeight);
void setTargetWeight(int newWeight);
private:
void boundBoid(Boid *boid);
QPointF moveTowardsCentre(Boid *boid);
QPointF avoidOtherBoids(Boid *boid);
QPointF avoidOtherFlock(Boid *boid, Flock *flock);
QPointF matchVelocity( Boid *boid);
float distanceBetween(Boid *boid1, Boid *boid2);
QVector<Boid*> boids;
Landscape *landscapeView_;
LandscapeScene *landscapeScene_;
Simulation *sim_;
int moveWeight_;
int matchWeight_;
int avoidWeight_;
int targetWeight_;
};