Commit 53da2577 authored by Mohcine Chraibi's avatar Mohcine Chraibi

Merge branch '103-method-i_velocity' into '107_Method_I_zPos'

Resolve "Method I | velocity"

See merge request !18
parents 797b6b9a 449c38f7
Pipeline #20641 passed with stages
in 33 seconds
......@@ -119,6 +119,11 @@ std::string Analysis::GetFilename (const std::string& str)
void Analysis::InitArgs(ArgumentParser* args)
{
string s = "Parameter:\n";
_building = new Building();
_building->LoadGeometry(args->GetGeometryFilename());
// create the polygons
_building->InitGeometry();
// _building->AddSurroundingRoom();
if(args->GetIsMethodA()) {
_DoesUseMethodA = true;
......@@ -177,6 +182,11 @@ void Analysis::InitArgs(ArgumentParser* args)
_geoPoly = 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
}
_deltaF = args->GetDelatT_Vins();
_cutByCircle = args->GetIsCutByCircle();
_getProfile = args->GetIsGetProfile();
......@@ -200,12 +210,7 @@ void Analysis::InitArgs(ArgumentParser* args)
std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, const std::vector<MeasurementArea_B*>& areas)
{
_building = new Building();
_building->LoadGeometry(geometryFile.string());
// create the polygons
_building->InitGeometry();
// _building->AddSurroundingRoom();
Log->Write("INFO:\tReadGeometry with %s", geometryFile.string().c_str());
double geo_minX = FLT_MAX;
double geo_minY = FLT_MAX;
double geo_maxX = -FLT_MAX;
......
......@@ -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, double ZInFrame);
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, std::vector<double>& ZInFrame);
/**
* Reduce the precision of the points to two digits
* @param polygon
......
......@@ -587,6 +587,27 @@ vector<double> PedData::GetZInFrame(int frame, const vector<int>& ids) const
}
return ZInFrame;
}
vector<double> PedData::GetZInFrame(int frame, const vector<int>& ids, double zPos) const
{
vector<double> ZInFrame;
for(unsigned int i=0; i<ids.size();i++)
{
int id = ids[i];
if(zPos<1000000.0)
{
if(fabs(_zCor(id,frame)-zPos*M2CM)<J_EPS_EVENT)
{
ZInFrame.push_back(_zCor(id,frame));
}
}
else
{
ZInFrame.push_back(_zCor(id,frame));
}
}
return ZInFrame;
}
vector<int> PedData::GetIdInFrame(int frame, const vector<int>& ids) const
{
......
......@@ -77,6 +77,7 @@ public:
std::vector<double> GetXInFrame(int frame, const std::vector<int>& ids) const;
std::vector<double> GetYInFrame(int frame, const std::vector<int>& ids) const;
std::vector<double> GetZInFrame(int frame, const std::vector<int>& ids) const;
std::vector<double> GetZInFrame(int frame, const std::vector<int>& ids, double zPos) const;
std::vector<double> GetVInFrame(int frame, const std::vector<int>& ids, double zPos) const;
bool ReadData(const fs::path& projectRootDir,const fs::path& outputDir, const fs::path& path, const fs::path& filename, const FileFormat& _trajformat, int deltaF, std::string vComponent, const bool IgnoreBackwardMovement);
fs::path GetOutputLocation() const;
......
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