Commit 5c811f0b authored by Thomas Pitiot 's avatar Thomas Pitiot

réparé, reste juste les particules sur un sommet

parent e5cfadee
......@@ -30,7 +30,7 @@ public :
std::vector<std::pair<Dart, int> > general_belonging;
double width;
Simulator* sim_;
unsigned int index_articulated;
float r;
......
......@@ -597,7 +597,7 @@ void EnvMap::resetPartSubdiv(Segment* o)
Dart d2 =mo->parts_[o->indexPart2]->d;
#ifdef DEBUG_affichage
CGoGNout<<"Reset part subdiv (segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl;
CGoGNout<<"Reset part subdiv (index articul , segment ,ind1, pos1, d1, ind2, pos2, d2) : "<<mo->index_articulated<<" || "<<o->index<<" || "<<o->indexPart1<<" || "<<pos<<" || "<<d1<<" || "<<o->indexPart2<<" || "<<pos2<<" || "<<d2<<CGoGNendl;
CGoGNout<<"Faces centroids : "<<Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d1,position)<<" || "<<Algo::Surface::Geometry::volumeCentroid<PFP,VertexAttribute<VEC3,MAP>>(map,d2,position)<<CGoGNendl;
#endif
......
This diff is collapsed.
......@@ -11,7 +11,7 @@ Knife::Knife(Simulator* sim,std::vector<std::pair<VEC3, Dart>> startingPoints)
Needle_or_knife=false;
nbVertices=startingPoints.size();
nbEdges=nbVertices==0?0:nbVertices-1;
index_articulated=sim->objects.size();
belonging_cells = new std::vector<Dart>[nbEdges];
neighbor_cells = new std::vector<Dart>[nbEdges];
......
......@@ -18,7 +18,7 @@ Needle::Needle(Simulator* sim,std::pair<VEC3, Dart> startingPoint)
belonging_cells = new std::vector<Dart>[maxEdges];
neighbor_cells = new std::vector<Dart>[maxEdges];
index_articulated=sim->objects.size();
parts_.push_back(new CGoGN::Algo::Volume::MovingObjects::ParticleCell3D<PFP>(sim_->envMap_.map, startingPoint.second, startingPoint.first , sim_->envMap_.position));
......@@ -258,9 +258,9 @@ void Needle::updateRegistration()
void Needle::refine()
{
Dart volume = parts_[0]->d;
sim_->envMap_.map.
volume = sim_->envMap_.map.volumeOldestDart(volume);
PFP::VEC3 edge = Algo::Surface::Geometry::vectorOutOfDart<PFP>(sim_->envMap_.map, volume, sim_->envMap_.position) ;
if( )
if(edge.norm2() > 1.0f )
{
if(sim_->envMap_.subdivideVolume(volume))
refine();
......
......@@ -25,7 +25,7 @@ void Simulator::init(int argc, char **argv)
Needle_or_knife = atoi(argv[1]) ;
// Needle_or_knife=false;
// initFixedObjects();
initFixedObjects();
initMovingObject();
// initEmptyMovingObject();
......@@ -45,50 +45,53 @@ void Simulator::initFixedObjects()
std::pair<unsigned int,unsigned int> ind;
VEC3 pos;
pos=VEC3(3,3,3);
pos=VEC3(2.21,3.02,3.53);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
pos=VEC3(-5,1,2);
pos=VEC3(-4.68,1.36,2.15);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
pos=VEC3(4,-2,3);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
// pos=VEC3(4,-2,3);
// p.first=pos;
// p.second=envMap_.getBelongingCell(pos);
// startingPoints.push_back(p);
pos=VEC3(1,-1,1);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
// pos=VEC3(1,-1,1);
// p.first=pos;
// p.second=envMap_.getBelongingCell(pos);
// startingPoints.push_back(p);
pos=VEC3(2,-2.5f,0.5f);
p.first=pos;
p.second=envMap_.getBelongingCell(pos);
startingPoints.push_back(p);
// pos=VEC3(2,-2.5f,0.5f);
// p.first=pos;
// p.second=envMap_.getBelongingCell(pos);
// startingPoints.push_back(p);
ind.first=0;
ind.second=1;
segmentParts.push_back(ind);
ind.first=2;
ind.second=3;
segmentParts.push_back(ind);
// ind.first=2;
// ind.second=3;
// segmentParts.push_back(ind);
ind.first=0;
ind.second=2;
segmentParts.push_back(ind);
ind.first=0;
ind.second=4;
segmentParts.push_back(ind);
// ind.first=0;
// ind.second=2;
// segmentParts.push_back(ind);
// ind.first=0;
// ind.second=4;
// segmentParts.push_back(ind);
ArticulatedObject * obj = new Tree(this,startingPoints,segmentParts);
objects.push_back(obj);
CGoGNout<<"Objet Fixe initialisé : "<<obj->index_articulated<<CGoGNendl;
// CGoGNout<<"points :"<<p.first<<" ; "<<p2.first<<" ; "<</*p3.first<<*/CGoGNendl;
}
......@@ -136,6 +139,6 @@ void Simulator::initMovingObject()
aiguille=new Knife(this,startingPoints);
}
CGoGNout<<"Aiguille initialisée : "<<aiguille->index_articulated<<CGoGNendl;
// CGoGNout<<"points :"<<p.first<<" ; "<<p2.first<<" ; "<</*p3.first<<*/CGoGNendl;
}
......@@ -3,6 +3,7 @@
//initialisation Tree
Tree::Tree(Simulator* sim, std::vector<std::pair<VEC3, Dart>> startingPoints, std::vector<std::pair<unsigned int, unsigned int>> segmentParts)
{
index_articulated=sim->objects.size();
r=0.0f;
g=1.0f;
b=0.0f;
......
......@@ -311,7 +311,11 @@ void Volusion::cb_redraw()
for(auto particule : simul.aiguille->parts_)
{
VEC3 p = particule->getPosition();
if(i==0) m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f);
if(i==0)
{
m_topo_render->overdrawDart(particule->d,15.0f,1.0f,0.5f,1.0f);
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
}
data[i] = p;
i++;
}
......@@ -403,6 +407,26 @@ void Volusion::cb_redraw()
if(render_belonging)
{
m_topo_render->updateData(simul.envMap_.map, simul.envMap_.position, 0.8f, 0.8f, 0.8f);
for (ArticulatedObject * o : simul.objects)
{
for(unsigned int i =0;i<o->nbEdges;i++)
{
// m_topo_render->overdrawDart(simul.aiguille->parts_[i]->d,10.0f,1.0f,0,0);
for(auto it = o->belonging_cells[i].begin(); it !=o->belonging_cells[i].end();++it)
{
for (Edge d : edgesIncidentToVolume3(simul.envMap_.map,(*it)))
{
m_topo_render->overdrawDart(d,5.0f,0.5f,1.0f,0);
}
}
}
}
if (dock.comboBoxEdge->count()<simul.aiguille->nbEdges)
{
dock.comboBoxEdge->clear();
......
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