Commit 23ffe43f authored by Arash HABIBI's avatar Arash HABIBI

scenario3 grand rayon

parent 6ea115fb
......@@ -12,6 +12,8 @@
//#define EXPORTING_AGENT
#define EXPORTING_OBJ
#define SMOOTHING_BUFFER_SIZE 200
#ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
......@@ -156,7 +158,7 @@ public:
VEC3 velocity_ ;
VEC3 newVelocity_ ;
VEC3 prefVelocity_ ;
VEC3 meanVelocity_[50] ;
VEC3 meanVelocity_[SMOOTHING_BUFFER_SIZE] ;
VEC3 meanDirection_ ;
Simulator* sim_;
......
......@@ -123,7 +123,7 @@ void Agent::init(const VEC3& start, const VEC3& goal)
// color1=0;
// color2 = 1.0f;
// }
for (unsigned int i=0 ; i<4 ; ++i)
for (unsigned int i=0 ; i<SMOOTHING_BUFFER_SIZE ; ++i)
meanVelocity_[i].set(0) ;
agentNeighbors_.reserve(maxNeighbors_ * 2) ;
......@@ -505,11 +505,11 @@ void Agent::update()
#endif
meanDirection_.set(0) ;
for (unsigned int i=0 ; i<50 ; ++i) {
for (unsigned int i=0 ; i<SMOOTHING_BUFFER_SIZE ; ++i) {
meanDirection_ += meanVelocity_[i] ;
meanVelocity_[i] = meanVelocity_[(i+1)%50] ;
meanVelocity_[i] = meanVelocity_[(i+1)%SMOOTHING_BUFFER_SIZE] ;
}
meanVelocity_[49] = velocity_ ;
meanVelocity_[SMOOTHING_BUFFER_SIZE-1] = velocity_ ;
meanDirection_.normalize() ;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment