Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

agent.h 1.38 KB
Newer Older
Pierre Kraemer's avatar
Pierre Kraemer committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#ifndef M_AGENT_H
#define M_AGENT_H

#include <iostream>

#include "utils.h"
#include "env_map.h"
#include "Algo/MovingObjects/particle_cell_2D.h"

class Simulator;

class Agent
{
public:
	Agent(Simulator* sim, const VEC3& position, Dart d);

17
18
	VEC3 getPosition();

Pierre Kraemer's avatar
Pierre Kraemer committed
19
20
21
22
23
24
25
26
	void updateAgentNeighbors();
	void updateObstacleNeighbors();

	void update();
	
	void computePrefVelocity();
	void computeNewVelocity();

27
28
	void computeNewVelocity2();

Pierre Kraemer's avatar
Pierre Kraemer committed
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
	bool linearProgram1(
		const std::vector<Line>& lines, unsigned int lineNo,
		float radius, const VEC3& optVelocity,
		bool directionOpt, VEC3& result
	);

	bool linearProgram2(
		const std::vector<Line>& lines, unsigned int num, float radius,
		const VEC3& optVelocity, bool directionOpt,
		VEC3& result
	);

	void linearProgram3(
		const std::vector<Line>& lines, unsigned int numObstLines,
		float radius, VEC3& result
	);
	
Pierre Kraemer's avatar
Pierre Kraemer committed
46
47
	std::vector<std::pair<float, Agent*> > agentNeighbors_;
	std::vector<std::pair<float, Dart> > obstacleNeighbors_;
Pierre Kraemer's avatar
Pierre Kraemer committed
48
49
50
51
52
53
	
	CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_;
	
	std::vector<VEC3> goals_;
	unsigned int curGoal_;
	
54
55
56
57
58
59
60
	static size_t maxNeighbors_;
	static float maxSpeed_;
	static float neighborDistSq_;
	static float radius_;
	static float timeHorizon_;
	static float timeHorizonObst_;
	static float rangeSq_;
Pierre Kraemer's avatar
Pierre Kraemer committed
61
62
63
64
65
	
	VEC3 velocity_;
	VEC3 newVelocity_;
	VEC3 prefVelocity_;
	
66
67
68
	VEC3 meanSpeed_;
	VEC3 meanPos_;

Pierre Kraemer's avatar
Pierre Kraemer committed
69
70
71
72
	Simulator* sim_;
};

#endif