Commit 7deb6569 authored by Andrijana Brkic's avatar Andrijana Brkic

added function "IsInsideOfPolygon" to SubRoom

added function "ComputeBestPositionVoronoiBoost2" to AgentsSourcesManager
added function "VoronoiBestVertex1" to AgentsSourcesManager
parent 55ed3cec
......@@ -740,6 +740,38 @@ bool SubRoom::IsPartOfPolygon(const Point& ptw)
return true;
}
bool SubRoom::IsInsideOfPolygon(const Point& ptw)
{
//works only for squares for now
double x1=_poly[0].GetX() ,x2;
double y1=_poly[0].GetY(), y2;
if(_poly[1].GetX() != x1 ) x2=_poly[1].GetX();
else x2=_poly[2].GetX();
if(_poly[1].GetY() != y1 ) y2=_poly[1].GetY();
else y2=_poly[2].GetY();
if( x1 > x2)
{
double temp=x1;
x1=x2;
x2=temp;
}
if( y1 > y2 )
{
double temp=y1;
y1=y2;
y2=temp;
}
if( ptw.GetX()>x1 && ptw.GetX()<x2 && ptw.GetY()>y1 && ptw.GetY()<y2 )
return true;
else
return false;
}
bool SubRoom::IsInObstacle(const Point& pt)
{
//write the obstacles
......
......@@ -283,6 +283,10 @@ public:
*/
bool IsPartOfPolygon(const Point& pt);
/**
* @return true if the point is inside of the polygon.
*/
bool IsInsideOfPolygon(const Point& ptw);
/**
*
* @return true if the Point is inside any obstacle
......
This diff is collapsed.
......@@ -35,6 +35,16 @@
#include <memory>
#include <atomic>
//jaaa
#include "boost/polygon/voronoi.hpp"
using boost::polygon::voronoi_builder;
using boost::polygon::voronoi_diagram;
using boost::polygon::x;
using boost::polygon::y;
using boost::polygon::low;
using boost::polygon::high;
#include "../geometry/SubRoom.h"
//Forward declarations
class AgentsSource;
class Building;
......@@ -124,6 +134,27 @@ private:
*/
void ComputeBestPositionVoronoi(AgentsSource* src, Pedestrian* agent) const;
/**
* Position incoming pedestrian using voronoi from boost library
* @param src
* @param ped
*/
void ComputeBestPositionVoronoiBoost(AgentsSource* src,Pedestrian* ped) const;
/**
* Position incoming pedestrian using voronoi from boost library
* @param src
* @param peds
*/
void ComputeBestPositionVoronoiBoost2(AgentsSource* src, std::vector<Pedestrian*>& peds) const;
/**Position incoming pedestrian on the vertex with the greatest distance
*
*/
void VoronoiBestVertex1 (const std::vector<Point>& discrete_positions, const voronoi_diagram<double>& vd, SubRoom* subroom, int factor,
voronoi_diagram<double>::const_vertex_iterator& max_it, double& max_dis ) const ;
/**
* Position incoming pedestrians randomly
* @param src
......@@ -131,6 +162,7 @@ private:
*/
void ComputeBestPositionRandom(AgentsSource* src, std::vector<Pedestrian*>& peds) const;
/**
* Adjust the velocity of the pedestrian using the weidmann fundamental diagram
*/
......
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