Commit dd960dad authored by Arne Graf's avatar Arne Graf

FF adapted for use in other model (1/2)

parent 35e841a2
......@@ -45,7 +45,7 @@ xsi:noNamespaceSchemaLocation="http://134.94.2.137/jps_ini_core.xsd">
</routing>
<!--persons information and distribution -->
<agents operational_model_id="3">
<agents operational_model_id="4">
<agents_distribution>
<group group_id="2" agent_parameter_id="0" room_id="1" subroom_id="0" number="10" goal_id="0" router_id="1" x_min="51" x_max="54" y_max="102" y_min="101"/>
<!-- <group group_id="0" room_id="0" subroom_id="2" number="4" goal_id="0" router_id="1" route_id="" /> -->
......
......@@ -2,7 +2,7 @@
* \file GradientModel.cpp
* \date Apr 15, 2014
* \version v0.7
* \copyright <2009-2015> Forschungszentrum Jlich GmbH. All rights reserved.
* \copyright <2009-2015> Forschungszentrum Jülich GmbH. All rights reserved.
*
* \section License
* This file is part of JuPedSim.
......@@ -225,7 +225,8 @@ void GradientModel::ComputeNextTimeStep(double current, double deltaT, Building*
++(*under);
}
Point movDirection = (result_acc[p-start].Norm() > 1) ? result_acc[p - start].Normalized() : result_acc[p-start];
Point toTarget = (_direction->GetTarget(nullptr, ped)).Normalized();
Point toTarget = (_direction->GetTarget(nullptr, ped));
toTarget = toTarget - ped->GetPos();
if (toTarget.NormSquare() == 0.) { // @todo:ar.graf: this if overcomes shortcomming of floorfield (neggrad[targetpoints] == Point(0., 0.))
toTarget += ped->GetV().Normalized();
}
......
......@@ -105,7 +105,7 @@ Point DirectionInRangeBottleneck::GetTarget(Room* room, Pedestrian* ped) const
// else if(lenSq >= 100)
// d = 3;
Point diff = (p1 - p2).Normalized() * d;
Line e_neu = Line(p1 - diff, p2 + diff);
......@@ -210,7 +210,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
if(iObs >= 0){ // obstacle is nearest
const vector<Wall>& owalls = obstacles[iObs]->GetAllWalls();
angle = tmpDirection.GetObstacleDeviationAngle(owalls, walls);
// angle = tmpDirection.GetDeviationAngle(owalls[inear].enlarge(2*ped->GetLargerAxis()));
#if DEBUG
......@@ -256,7 +256,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
printf("angle=%f, G=[%.2f, %.2f]\n", angle, G.GetX(), G.GetY());
printf("\n----------\nLEAVE function with PED=%d\n----------\n",ped->GetID());
// getc(stdin);
#endif
......@@ -268,7 +268,7 @@ Point DirectionGeneral::GetTarget(Room* room, Pedestrian* ped) const
// if( ped->GetID() == 1)
// fprintf(stderr, "%.2f %.2f %.2f %.2f %f %f %d %.2f %.2f %.2f\n", NextPointOnLine.GetX(), NextPointOnLine.GetY(),
// fprintf(stderr, "%.2f %.2f %.2f %.2f %f %f %d %.2f %.2f %.2f\n", NextPointOnLine.GetX(), NextPointOnLine.GetY(),
// ped->GetPos().GetX(), ped->GetPos().GetY(), G.GetX(), G.GetY(), ped->GetID(), ped->GetV0().GetX(), ped->GetV0().GetY(), ped->GetGlobalTime());
// this stderr output can be used with scripts/plot_desired_velocity.py
......@@ -284,7 +284,8 @@ Point DirectionFloorfield::GetTarget(Room* room, Pedestrian* ped) const
Point p;
ffviafm->getDirectionAt(ped->GetPos(), p);
return p;
p = p.Normalized();
return (p + ped->GetPos());
#if DEBUG
}
......
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