High densities because of too close dummy pedes

- remove measurement area calculations from method I
- density-velocity calculations are removed for method I
parent f15df4f1
......@@ -55,7 +55,6 @@ Method_I::Method_I()
_circleEdges = -1;
_fIndividualFD = nullptr;
_calcIndividualFD = false;
_fVoronoiRhoV = nullptr;
_areaForMethod_I = nullptr;
_plotVoronoiCellData=false;
_isOneDimensional=false;
......@@ -110,10 +109,6 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
}
}
if(!OpenFileMethodI())
{
return_value = false;
}
if(_calcIndividualFD)
{
if (!OpenFileIndividualFD())
......@@ -183,16 +178,17 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
// std::cout << ">> polygons_id " << polygons_id.size() << "\n";
vector<polygon_2d> polygons;
for (auto p: polygons_id)
{
polygons.push_back(p.first);
}
if(!polygons.empty())
{
OutputVoronoiResults(polygons, str_frid, VInFrame); // TODO polygons_id
if(_calcIndividualFD)
{
if(!_isOneDimensional)
{
GetIndividualFD(polygons,VInFrame, IdInFrame, _areaForMethod_I->_poly, str_frid); // TODO polygons_id
GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid); // TODO polygons_id
}
}
if(_getProfile)
......@@ -214,7 +210,6 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
}
}
}//peds
fclose(_fVoronoiRhoV);
if(_calcIndividualFD)
{
fclose(_fIndividualFD);
......@@ -288,9 +283,10 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
{
polygons_id = vd.cutPolygonsWithCircle(polygons_id, XInFrame, YInFrame, _cutRadius,_circleEdges);
}
// std:: cout << " GetPolygons cirlces " << polygons_id.size() << "\n";
//todo HH
polygons_id = vd.cutPolygonsWithGeometry(polygons_id, _geoPoly, XInFrame, YInFrame);
// std:: cout << " GetPolygons geometry " << polygons_id.size() << "\n";
// todo HH
// std:: cout << dsv(_geoPoly) << "\n";
for(auto && p:polygons_id)
{
poly = p.first;
......@@ -527,7 +523,7 @@ 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 polygon_2d& measureArea, const string& frid)
void Method_I::GetIndividualFD(const vector<polygon_2d>& polygon, const vector<double>& Velocity, const vector<int>& Id, const string& frid)
{
double uniquedensity=0;
double uniquevelocity=0;
......@@ -535,29 +531,17 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c
int temp=0;
for (const auto & polygon_iterator:polygon)
{
polygon_list v;
intersection(measureArea, polygon_iterator, v);
if(!v.empty()) {
string polygon_str = polygon_to_string(polygon_iterator);
// string measureArea_str =
// polygon_to_string(measureArea); // maybe used for debugging
string v_str = polygon_to_string(v[0]);
uniquedensity=1.0/(area(polygon_iterator)*CMtoM*CMtoM);
uniquevelocity=Velocity[temp];
uniqueId=Id[temp];
fprintf(_fIndividualFD,"%s\t%d\t%.3f\t%.3f\t%s\t%s\n",
frid.c_str(),
uniqueId,
uniquedensity,
uniquevelocity,
polygon_str.c_str(),
v_str.c_str());
}
else{
std::cout << "empty interectio with the measurement aren\n";
}
string polygon_str = polygon_to_string(polygon_iterator);
uniquedensity=1.0/(area(polygon_iterator)*CMtoM*CMtoM);
uniquevelocity=Velocity[temp];
uniqueId=Id[temp];
fprintf(_fIndividualFD,"%s\t%d\t%.3f\t%.3f\t%s\n",
frid.c_str(),
uniqueId,
uniquedensity,
uniquevelocity,
polygon_str.c_str()
);
temp++;
}
}
......
......@@ -103,7 +103,7 @@ private:
std::tuple<double,double> GetVoronoiDensityVelocity(const std::vector<polygon_2d>& polygon, const std::vector<double>& Velocity, const polygon_2d & measureArea);
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 polygon_2d& measureArea, 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);
/**
* Reduce the precision of the points to two digits
* @param polygon
......
......@@ -49,6 +49,7 @@ VoronoiDiagram::~VoronoiDiagram()
std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vector<double>& XInFrame, vector<double>& YInFrame,
vector<double>& VInFrame, vector<int>& IdInFrame, const double Bound_Max)
{
double M2CM = 10000;
int numPedsInFrame = IdInFrame.size();
vector<int> XInFrame_temp;
vector<int> YInFrame_temp;
......@@ -62,26 +63,26 @@ std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vect
{
numPedsInFrame += 4;
// up right
XInFrame.push_back(XInFrame[0]+10);
YInFrame.push_back(YInFrame[0]+10);
XInFrame.push_back(XInFrame[0]+10*M2CM);
YInFrame.push_back(YInFrame[0]+10*M2CM);
VInFrame.push_back(VInFrame[0]);
//IdInFrame.push_back(IdInFrame[0]+1);
IdInFrame.push_back(-1);
// up left
XInFrame.push_back(XInFrame[0]-10);
YInFrame.push_back(YInFrame[0]+10);
XInFrame.push_back(XInFrame[0]-10*M2CM);
YInFrame.push_back(YInFrame[0]+10*M2CM);
VInFrame.push_back(VInFrame[0]);
//IdInFrame.push_back(IdInFrame[0]+2);
IdInFrame.push_back(-2);
// down right
XInFrame.push_back(XInFrame[0]+10);
YInFrame.push_back(YInFrame[0]-10);
XInFrame.push_back(XInFrame[0]+10*M2CM);
YInFrame.push_back(YInFrame[0]-10*M2CM);
VInFrame.push_back(VInFrame[0]);
//IdInFrame.push_back(IdInFrame[0]+3);
IdInFrame.push_back(-3);
// down left
XInFrame.push_back(XInFrame[0]-10);
YInFrame.push_back(YInFrame[0]-10);
XInFrame.push_back(XInFrame[0]-10*M2CM);
YInFrame.push_back(YInFrame[0]-10*M2CM);
VInFrame.push_back(VInFrame[0]);
// IdInFrame.push_back(IdInFrame[0]+4);
IdInFrame.push_back(-4);
......@@ -94,9 +95,12 @@ std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vect
YInFrame_temp.push_back(round(YInFrame[i]));
VInFrame_temp.push_back(VInFrame[i]);
IdInFrame_temp.push_back(IdInFrame[i]);
// std::cout << "i: " << i << " Id " << IdInFrame[i] << " pos = " << XInFrame[i] << ", " << YInFrame[i] << "\n";
}
VD voronoidiagram;
construct_voronoi(points.begin(), points.end(), &voronoidiagram);
int Ncell = 0;
......@@ -133,8 +137,6 @@ std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vect
break;
}
}
if(IdInFrame[Ncell] < 0 )
continue;
XInFrame[Ncell] = thispoint.x();
YInFrame[Ncell] = thispoint.y();
......@@ -229,11 +231,10 @@ std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vect
//cout << "poly is: " << typeid(poly).name() << '\n'
int id_ped = IdInFrame[Ncell];
std::pair<polygon_2d, int> poly_id = std::make_pair(poly, id_ped);
// if (id_ped < 0 )
// {
// std::cout << "HH id: " << id_ped << "\n";
// continue;
// }
if (id_ped < 0 )
{
continue;
}
polygons_id.push_back(poly_id);
Ncell++;
}// for voronoi cells
......
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