diff --git a/methods/Method_I.cpp b/methods/Method_I.cpp index 4f498a1822fb9e7bc9f2520a111175841f38f075..49445baa0f4b804ccfc0117f1f02362e3fc6266c 100644 --- a/methods/Method_I.cpp +++ b/methods/Method_I.cpp @@ -189,7 +189,7 @@ 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, XInFrame, YInFrame); // + GetIndividualFD(polygons,VInFrame, IdInFrame, str_frid, XInFrame, YInFrame, zPos_measureArea); // } } if(_getProfile) @@ -266,7 +266,7 @@ bool Method_I::Process(const PedData& peddata,const fs::path& scriptsLocation, c } else { - 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); + 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); } return true; } @@ -547,11 +547,11 @@ 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) +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 ZInFrame) { double uniquedensity=0; double uniquevelocity=0; - double x, y; + double x, y, z; int uniqueId=0; int temp=0; for (const auto & polygon_iterator:polygon) @@ -562,11 +562,13 @@ void Method_I::GetIndividualFD(const vector<polygon_2d>& polygon, const vector<d 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", + z = ZInFrame*CMtoM; + fprintf(_fIndividualFD,"%s\t %d\t %.4f\t %.4f\t %.4f\t %.4f\t %.4f\t %s\n", frid.c_str(), uniqueId, x, y, + z, uniquedensity, uniquevelocity, polygon_str.c_str() diff --git a/methods/Method_I.h b/methods/Method_I.h index 380f65460c1468c83b22ef0a1a895e160490f50f..53100c07fdcbab4fc9b0c6b5b5756e1b81e63ab6 100644 --- a/methods/Method_I.h +++ b/methods/Method_I.h @@ -104,7 +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); + 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, double ZInFrame); /** * Reduce the precision of the points to two digits * @param polygon diff --git a/methods/PedData.cpp b/methods/PedData.cpp index 2e4123dfd742ceb0fdb4e0e522771424f44f45af..94a15c5f69651155ce62ecbede372c939a421351 100644 --- a/methods/PedData.cpp +++ b/methods/PedData.cpp @@ -430,7 +430,7 @@ bool PedData::InitializeVariables(TiXmlElement* xRootNode) for(TiXmlElement* xAgent = xFrame->FirstChildElement("agent"); xAgent; xAgent = xAgent->NextSiblingElement("agent")) { - //get agent id, x, y + //get agent id, x, y, z double x= atof(xAgent->Attribute("x")); double y= atof(xAgent->Attribute("y")); double z= atof(xAgent->Attribute("z"));