-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbehavior.h
36 lines (31 loc) · 988 Bytes
/
behavior.h
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
#include <vector>
#include "vec2d.h"
class Fish;
class World;
class Noise;
//--Fishの振る舞いを計算するクラス--
class Behavior
{
//randomwalkにおける円周上の点の以前の位置
double rw_rad;
public:
Behavior() : rw_rad(0.0){}
//分離行動
vec2d separation(Fish* self, World* p_world, std::vector<Fish*>& neighbors);
//整列行動
vec2d alignment(Fish* self, World* p_world, std::vector<Fish*>& neighbors);
//結合行動
vec2d cohesion(Fish* self, World* p_world, std::vector<Fish*>& neighbors);
//追従行動
vec2d seek(Fish* self, World* p_world, Fish* target);
//逃避行動
vec2d flee(Fish* self, World* p_world, Fish* enemy);
//放浪行動
vec2d randomwalk(Fish* self, World* p_world);
//到着行動
vec2d arrive(Fish* self, World* p_world, vec2d target_pos);
vec2d arrive(Fish * self, vec2d aj_pos, vec2d target_pos);
//ノイズ対比
vec2d flee_from_noise(Fish* self, World* p_world, std::vector<Noise*>& neighbors);
};