Skip to content
Snippets Groups Projects
Commit 641c1bd8 authored by Mohcine Chraibi's avatar Mohcine Chraibi
Browse files

use python3 to fix #85

- Add a routine to convert a polygon to string.
  Could be useful.
parent 77f10002
No related branches found
No related tags found
No related merge requests found
......@@ -357,7 +357,7 @@ int Analysis::RunAnalysis(const string& filename, const string& path)
Log->Write("INFO:\tSuccess with Method C using measurement area id %d!\n",_areaForMethod_C[i]->_id);
if(_plotTimeseriesC[i])
{
string parameters_Timeseries="python \""+_scriptsLocation+"/_Plot_timeseries_rho_v.py\" -p \""+ _projectRootDir+VORO_LOCATION + "\" -n "+filename+
string parameters_Timeseries="python3 \""+_scriptsLocation+"/_Plot_timeseries_rho_v.py\" -p \""+ _projectRootDir+VORO_LOCATION + "\" -n "+filename+
" -f "+boost::lexical_cast<std::string>(data.GetFps());
int res=system(parameters_Timeseries.c_str());
Log->Write("INFO:\t time series result: %d ",res);
......@@ -401,7 +401,7 @@ int Analysis::RunAnalysis(const string& filename, const string& path)
std::cout << "INFO:\tSuccess with Method D using measurement area id "<< _areaForMethod_D[i]->_id << "\n";
if(_plotTimeseriesD[i])
{
string parameters_Timeseries="python \""+_scriptsLocation+"/_Plot_timeseries_rho_v.py\" -p \""+ _projectRootDir+VORO_LOCATION + "\" -n "+filename+
string parameters_Timeseries="python3 \""+_scriptsLocation+"/_Plot_timeseries_rho_v.py\" -p \""+ _projectRootDir+VORO_LOCATION + "\" -n "+filename+
" -f "+boost::lexical_cast<std::string>(data.GetFps());
int res=system(parameters_Timeseries.c_str());
Log->Write("INFO:\t time series result: %d ",res);
......
......@@ -37,8 +37,23 @@
//using std::ofstream;
using namespace std;
std::string polygon_to_string(const polygon_2d & polygon)
{
string polygon_str = "(";
for(auto point: boost::geometry::exterior_ring(polygon) )
{
double x = boost::geometry::get<0>(point);
double y = boost::geometry::get<1>(point);
polygon_str.append("(");
polygon_str.append(std::to_string(x));
polygon_str.append(", ");
polygon_str.append(std::to_string(y));
polygon_str.append("), ");
}
polygon_str.pop_back(); polygon_str.pop_back(); //remove last komma
polygon_str.append(")");
return polygon_str;
}
Method_D::Method_D()
{
_grid_size_X = 0.10;
......@@ -460,9 +475,9 @@ void Method_D::OutputVoroGraph(const string & frameId, std::vector<std::pair<po
if(_plotVoronoiCellData)
{
string parameters_rho="python "+_scriptsLocation+"/_Plot_cell_rho.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
string parameters_rho="python3 "+_scriptsLocation+"/_Plot_cell_rho.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
" -g "+_geometryFileName+" -p "+_trajectoryPath;
string parameters_v="python "+_scriptsLocation+"/_Plot_cell_v.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
string parameters_v="python3 "+_scriptsLocation+"/_Plot_cell_v.py -f \""+ voronoiLocation + "\" -n "+ _trajName+"_id_"+_measureAreaId+"_"+frameId+
" -g "+_geometryFileName+" -p "+_trajectoryPath;
if(_plotVoronoiIndex)
......@@ -490,10 +505,16 @@ void Method_D::GetIndividualFD(const vector<polygon_2d>& polygon, const vector<d
polygon_list v;
intersection(measureArea, polygon_iterator, v);
if(!v.empty()) {
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\n",frid.c_str(), uniqueId, uniquedensity,uniquevelocity);
std::cout << "STR: " << polygon_str << "\n";
std::cout << "\n"<< dsv(polygon_iterator) << "\n ---- "<< std::endl;
// std::cout << dsv(measureArea) << "\n ---- " << std::endl;
// std::cout << dsv(v[0]) << "\n ---- " << std::endl;
getc(stdin);
}
temp++;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment