Commit cb708f28 authored by pitiot's avatar pitiot

correction initialisation

parent 7f90ed0e
......@@ -16,6 +16,8 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR}
)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
QT4_WRAP_CPP( socialAgents_moc ../include/viewer.h )
add_executable( socialAgents
......
......@@ -6,7 +6,14 @@
#include "utils.h"
#include "env_map.h"
#include "spatialHashing.h"
#include "Algo/MovingObjects/particle_cell_2D.h"
//#define SECURED
#ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
#else
#include "Algo/MovingObjects/particle_cell_2D.h"
#endif
class Simulator ;
......@@ -46,7 +53,11 @@ public:
#ifdef SPATIAL_HASHING
VEC3 pos ;
#else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ;
#ifdef SECURED
CGoGN::Algo::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
#else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ;
#endif
#endif
unsigned int curGoal_ ;
......@@ -63,6 +74,7 @@ public:
static unsigned int maxMovingObstacles_;
static float averageMaxSpeed_ ;
static float neighborDist_ ;
static float neighborDistSq_ ;
static float radius_ ;
......
......@@ -79,7 +79,7 @@ public:
void popAgentInCells(Agent* agent, Dart d) ;
void agentChangeFace(Agent* agent, Dart oldFace) ;
void popAndPushObstacleInCells(Obstacle* o, int n);
Dart popAndPushObstacleInCells(Obstacle* o, int n);
void pushObstacleInCells(Obstacle * mo);
void pushObstacleInOneRingCells(Obstacle * o, Dart d, int n);
void pushObstacleInCells(Obstacle* o, int n, const std::vector<Dart>& memo_cross);
......@@ -328,7 +328,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
} while(first==NIL && d!=beg);
++it;
}while(first==NIL && it!=belonging_cells.end());
assert(!buildingMark.isMarked(d)) ;
// assert(!buildingMark.isMarked(d)) ;
assert(first!=NIL) ;
// CGoGNout<<"first : "<<first<<CGoGNendl;
d=first;
......
......@@ -5,6 +5,8 @@
#include "agent.h"
#include "Utils/colorMaps.h"
#include "Algo/Render/GL1/map_glRender.h"
inline void renderDart(EnvMap& m, Dart d)
{
PFP::VEC3 p1 = m.position[d] ;
......@@ -44,17 +46,66 @@ inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
}
inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false)
inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false, bool showVertices=false)
{
glBegin(GL_POLYGON) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
// glColor3f(0,1,0);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(obst->map, Algo::Render::GL1::LINE,
// 1.0, obst->position,
// obst->normal) ;
if(showVertices)
{
glPointSize(3.0f) ;
glColor3f(0.0,0.0,1.0);
glBegin(GL_POINTS) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
glPointSize(1.0f) ;
}
glColor3f(1.0,0.0,1.0);
glBegin(GL_LINE_LOOP) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->parts_[i]->getPosition() ;
const VEC3& p = obst->getDilatedPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
// glColor3f(0.0,1.0,1.0);
// glBegin(GL_LINES) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getPosition(i) ;
// glVertex3fv(p.data()) ;
// const VEC3& p2 = obst->getDilatedPosition(i) ;
// glVertex3fv(p2.data()) ;
// }
// glEnd() ;
glLineWidth(5.0f) ;
glColor3f(1.0,1.0,0.0);
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p += 20.0f*obst->velocity_;
glVertex3fv(p.data()) ;
glEnd() ;
if (renderPath)
{
glLineWidth(3.0f) ;
......@@ -62,10 +113,19 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
for (std::vector<VEC3>::iterator it = ++(obst->goals_.begin()) ; it != obst->goals_.end() ;
++it)
{
glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
// glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
glVertex3f((*it)[0], (*it)[1], obst->index) ;
}
glEnd() ;
glLineWidth(1.0f) ;
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p = obst->goals_[obst->curGoal_];
glVertex3fv(p.data()) ;
glEnd() ;
}
}
......@@ -127,13 +187,22 @@ inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false,
{
glLineWidth(3.0f) ;
glBegin(GL_LINE_STRIP) ;
for (std::vector<VEC3>::iterator it = ++(agent->goals_.begin()) ; it != agent->goals_.end() ;
for (std::vector<VEC3>::iterator it = (agent->goals_.begin()) ; it != agent->goals_.end() ;
++it)
{
glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
glVertex3f((*it)[0], (*it)[1], agent->agentNo) ;
}
glVertex3f((*(agent->goals_.begin()))[0], (*(agent->goals_.begin()))[1], (*(agent->goals_.begin()))[2]) ;
glEnd() ;
glLineWidth(1.0f) ;
glPointSize(5.0f) ;
glBegin(GL_POINTS) ;
VEC3 g = agent->goals_[agent->curGoal_];
glVertex3fv(g.data()) ;
glEnd() ;
glPointSize(1.0f) ;
}
if (showNeighborDist)
......
......@@ -15,23 +15,32 @@ using namespace std;
class MovingMesh
{
public:
MovingMesh(EnvMap * envMap, Dart d, std::string filename);
MovingMesh(EnvMap& envMap, Dart d, std::string filename);
void linkWithObstacle(MovingObstacle * mo);
void transform(Geom::Matrix44f m);
void translate(VEC3 v);
void scale(float val);
void moveInFace(PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos);
void move();
void animate();
std::vector<VEC3> computeProjectedPointSet();
std::vector<VEC3> jarvisConvexHull(std::vector<VEC3> projectedPointSet);
void draw();
std::vector<VEC3> computeProjectedPointSet(float maxHeight);
void simplifyCurve(std::vector<VEC3>& pointSet, std::vector<bool>& active, int start, int end, float epsilon);
std::vector<VEC3> jarvisConvexHull(const std::vector<VEC3>& projectedPointSet);
std::vector<VEC3> computeSkeleton(std::vector<VEC3> projectedPointSet, unsigned int nodeNumber);
PFP::MAP& motherMap;
VertexAttribute<VEC3>& motherPosition;
PFP::MAP map;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal;
float scaleValue;
ShapeMatchingQuadratic<PFP> * smg;
std::vector<VEC3> skeleton;
......
......@@ -7,16 +7,18 @@
#include "env_map.h"
#include <set>
#include "Algo/MovingObjects/particle_cell_2D_memo.h"
using namespace std;
PFP::VEC3 rotate (PFP::VEC3 pos1, PFP::VEC3 center, float angle);
float get_angle (PFP::VEC3 v1, PFP::VEC3 v2);
PFP::VEC3 get_center (ArticulatedObstacle * art, int index);
class Simulator ;
class MovingMesh;
class MovingObstacle
{
public:
MovingObstacle(Simulator* sim, int index, std::vector<PFP::VEC3> pos, std::vector<VEC3> goals,bool spin, ArticulatedObstacle * art=NULL, int ind2=-1);
MovingObstacle(Simulator* sim, int index, std::vector<PFP::VEC3> pos, std::vector<VEC3> goals, bool rigid, bool spin,int curGoal=0, Dart d=NIL, ArticulatedObstacle * art=NULL, int indParent=-1);
bool test_opposition(VEC3 o, VEC3 p1, VEC3 p2);
// void contournerBatiment();
void updateAgentNeighbors() ;
......@@ -25,13 +27,40 @@ public:
void computePrefVelocity();
void computeNewVelocity();
std::vector<Dart> getMemoCross(const VEC3& pos, const VEC3& dest, Dart& d1, CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> * registering_part);
VEC3 getDilatedPosition(unsigned int ind); //vertex position with velocity dilatation
VEC3 getPosition(unsigned int ind); // vertex position
void update();
PFP::REAL computeMVC(PFP::VEC3 p, Dart vertex);
void computePointMVC(PFP::VEC3 point, std::vector<PFP::REAL>& coordinates);
void attachMesh(MovingMesh* mm);
void updateMesh();
unsigned int nbVertices;
std::vector<PFP::VEC3> vertices;
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>* * parts_;
float gravity_dist;
PFP::MAP map;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal;
VertexAttribute<VEC3> deformation;
VertexAttribute<VEC3> velocity;
EdgeAttribute<float> edgeLength;
Dart groundFace;
//vector de détails pour la deformation
// std::vector<PFP::VEC3> verticesDeformation;
//gestion pour du mass-ressort
// std::vector<PFP::VEC3> verticesVelocity;
// std::vector<float> edgeLength;
// std::vector<float> verticesAngle;
// float rigidity;
// float gravity_dist;
VEC3 center;
int nb_agents_voisins;
int nb_register_cells;
......@@ -53,6 +82,7 @@ public:
std::vector<VEC3> goals_ ;
unsigned int curGoal_;
Dart dDir;
// static float neighborDistSq_;
static unsigned int maxNeighbors_;
......@@ -60,7 +90,7 @@ public:
static float neighborDist_;
static float neighborDistSq_;
static float maxSpeed_;
float obstacle_range;
// float obstacle_range;
static float timeHorizonObst_;
float velocity_factor;
float color1;
......@@ -71,9 +101,13 @@ public:
VEC3 newVelocity_;
VEC3 prefVelocity_;
Simulator* sim_;
bool rigid_;
bool spinning;
ArticulatedObstacle * parent;
int index_parent;
MovingMesh* mm_;
VertexAttribute<NoMathIONameAttribute<std::vector<PFP::REAL> > > mvc_;
};
#endif
......@@ -6,7 +6,7 @@
class Obstacle
{
public:
Obstacle(const VEC3& point1, const VEC3& point2, const VEC3& prevPoint, const VEC3& nextPoint,
Obstacle(const VEC3 point1, const VEC3 point2, const VEC3 prevPoint, const VEC3 nextPoint,
MovingObstacle * moving1, unsigned int ind) :
p1(point1), p2(point2), prevP(prevPoint), nextP(nextPoint),
mo(moving1), index(ind)
......@@ -17,10 +17,10 @@ public:
// nextP[2] = 0 ;
}
const VEC3& p1 ;
const VEC3& p2 ;
const VEC3& prevP ;
const VEC3& nextP ;
VEC3 p1 ;
VEC3 p2 ;
VEC3 prevP ;
VEC3 nextP ;
MovingObstacle * mo ;
unsigned int index ;
} ;
......
......@@ -83,8 +83,6 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit
// inCurrentFace = map.phi1(inCurrentFace) ;
// } while (inCurrentFace != currentFace) ;
} while (facesToTry.size() > 0 && !map.sameFace(start, currentFace)) ;
// If a path has been found, push all predecessors from start to stop
......@@ -96,6 +94,13 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit
path.push_back(toPush) ;
toPush = faceNextFaceToGoal[toPush] ;
} while (toPush != goal) ;
// Dart dS = path[0];
// do
// {
// dS = map.phi1(dS);
// } while(dS!=path[0] || !map.sameFace(map.phi2(dS),path[1]));
// path[0] = dS;
}
else
{
......
......@@ -80,11 +80,11 @@ public:
class Simulator
{
public:
Simulator(unsigned int config, unsigned int minSize) ;
Simulator(unsigned int config, unsigned int minSize, unsigned int nbAgent=1000, unsigned int nbObst=20) ;
~Simulator() ;
void init(float dimension, bool enablePathFinding = false) ;
void init(float dimension, unsigned int nbAgent, unsigned int nbObst, bool enablePathFinding = false) ;
void doStep() ;
......@@ -120,6 +120,7 @@ public:
EnvMap envMap_ ;
std::vector<Agent*> agents_ ;
std::vector<MovingObstacle*> movingObstacles_;
std::vector<MovingMesh*> movingMeshes_; //for visualization only
int minSize;
unsigned int config;
float timeStep_ ;
......
......@@ -129,6 +129,19 @@
<item>
<widget class="QSpinBox" name="check_slide"/>
</item>
<item>
<widget class="QCheckBox" name="check_pos">
<property name="text">
<string>Draw X line</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="check_x_val"/>
</item>
<item>
<widget class="QSpinBox" name="check_y_val"/>
</item>
<item>
<widget class="QCheckBox" name="check_elipse">
<property name="text">
......
......@@ -51,7 +51,7 @@ class SocialAgents : public Utils::QT::SimpleQT
Q_OBJECT
public:
SocialAgents(unsigned int config, unsigned int minSize, unsigned int iterations) ;
SocialAgents(unsigned int config, unsigned int minSize, unsigned int nbAgent , unsigned int nbObst , unsigned int iterations) ;
void initGUI() ;
......@@ -103,8 +103,11 @@ public:
bool drawObstPredictionTri ;
bool drawObstPath ;
bool draw_dart;
bool draw_posX;
bool draw_elipse;
unsigned int dartSlider;
int posXSlider;
int posYSlider;
public slots:
void animate() ;
......@@ -183,9 +186,24 @@ public slots:
dartSlider = i;
updateGL();
}
void slot_posX(bool b)
{
draw_posX = b ;
updateGL() ;
}
void slot_slide2(int i)
{
posXSlider = i;
updateGL();
}
void slot_slide3(int i)
{
posYSlider = i;
updateGL();
}
void slot_elipse(bool b)
{
draw_elipse = b;
updateGL();
}
{
draw_elipse = b;
updateGL();
}
} ;
This diff is collapsed.
......@@ -4,13 +4,13 @@ ArticulatedObstacle::ArticulatedObstacle(Simulator* sim, int index, int currentI
{
this->index=index;
nbBodyPart = size;
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1 ,pos[0],goals,true,this,0);
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1 ,pos[0],goals,true,true,1, NIL,this,0);
members.push_back(mo4);
for(int i =1; i<nbBodyPart; i++)
{
std::vector<VEC3> goal;
goal.push_back(members[i-1]->center);
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1+i ,pos[i],goal,true, this,i);
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1+i ,pos[i],goal, true, true,0, NIL, this,i);
members.push_back(mo4);
}
......
......@@ -74,7 +74,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
{
case 0 :
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateCity<PFP>(*this,1) ;
CityGenerator::generateCity<PFP>(*this,0) ;
break ;
case 1 :
CityGenerator::generateGrid<PFP>(*this) ;
......@@ -98,13 +98,13 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
Algo::Import::importSVG<PFP>(map, filename, position, obstacleMark, buildingMark) ;
std::string filename2 = "./svg/mapBuild.svg" ;
Algo::Import::importSVG<PFP>(mapScenary, filename2, positionScenary, obstacleMarkS, buildingMarkS) ;
// Algo::Import::importSVG<PFP>(mapScenary, filename2, positionScenary, obstacleMarkS, buildingMarkS) ;
Geom::BoundingBox<PFP::VEC3> bb1, bb2 ;
bb1 = Algo::Geometry::computeBoundingBox<PFP>(map, position) ;
bb2 = Algo::Geometry::computeBoundingBox<PFP>(mapScenary, positionScenary) ;
bb1.addPoint(bb2.min());
bb1.addPoint(bb2.max());
// bb2 = Algo::Geometry::computeBoundingBox<PFP>(mapScenary, positionScenary) ;
// bb1.addPoint(bb2.min());
// bb1.addPoint(bb2.max());
// CityGenerator::planetify<PFP>(map, position, 100.0f, bb1);
// CityGenerator::planetify<PFP>(mapScenary, positionScenary, 100.0f, bb1);
......@@ -558,7 +558,7 @@ void EnvMap::pushObstacleInCells(Obstacle * o)// réenregistre l'obstacle en que
}
}
void EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistrement
Dart EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistrement
{
MovingObstacle * mo = o->mo;
VEC3 p1 = mo->parts_[n]->getPosition();
......@@ -599,6 +599,8 @@ void EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistre
pushObstacleInCells(o, n, memo);
}
}
return d1;
}
void EnvMap::pushObstacleInOneRingCells(Obstacle * o, Dart d, int n)
......@@ -722,7 +724,8 @@ void EnvMap::refine()
subdivisable = sf.second ;
else
{
float minSizeSq = minCellSize * minCellSize ; // diametre de vision de l'agent au carré
// float minSizeSq = minCellSize * minCellSize ; // diametre de vision de l'agent au carré
float minSizeSq = Agent::neighborDistSq_;
fLevel = map.faceLevel(old) ;
map.setCurrentLevel(fLevel) ;
......
#include "moving_mesh.h"
#include "Algo/Render/GL1/map_glRender.h"
MovingMesh::MovingMesh(EnvMap * envMap, Dart d, std::string filename):
MovingMesh::MovingMesh(EnvMap& envMap, Dart d, std::string filename):
motherMap(envMap.map),
motherPosition(envMap.position),
constrainedV(map)
{
std::vector<std::string> attrNames ;
......@@ -12,22 +15,51 @@ constrainedV(map)
position = map.getAttribute<VEC3, VERTEX>(attrNames[0]) ;
normal = map.addAttribute<VEC3, VERTEX>("normal");
scale(2.5f);
float area = Algo::Geometry::convexFaceArea<PFP>(envMap.map, d, envMap.position);
scaleValue = std::max(area/1400.0f,10.0f);
std::cout << "scaleVal " << scaleValue << std::endl;
// scaleValue = 4.0f;
scale(scaleValue);
// scale(2.5f);
// scale(0.5f);
VEC3 v = Algo::Geometry::faceCentroid<PFP>(motherMap, d, motherPosition) ;
translate(v);
// TraversorV<PFP::MAP> tv(map);
// std::vector<Dart> obstDarts;
// for(Dart dd = tv.begin() ; dd != tv.end() ; dd = tv.next())
// {
// obstDarts.push_back(dd);
// }
//
// smg = new ShapeMatchingQuadratic<PFP>(map,position,obstDarts,0.5f);
// smg->initialize();
map.enableQuickTraversal<VERTEX>();
}
void MovingMesh::linkWithObstacle(MovingObstacle * mo)
{
this->mo = mo;
}
void MovingMesh::transform(Geom::Matrix44f m)
{
TraversorV<PFP::MAP> tv(map);
std::vector<Dart> obstDarts;
for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
{
obstDarts.push_back(d);
position[d] = Geom::transform(position[d],m);
}
smg = new ShapeMatchingQuadratic<PFP>(map,position,obstDarts,0.5f);
smg->initialize();
}
void MovingMesh::linkWithObstacle(MovingObstacle * mo)
void MovingMesh::translate(VEC3 v)
{
this->mo = mo;
TraversorV<PFP::MAP> tv(map);
for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
{
position[d] += v;
}
}
void MovingMesh::scale(float val)
......@@ -99,95 +131,141 @@ void MovingMesh::animate()
}
}
std::vector<VEC3> MovingMesh::computeProjectedPointSet()
void MovingMesh::draw()
{
std::vector<VEC3> res;
return res;
glColor3f(0,1,0);
Algo::Render::GL1::renderTriQuadPoly<PFP>(map, Algo::Render::GL1::LINE,
1.0, position,
normal) ;
}
double jarvisFindAngle(VEC3 v1, VEC3 v2)
std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight)
{
double deltaX=(double)(v2[0]-v1[0]);
double deltaY=(double)(v2[1]-v1[1]);
double angle;
std::vector<VEC3> points;
if (deltaX==0 && deltaY==0)
return 0;
TraversorV<PFP::MAP> tv(map);
for(Dart dd = tv.begin() ; dd != tv.end() ; dd = tv.next())
{
if(position[dd][2]<maxHeight)
points.push_back(position[dd]);
}
angle=std::atan2(deltaY,deltaX)*57.295779513082;
points = jarvisConvexHull(points);
points.pop_back();
Geom::Plane3D<float> pl = Algo::Geometry::facePlane<PFP>(motherMap, motherMap.begin(), motherPosition);
for(unsigned int i = 0; i < points.size() ; ++i)
{
VEC3& v = points[i];
pl.project(v);
}
if (angle < 0)
angle += 360.;
std::vector<bool> active;
active.assign(points.size(), true);
simplifyCurve(points, active, 0, points.size()-1, 0.2f);
return angle;
std::vector<VEC3> res;
for(unsigned int i = 0; i < points.size() ; ++i)
{
if(active[i])
res.push_back(points[i]);
}
std::cout << "nb vertices before simplification -> " << points.size() << std::endl;
std::cout << "nb vertices after simplification -> " << res.size() << std::endl;
return res;
}
std::vector<VEC3> MovingMesh::jarvisConvexHull(std::vector<VEC3> pointSet)
void MovingMesh::simplifyCurve(std::vector<VEC3>& pointSet, std::vector<bool>& active, int start, int end, float epsilon)
{
float distMax = 0;
int index = start;
VEC3 first = pointSet[start];
VEC3 last = pointSet[end];
for (int i = start + 1; active[i] && i < end; ++i)
{
float d = distSqPointLineSegment(first, last, pointSet[i]);
if (d > distMax)
{
index = i;
distMax = d;
}
}
std::vector<VEC3> resultList;
// If max distance is greater than epsilon, recursively simplify
if (distMax >= epsilon)
{
// Recursive call
simplifyCurve(pointSet, active, start, index, epsilon);
simplifyCurve(pointSet, active, index, end, epsilon);
}
else
{
for (int i = start + 1; i < end; ++i)
active[i] = false;
}
}
std::vector<VEC3> MovingMesh::jarvisConvexHull(const std::vector<VEC3>& pointSet)
{
std::cout << "pointSet " << pointSet.size() << std::endl;
assert(pointSet.size()>2);
std::vector<unsigned int> convHull;
int maxAngle=0, minAngle=0;
unsigned int minPoint=0, maxPoint=0;
unsigned int cP; //currPoint
for(unsigned int i=1; i<pointSet.size(); ++i)
if(pointSet[i][1]>pointSet[maxPoint][1])
maxPoint=i;
unsigned int minPoint=0;
unsigned int curr;
for(unsigned int i=1; i<pointSet.size(); ++i) //FOR ALL POINTS IN THE SET, FIND MIN POINT
if(pointSet[i][1]<pointSet[maxPoint][1])
if(pointSet[i][1]>pointSet[minPoint][1])
minPoint=i;
convHull.push_back(minPoint);
cP =minPoint;
while(cP!=maxPoint) //build left hand side
{
maxAngle=cP;