Commit 317da5d4 authored by Gregor Jaeger's avatar Gregor Jaeger

issue 103, initial commit

parent 0fa81773
Pipeline #17963 passed with stages
in 32 seconds
......@@ -188,7 +188,8 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
{
if(!_isOneDimensional)
{
GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid); // TODO polygons_id
// GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid); // TODO polygons_id
GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid, XInFrame, YInFrame); //
}
}
if(_getProfile)
......@@ -261,11 +262,11 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
{
if(_isOneDimensional)
{
fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame \t PedId \t Individual density(m^(-1)) \t Individual velocity(m/s) \t Headway(m)\n",_fps);
fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame \t PersID \t Individual density(m^(-1)) \t Individual velocity(m/s) \t Headway(m)\n",_fps);
}
else
{
fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame \t PedId \t Individual density(m^(-2)) \t Individual velocity(m/s) \t Voronoi Polygon\n",_fps);
fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame \t PersID \t x/m \t y/m \t Individual density(m^(-2)) \t Individual velocity(m/s) \t Voronoi Polygon\n",_fps);
}
return true;
}
......@@ -546,6 +547,34 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
}
}
void Method_I::GetIndividualFD(const vector<polygon_2d>& polygon, const vector<double>& Velocity, const vector<int>& Id, const string& frid, vector<double>& XInFrame, vector<double>& YInFrame)
{
double uniquedensity=0;
double uniquevelocity=0;
double x, y;
int uniqueId=0;
int temp=0;
for (const auto & polygon_iterator:polygon)
{
string polygon_str = polygon_to_string(polygon_iterator);
uniquedensity=1.0/(area(polygon_iterator)*CMtoM*CMtoM);
uniquevelocity=Velocity[temp];
uniqueId=Id[temp];
x = XInFrame[temp]*CMtoM;
y = YInFrame[temp]*CMtoM;
fprintf(_fIndividualFD,"%s\t %d\t %.4f\t %.4f\t %.4f\t %.4f\t %s\n",
frid.c_str(),
uniqueId,
x,
y,
uniquedensity,
uniquevelocity,
polygon_str.c_str()
);
temp++;
}
}
void Method_I::SetCalculateIndividualFD(bool individualFD)
{
_calcIndividualFD = individualFD;
......
......@@ -104,6 +104,7 @@ private:
void GetProfiles(const std::string& frameId, const std::vector<polygon_2d>& polygons, const std::vector<double>& velocity);
void OutputVoroGraph(const std::string & frameId, std::vector<std::pair<polygon_2d, int> >& polygons, int numPedsInFrame,const std::vector<double>& VInFrame);
void GetIndividualFD(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const std::vector<int>& Id, const std::string& frid);
void GetIndividualFD(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const std::vector<int>& Id, const std::string& frid, std::vector<double>& XInFrame, std::vector<double>& YInFrame);
/**
* Reduce the precision of the points to two digits
* @param polygon
......
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