Commit 86512eb7 authored by pitiot's avatar pitiot

linear ok

parent e6def94a
......@@ -6,7 +6,7 @@
#include "utils.h"
#include "env_map.h"
#include <set>
#define LINEAR
// #define LINEAR
// #define SECURED
#ifdef LINEAR
#include "ShapeMatching/shapeMatchingLinear.h"
......
......@@ -163,7 +163,7 @@ MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, s
index_parent(indParent),
gravity_dist(0),
beta(0.95),
alpha(0.2)
alpha(0.99)
{
assert(pos.size() > 2);
......@@ -1096,12 +1096,12 @@ void MovingObstacle::updateForces()
//-------------------------------------------------------------------------
// ARASH : A présent on calcule les interactions avec les autres obstacles.
VEC3 norm;
double obst_stiffness = 2.0; // agent-obstacle interaction stiffness
double obst_stiffness = 0.5; // agent-obstacle interaction stiffness
int obst_power = 2 ; // the power to which elevate the agent-obstacle distance
double obst_radius_infl, obst_radius_infl_buildings;
obst_radius_infl = 20.; // scenario 1 et 3
obst_radius_infl = 30.; // scenario 1 et 3
obst_radius_infl_buildings= 50.0f;
float fixed_obst_factor = 5.0f;
......@@ -1110,6 +1110,7 @@ void MovingObstacle::updateForces()
{
PFP::VEC3 normFace = CGoGN::Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, parts_[i]->d, sim_->envMap_.position);
Dart dd = map.phi_1(d);
VEC3 p = position[dd]+(velocity[dd] * sim_->timeStep_);
// Evitement d'obstacles mobiles
......@@ -1241,26 +1242,35 @@ void MovingObstacle::applyForces()
if(!rigid_)
{
Dart d = groundFace;
shape_->animate();
for (unsigned int i = 0; i < nbVertices; ++i)
{
velocity[d] += forces[d] * sim_->timeStep_ +(alpha/sim_->timeStep_)*(shape_->goal[d]-position[d]);
velocity[map.phi_1(map.phi2(d))] += forces[d] * sim_->timeStep_ +(alpha/sim_->timeStep_)*(shape_->goal[map.phi_1(map.phi2(d))]-position[map.phi_1(map.phi2(d))]);;
velocity[d] += (forces[d]-0.01*velocity[d]) * sim_->timeStep_ ;
position[d] += (velocity[d] * sim_->timeStep_);
position [map.phi_1(map.phi2(d))]+=(velocity[map.phi_1(map.phi2(d))] * sim_->timeStep_);
position [map.phi_1(map.phi2(d))]+=(0.5*velocity[d] * sim_->timeStep_);
// PFP::VEC3 normal = CGoGN::Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, parts_[i]->d, sim_->envMap_.position);
// normal *= height;
// position[map.phi_1(map.phi2(d))] = position[d]+normal;
d=map.phi_1(d);;
}
d = groundFace;
// velocity[centerDart] +=forces[centerDart] * sim_->timeStep_;
// position[centerDart] += (velocity[centerDart] * sim_->timeStep_);
shape_->animate();
for (unsigned int i = 0; i < nbVertices; ++i)
{
position[d] += alpha*(shape_->goal[d]-position[d]);
position [map.phi_1(map.phi2(d))]+=alpha*(shape_->goal[map.phi_1(map.phi2(d))]-position[map.phi_1(map.phi2(d))]);
// PFP::VEC3 normal = CGoGN::Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, parts_[i]->d, sim_->envMap_.position);
// normal *= height;
// position[map.phi_1(map.phi2(d))] = position[d]+normal;
d=map.phi_1(d);;
}
......
......@@ -17,7 +17,7 @@ timespec timespec_delta(const timespec& t1, const timespec& t2) {
Simulator::Simulator(unsigned int config, unsigned int minS, unsigned int nbAgent, unsigned int nbObst, bool resolution) :
#ifdef TWO_AND_HALF_DIM
timeStep_(0.05f),
timeStep_(0.5f),
#else
// timeStep_(config > 2 ? 0.01f : 0.25f),
timeStep_(0.01f),
......
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