diff --git a/Analysis.cpp b/Analysis.cpp index 615970676f2831b827ada6535b7bed0cc573433a..2c7588b6b4a09a2e652b78654b93074d394fee55 100644 --- a/Analysis.cpp +++ b/Analysis.cpp @@ -166,7 +166,8 @@ void Analysis::InitArgs(ArgumentParser* args) _StopFramesMethodD = args->GetStopFramesMethodD(); _IndividualFDFlags = args->GetIndividualFDFlags(); _plotTimeseriesD=args->GetIsPlotTimeSeriesD(); - _geoPoly = ReadGeometry(args->GetGeometryFilename(), _areaForMethod_D); + _geoPolyMethodD = ReadGeometry(args->GetGeometryFilename(), _areaForMethod_D); + } if(args->GetIsMethodI()) { _DoesUseMethodI = true; @@ -179,14 +180,19 @@ void Analysis::InitArgs(ArgumentParser* args) _StopFramesMethodI = args->GetStopFramesMethodI(); _IndividualFDFlags = args->GetIndividualFDFlags(); _plotTimeseriesI=args->GetIsPlotTimeSeriesI(); - _geoPoly = ReadGeometry(args->GetGeometryFilename(), _areaForMethod_I); + _geoPolyMethodI = ReadGeometry(args->GetGeometryFilename(), _areaForMethod_I); } - if( _DoesUseMethodD && _DoesUseMethodI) - { - Log->Write("Warning:\t Using both method D and I is not safe!"); - // because ReadGeomtry() may be called twice - } +// ToDo: obsolete ? + +// if( _DoesUseMethodD && _DoesUseMethodI) +// { +// Log->Write("Warning:\t Using both method D and I is not safe!"); +// // because ReadGeometry() may be called twice (line 169 and 182) +// // overwrite _geoPoly -> new value for each Method +// Log->Write("Info:\t Using both method D and I is safe! :-)"); +// } + _deltaF = args->GetDelatT_Vins(); _cutByCircle = args->GetIsCutByCircle(); _getProfile = args->GetIsGetProfile(); @@ -336,6 +342,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path) if(result_A) { Log->Write("INFO:\tSuccess with Method A using measurement area id %d!\n",_areaForMethod_A[i]->_id); + std::cout << "INFO:\tSuccess with Method A using measurement area id "<< _areaForMethod_A[i]->_id << "\n"; } else { @@ -361,6 +368,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path) if(result_B) { Log->Write("INFO:\tSuccess with Method B using measurement area id %d!\n",_areaForMethod_B[i]->_id); + std::cout << "INFO:\tSuccess with Method B using measurement area id "<< _areaForMethod_B[i]->_id << "\n"; } else { @@ -385,6 +393,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path) if(result_C) { Log->Write("INFO:\tSuccess with Method C using measurement area id %d!\n",_areaForMethod_C[i]->_id); + std::cout << "INFO:\tSuccess with Method C using measurement area id "<< _areaForMethod_C[i]->_id << "\n"; if(_plotTimeseriesC[i]) { string parameters_Timeseries=" " + _scriptsLocation.string()+ @@ -417,7 +426,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path) method_D.SetStartFrame(_StartFramesMethodD[i]); method_D.SetStopFrame(_StopFramesMethodD[i]); method_D.SetCalculateIndividualFD(_IndividualFDFlags[i]); - method_D.SetGeometryPolygon(_geoPoly[_areaForMethod_D[i]->_id]); + method_D.SetGeometryPolygon(_geoPolyMethodD[_areaForMethod_D[i]->_id]); method_D.SetGeometryFileName(_geometryFileName); method_D.SetGeometryBoundaries(_lowVertexX, _lowVertexY, _highVertexX, _highVertexY); method_D.SetGridSize(_grid_size_X, _grid_size_Y); @@ -470,7 +479,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path) method_I.SetStartFrame(_StartFramesMethodI[i]); method_I.SetStopFrame(_StopFramesMethodI[i]); method_I.SetCalculateIndividualFD(_IndividualFDFlags[i]); - method_I.SetGeometryPolygon(_geoPoly[_areaForMethod_I[i]->_id]); + method_I.SetGeometryPolygon(_geoPolyMethodI[_areaForMethod_I[i]->_id]); method_I.SetGeometryFileName(_geometryFileName); method_I.SetGeometryBoundaries(_lowVertexX, _lowVertexY, _highVertexX, _highVertexY); method_I.SetGridSize(_grid_size_X, _grid_size_Y); diff --git a/Analysis.h b/Analysis.h index 6f89efd5e8ebe68d4da8f7ca3e0bbbb44101b924..627b3cb288d78ed5a68e0e15fa26ca611b2266d6 100644 --- a/Analysis.h +++ b/Analysis.h @@ -111,7 +111,8 @@ private: Building* _building; //polygon_2d _geoPoly; - std::map _geoPoly; + std::map _geoPolyMethodD; + std::map _geoPolyMethodI; double _grid_size_X; // the size of the grid double _grid_size_Y; diff --git a/methods/Method_D.cpp b/methods/Method_D.cpp index 6fd827bd8c486d697ed4bde5cc9779b0f79fe364..1032a80646ef23705c424fff90f74ac6844589d3 100644 --- a/methods/Method_D.cpp +++ b/methods/Method_D.cpp @@ -140,6 +140,7 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation, vector IdInFrame = peddata.GetIdInFrame(frameNr, ids, zPos_measureArea); vector XInFrame = peddata.GetXInFrame(frameNr, ids, zPos_measureArea); vector YInFrame = peddata.GetYInFrame(frameNr, ids, zPos_measureArea); + vector ZInFrame = peddata.GetZInFrame(frameNr, ids, zPos_measureArea); vector VInFrame = peddata.GetVInFrame(frameNr, ids, zPos_measureArea); //vector int to_remove //------------------------------Remove peds outside geometry------------------------------------------ @@ -151,6 +152,7 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation, IdInFrame.erase(IdInFrame.begin() + i); XInFrame.erase(XInFrame.begin() + i); YInFrame.erase(YInFrame.begin() + i); + ZInFrame.erase(ZInFrame.begin() + i); VInFrame.erase(VInFrame.begin() + i); i--; } @@ -189,7 +191,8 @@ bool Method_D::Process (const PedData& peddata,const fs::path& scriptsLocation, { if(!_isOneDimensional) { - GetIndividualFD(polygons,VInFrame, IdInFrame, _areaForMethod_D->_poly, str_frid); // TODO polygons_id + // GetIndividualFD(polygons,VInFrame, IdInFrame, _areaForMethod_D->_poly, str_frid); // TODO polygons_id + GetIndividualFD(polygons,VInFrame, IdInFrame, _areaForMethod_D->_poly, str_frid, XInFrame, YInFrame, ZInFrame); } } if(_getProfile) @@ -257,7 +260,7 @@ bool Method_D::OpenFileIndividualFD() { fs::path trajFileName("_id_"+_measureAreaId+".dat"); fs::path indFDPath("Fundamental_Diagram"); - indFDPath = _outputLocation / indFDPath / "IndividualFD" / (_trajName.string() + trajFileName.string()); + indFDPath = _outputLocation / indFDPath / "IndividualFD" / ("IFD_D_" +_trajName.string() + trajFileName.string()); string Individualfundment=indFDPath.string(); if((_fIndividualFD=Analysis::CreateFile(Individualfundment))==nullptr) { @@ -268,11 +271,11 @@ bool Method_D::OpenFileIndividualFD() { 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\tPersID\tIndividual density(m^(-1))\tIndividual velocity(m/s)\tHeadway(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 \t Intersection Polygon\n",_fps); + fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame\tPersID\tx/m\ty/m\tz/m\tIndividual density(m^(-2))\tIndividual velocity(m/s)\tVoronoi Polygon\tIntersection Polygon\n",_fps); } return true; } @@ -561,10 +564,11 @@ void Method_D::OutputVoroGraph(const string & frameId, std::vector& polygon, const vector& Velocity, const vector& Id, const polygon_2d& measureArea, const string& frid) +void Method_D::GetIndividualFD(const vector& polygon, const vector& Velocity, const vector& Id, const polygon_2d& measureArea, const string& frid, vector& XInFrame, vector& YInFrame, vector& ZInFrame) { double uniquedensity=0; double uniquevelocity=0; + double x, y, z; int uniqueId=0; int temp=0; for (const auto & polygon_iterator:polygon) @@ -581,9 +585,15 @@ void Method_D::GetIndividualFD(const vector& polygon, const vector GetVoronoiDensityVelocity(const std::vector& polygon, const std::vector& Velocity, const polygon_2d & measureArea); void GetProfiles(const std::string& frameId, const std::vector& polygons, const std::vector& velocity); void OutputVoroGraph(const std::string & frameId, std::vector >& polygons, int numPedsInFrame,const std::vector& VInFrame); - void GetIndividualFD(const std::vector& polygon, const std::vector& Velocity, const std::vector& Id, const polygon_2d& measureArea, const std::string& frid); + void GetIndividualFD(const std::vector& polygon, const std::vector& Velocity, const std::vector& Id, const polygon_2d& measureArea, const std::string& frid, std::vector& XInFrame, std::vector& YInFrame, std::vector& ZInFrame); /** * Reduce the precision of the points to two digits * @param polygon diff --git a/methods/Method_I.cpp b/methods/Method_I.cpp index 8f62463201c41435e7169a03f63caf08907a4057..70a351f82711714cf9bfdc296878b412183d87b8 100644 --- a/methods/Method_I.cpp +++ b/methods/Method_I.cpp @@ -199,10 +199,12 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid, XInFrame, YInFrame, ZInFrame); // } } + // ToDo: is obsolete // if(_getProfile) // { // field analysis // GetProfiles(str_frid, polygons, VInFrame); // TODO polygons_id // } + // ToDo: is obsolete // if(_outputVoronoiCellData) // { // output the Voronoi polygons of a frame // OutputVoroGraph(str_frid, polygons_id, NumPeds,VInFrame); @@ -225,13 +227,15 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c return return_value; } +// ToDo: this function OpenFileMethodI is obsolete - can be deleted + // bool Method_I::OpenFileMethodI() // { // // std::string voroLocation(VORO_LOCATION); // fs::path tmp("_id_"+_measureAreaId+".dat"); // tmp = _outputLocation / voroLocation / ("rho_v_Voronoi_" + _trajName.string() + tmp.string()); -//// _outputLocation.string() + voroLocation+"rho_v_Voronoi_"+_trajName+"_id_"+_measureAreaId+".dat"; +// // _outputLocation.string() + voroLocation+"rho_v_Voronoi_"+_trajName+"_id_"+_measureAreaId+".dat"; // string results_V= tmp.string(); // // @@ -254,11 +258,13 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c // } // } + + bool Method_I::OpenFileIndividualFD() { fs::path trajFileName("_id_"+_measureAreaId+".dat"); fs::path indFDPath("Fundamental_Diagram"); - indFDPath = _outputLocation / indFDPath / "IndividualFD" / (_trajName.string() + trajFileName.string()); + indFDPath = _outputLocation / indFDPath / "IndividualFD" / ("IFD_I_" +_trajName.string() + trajFileName.string()); string Individualfundment=indFDPath.string(); if((_fIndividualFD=Analysis::CreateFile(Individualfundment))==nullptr) { @@ -269,11 +275,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 PersID \t Individual density(m^(-1)) \t Individual velocity(m/s) \t Headway(m)\n",_fps); + fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame\tPersID\tIndividual density(m^(-1))\tIndividual velocity(m/s)\tHeadway(m)\n",_fps); } else { - fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame \t PersID \t x/m \t y/m \t z/m \t Individual density(m^(-2)) \t Individual velocity(m/s) \t Voronoi Polygon\n",_fps); + fprintf(_fIndividualFD,"#framerate (fps):\t%.2f\n\n#Frame\tPersID\tx/m\ty/m\tz/m\tIndividual density(m^(-2))\tIndividual velocity(m/s)\tVoronoi Polygon\n",_fps); } return true; } @@ -294,19 +300,22 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c //todo HH polygons_id = vd.cutPolygonsWithGeometry(polygons_id, _geoPoly, XInFrame, YInFrame); // todo HH - // std:: cout << dsv(_geoPoly) << "\n"; + // std:: cout << dsv(_geoPoly) << "\n"; // ToDo: obsolete ? for(auto && p:polygons_id) { poly = p.first; ReducePrecision(poly); // TODO update polygon_id? } - // std:: cout << " GetPolygons leave " << polygons_id.size() << "\n"; + // std:: cout << " GetPolygons leave " << polygons_id.size() << "\n"; // ToDo: obsolete ? return polygons_id; } /** * Output the Voronoi density and velocity in the corresponding file */ + +// ToDo: this function OutputVoronoiResults is obsolete - can be deleted + // void Method_I::OutputVoronoiResults(const vector& polygons, const string& frid, const vector& VInFrame) // { // double VoronoiVelocity=1; @@ -320,34 +329,39 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c * input: voronoi cell and velocity of each pedestrian and the measurement area * output: the voronoi density and velocity in the measurement area (tuple) */ - std::tuple Method_I::GetVoronoiDensityVelocity(const vector& polygon, const vector& Velocity, const polygon_2d & measureArea) - { - double meanV=0; - double density=0; - int temp=0; - for (auto && polygon_iterator:polygon) - { - polygon_list v; - intersection(measureArea, polygon_iterator, v); - if(!v.empty()) - { - meanV+=Velocity[temp]*area(v[0]); - density+=area(v[0])/area(polygon_iterator); - if((area(v[0]) - area(polygon_iterator))>J_EPS) - { - std::cout<<"----------------------Now calculating density-velocity!!!-----------------\n "; - std::cout<<"measure area: \t"< Method_I::GetVoronoiDensityVelocity(const vector& polygon, const vector& Velocity, const polygon_2d & measureArea) +// { +// double meanV=0; +// double density=0; +// int temp=0; +// for (auto && polygon_iterator:polygon) +// { +// polygon_list v; +// intersection(measureArea, polygon_iterator, v); +// if(!v.empty()) +// { +// meanV+=Velocity[temp]*area(v[0]); +// density+=area(v[0])/area(polygon_iterator); +// if((area(v[0]) - area(polygon_iterator))>J_EPS) +// { +// std::cout<<"----------------------Now calculating density-velocity!!!-----------------\n "; +// std::cout<<"measure area: \t"<& polygons, const vector& velocity) // { @@ -404,136 +418,135 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c // fclose(Prf_density); // } - // ToDo Wird nicht benötigt - /* - void Method_I::OutputVoroGraph(const string & frameId, std::vector >& polygons_id, int numPedsInFrame,const vector& VInFrame) - { - //string voronoiLocation=_projectRootDir+"./Output/Fundamental_Diagram/Classical_Voronoi/VoronoiCell/id_"+_measureAreaId; - - fs::path voroLocPath(_outputLocation); - fs::path voro_location_path (VORO_LOCATION); // TODO: convert - // this MACRO to - // path. Maybe - // remove the MACRO? - voroLocPath = voroLocPath / voro_location_path / "VoronoiCell"; - polygon_2d poly; - if(!fs::exists(voroLocPath)) - { - if(!fs::create_directories(voroLocPath)) - { - Log->Write("ERROR:\tcan not create directory <%s>", voroLocPath.string().c_str()); - std::cout << "can not create directory "<< voroLocPath.string().c_str() << "\n"; - exit(EXIT_FAILURE); - } - else - std::cout << "create directory "<< voroLocPath.string().c_str() << "\n"; - } +// ToDo: this function OutputVoroGraph is obsolete - can be deleted - fs::path polygonPath=voroLocPath / "polygon"; - if(!fs::exists(polygonPath)) - { - if(!fs::create_directory(polygonPath)) - { - Log->Write("ERROR:\tcan not create directory <%s>", polygonPath.string().c_str()); - exit(EXIT_FAILURE); - } - } - fs::path trajFileName(_trajName.string()+"_id_"+_measureAreaId+"_"+frameId+".dat"); - fs::path p = polygonPath / trajFileName; - string polygon = p.string(); - ofstream polys (polygon.c_str()); +// void Method_I::OutputVoroGraph(const string & frameId, std::vector >& polygons_id, int numPedsInFrame,const vector& VInFrame) +// { +// //string voronoiLocation=_projectRootDir+"./Output/Fundamental_Diagram/Classical_Voronoi/VoronoiCell/id_"+_measureAreaId; +// +// fs::path voroLocPath(_outputLocation); +// fs::path voro_location_path (VORO_LOCATION); // +// // this MACRO to +// // path. Maybe +// // remove the MACRO? +// voroLocPath = voroLocPath / voro_location_path / "VoronoiCell"; +// polygon_2d poly; +// if(!fs::exists(voroLocPath)) +// { +// if(!fs::create_directories(voroLocPath)) +// { +// Log->Write("ERROR:\tcan not create directory <%s>", voroLocPath.string().c_str()); +// std::cout << "can not create directory "<< voroLocPath.string().c_str() << "\n"; +// exit(EXIT_FAILURE); +// } +// else +// std::cout << "create directory "<< voroLocPath.string().c_str() << "\n"; +// } +// +// fs::path polygonPath=voroLocPath / "polygon"; +// if(!fs::exists(polygonPath)) +// { +// if(!fs::create_directory(polygonPath)) +// { +// Log->Write("ERROR:\tcan not create directory <%s>", polygonPath.string().c_str()); +// exit(EXIT_FAILURE); +// } +// } +// fs::path trajFileName(_trajName.string()+"_id_"+_measureAreaId+"_"+frameId+".dat"); +// fs::path p = polygonPath / trajFileName; +// string polygon = p.string(); +// ofstream polys (polygon.c_str()); +// +// if(polys.is_open()) +// { +// //for(vector polygon_iterator=polygons.begin(); polygon_iterator!=polygons.end(); polygon_iterator++) +// for(auto && polygon_id:polygons_id) +// { +// poly = polygon_id.first; +// for(auto&& point:poly.outer()) +// { +// point.x(point.x()*CMtoM); +// point.y(point.y()*CMtoM); +// } +// for(auto&& innerpoly:poly.inners()) +// { +// for(auto&& point:innerpoly) +// { +// point.x(point.x()*CMtoM); +// point.y(point.y()*CMtoM); +// } +// } +// polys << polygon_id.second << " | " << dsv(poly) << endl; +// //polys <Write("ERROR:\tcannot create the file <%s>",polygon.c_str()); +// exit(EXIT_FAILURE); +// } +// fs::path speedPath=voroLocPath / "speed"; +// if(!fs::exists(speedPath)) +// if(!fs::create_directory(speedPath)) +// { +// Log->Write("ERROR:\tcan not create directory <%s>", speedPath.string().c_str()); +// exit(EXIT_FAILURE); +// } +// fs::path pv = speedPath /trajFileName; +// string v_individual= pv.string(); +// ofstream velo (v_individual.c_str()); +// if(velo.is_open()) +// { +// for(int pts=0; ptsWrite("ERROR:\tcannot create the file <%s>",pv.string().c_str()); +// exit(EXIT_FAILURE); +// } +// +// *//*string point=voronoiLocation+"/points"+_trajName+"_id_"+_measureAreaId+"_"+frameId+".dat"; +// ofstream points (point.c_str()); +// if( points.is_open()) +// { +// for(int pts=0; ptsWrite("ERROR:\tcannot create the file <%s>",point.c_str()); +// exit(EXIT_FAILURE); +// } +// +// if(_plotVoronoiCellData) +// { +// string parameters_rho=" " + _scriptsLocation.string()+"/_Plot_cell_rho.py -f \""+ voroLocPath.string() + "\" -n "+ _trajName.string()+"_id_"+_measureAreaId+"_"+frameId+ +// " -g "+_geometryFileName.string()+" -p "+_trajectoryPath.string(); +// string parameters_v=" " + _scriptsLocation.string()+"/_Plot_cell_v.py -f \""+ voroLocPath.string() + "\" -n "+ _trajName.string() + "_id_"+_measureAreaId+"_"+frameId+ +// " -g "+_geometryFileName.string()+" -p "+_trajectoryPath.string(); +// +// if(_plotVoronoiIndex) +// parameters_rho += " -i"; +// +// Log->Write("INFO:\t%s",parameters_rho.c_str()); +// Log->Write("INFO:\tPlotting Voronoi Cell at the frame <%s>",frameId.c_str()); +// parameters_rho = PYTHON + parameters_rho; +// parameters_v = PYTHON + parameters_v; +// system(parameters_rho.c_str()); +// system(parameters_v.c_str()); +// } +// //points.close(); +// polys.close(); +// velo.close(); +// } - if(polys.is_open()) - { - //for(vector polygon_iterator=polygons.begin(); polygon_iterator!=polygons.end(); polygon_iterator++) - for(auto && polygon_id:polygons_id) - { - poly = polygon_id.first; - for(auto&& point:poly.outer()) - { - point.x(point.x()*CMtoM); - point.y(point.y()*CMtoM); - } - for(auto&& innerpoly:poly.inners()) - { - for(auto&& point:innerpoly) - { - point.x(point.x()*CMtoM); - point.y(point.y()*CMtoM); - } - } - polys << polygon_id.second << " | " << dsv(poly) << endl; - //polys <Write("ERROR:\tcannot create the file <%s>",polygon.c_str()); - exit(EXIT_FAILURE); - } - fs::path speedPath=voroLocPath / "speed"; - if(!fs::exists(speedPath)) - if(!fs::create_directory(speedPath)) - { - Log->Write("ERROR:\tcan not create directory <%s>", speedPath.string().c_str()); - exit(EXIT_FAILURE); - } - fs::path pv = speedPath /trajFileName; - string v_individual= pv.string(); - ofstream velo (v_individual.c_str()); - if(velo.is_open()) - { - for(int pts=0; ptsWrite("ERROR:\tcannot create the file <%s>",pv.string().c_str()); - exit(EXIT_FAILURE); - } - *//*string point=voronoiLocation+"/points"+_trajName+"_id_"+_measureAreaId+"_"+frameId+".dat"; - ofstream points (point.c_str()); - if( points.is_open()) - { - for(int pts=0; ptsWrite("ERROR:\tcannot create the file <%s>",point.c_str()); - exit(EXIT_FAILURE); - } - - // ToDo: _plotVoronoiCellData wird nicht benötigt - - if(_plotVoronoiCellData) - { - //@todo: use fs::path - string parameters_rho=" " + _scriptsLocation.string()+"/_Plot_cell_rho.py -f \""+ voroLocPath.string() + "\" -n "+ _trajName.string()+"_id_"+_measureAreaId+"_"+frameId+ - " -g "+_geometryFileName.string()+" -p "+_trajectoryPath.string(); - string parameters_v=" " + _scriptsLocation.string()+"/_Plot_cell_v.py -f \""+ voroLocPath.string() + "\" -n "+ _trajName.string() + "_id_"+_measureAreaId+"_"+frameId+ - " -g "+_geometryFileName.string()+" -p "+_trajectoryPath.string(); - - if(_plotVoronoiIndex) - parameters_rho += " -i"; - - Log->Write("INFO:\t%s",parameters_rho.c_str()); - Log->Write("INFO:\tPlotting Voronoi Cell at the frame <%s>",frameId.c_str()); - parameters_rho = PYTHON + parameters_rho; - parameters_v = PYTHON + parameters_v; - system(parameters_rho.c_str()); - system(parameters_v.c_str()); - } - //points.close(); - polys.close(); - velo.close(); - } - */ +// ToDo: this function GetIndividualFD is obsolete - can be deleted // void Method_I::GetIndividualFD(const vector& polygon, const vector& Velocity, const vector& Id, const string& frid) // { @@ -639,6 +652,9 @@ void Method_I::GetIndividualFD(const vector& polygon, const vector& polygon, const vector& polygon, const vector > GetPolygons(std::vector& XInFrame, std::vector& YInFrame, std::vector& VInFrame, std::vector& IdInFrame); + // ToDo: This functions are obsolete. void OutputVoronoiResults(const std::vector& polygons, const std::string& frid, const std::vector& VInFrame); std::tuple GetVoronoiDensityVelocity(const std::vector& polygon, const std::vector& Velocity, const polygon_2d & measureArea); void GetProfiles(const std::string& frameId, const std::vector& polygons, const std::vector& velocity); void OutputVoroGraph(const std::string & frameId, std::vector >& polygons, int numPedsInFrame,const std::vector& VInFrame); void GetIndividualFD(const std::vector& polygon, const std::vector& Velocity, const std::vector& Id, const std::string& frid); + void GetIndividualFD(const std::vector& polygon, const std::vector& Velocity, const std::vector& Id, const std::string& frid, std::vector& XInFrame, std::vector& YInFrame, std::vector& ZInFrame); /** * Reduce the precision of the points to two digits @@ -111,7 +113,10 @@ private: */ void CalcVoronoiResults1D(std::vector& XInFrame, std::vector& VInFrame, std::vector& IdInFrame, const polygon_2d & measureArea, const std::string& frid); void ReducePrecision(polygon_2d& polygon); + + // ToDo: This function is obsolete. bool IsPedInGeometry(int frames, int peds, double **Xcor, double **Ycor, int *firstFrame, int *lastFrame); //check whether all the pedestrians are in the geometry + double getOverlapRatio(const double& left, const double& right, const double& measurearea_left, const double& measurearea_right); bool IsPointsOnOneLine(std::vector& XInFrame, std::vector& YInFrame); };