Commit b81d34da authored by Thomas Pitiot 's avatar Thomas Pitiot

up2

parent 4ab1c999
......@@ -15,8 +15,10 @@ class ArticulatedObject
{
public :
VEC3 getPositionSegment(int index) ;
void addGeneralCell (std::vector< std::pair<Dart,int> > general_belonging, Dart d);
bool removeGeneralCell (std::vector< std::pair<Dart,int> > general_belonging,Dart d);
void addGeneralCell ( Dart d);
bool removeGeneralCell (Dart d);
void addGeneralNeighbor ( Dart d);
bool removeGeneralNeighbor (Dart d);
VEC3 getPosition(int index);
unsigned int nbVertices;
......@@ -27,7 +29,7 @@ public :
std::vector<Dart> * belonging_cells;
std::vector<Dart> * neighbor_cells;
std::vector<std::pair<Dart, int> > general_belonging;
std::vector<std::pair<Dart, int> > general_belonging;
std::vector<std::pair<Dart, int> > general_neighbors;
double width;
Simulator* sim_;
......
......@@ -83,23 +83,6 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_belonging">
<property name="text">
<string>Belonging Cells</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_neighbors">
<property name="text">
<string>Neighbor Cells</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxEdge"/>
</item>
<item>
<widget class="QSlider" name="slider_explode">
<property name="value">
......@@ -117,6 +100,9 @@
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBoxEdge"/>
</item>
<item>
<widget class="QCheckBox" name="checkBox_MovingObject">
<property name="text">
......@@ -125,32 +111,37 @@
</widget>
</item>
<item>
<widget class="Line" name="line_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<widget class="QCheckBox" name="checkBox_belonging">
<property name="text">
<string>Belonging Cells</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_plane">
<widget class="QCheckBox" name="checkBox_neighbors">
<property name="text">
<string>clipping</string>
</property>
<property name="checkable">
<bool>true</bool>
<string>Neighbor Cells</string>
</property>
<property name="checked">
<bool>true</bool>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_displayobjects">
<property name="text">
<string>Objects</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_hide">
<property name="enabled">
<bool>true</bool>
<widget class="QCheckBox" name="checkBox_ObjBelong">
<property name="text">
<string>Objects belonging</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_ObjNeighbors">
<property name="text">
<string>hide clipping plane</string>
<string>Objects neighbors</string>
</property>
</widget>
</item>
......@@ -190,22 +181,5 @@
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>checkBox_plane</sender>
<signal>clicked(bool)</signal>
<receiver>checkBox_hide</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>74</x>
<y>174</y>
</hint>
<hint type="destinationlabel">
<x>74</x>
<y>200</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>
......@@ -98,8 +98,7 @@ public:
//Enregistrement Surfaces
void popAndPushTriangle(Triangle* o); // pop et push d'une Triangle
void FirstRegistrationTriangle (Triangle* o); // premier enregistrement d'une Triangle
void markSameVolume(CellMarkerMemo<MAP,VOLUME> * memo_mark, CellMarkerMemo<MAP,VOLUME> *OneRingMark, Dart d); // enregistrer une dart dans une cellule
void markMultipleVolumes(CellMarkerMemo<MAP,VOLUME> * memo_mark, CellMarkerMemo<MAP,VOLUME> * OneRingMark, const std::vector<Dart>& memo_cross); // enregistrer une dart dans un ensemble de cellules
void markNeighbors(CellMarkerMemo<MAP,VOLUME> * memo_mark, CellMarkerMemo<MAP,VOLUME> * OneRingMark, const std::vector<Dart>& memo_cross); // marker les cellules voisines d'un ensemble de cellules retenu dans memo_cross
void popTriangle(Triangle* o);
void pushTriangleInCell(Triangle* o, Dart d);
......
......@@ -51,9 +51,10 @@ public:
void initOperators(SubdivisionType st); // fonction de sélection du type de subdivision pour l'ihm2
void addGeneralCell (std::vector< std::pair<Dart,int> > general_belonging, Dart d);
bool removeGeneralCell (std::vector< std::pair<Dart,int> > general_belonging,Dart d);
void addGeneralCell ( Dart d);
bool removeGeneralCell (Dart d);
void addGeneralNeighbor ( Dart d);
bool removeGeneralNeighbor (Dart d);
std::vector<Dart> * belonging_cells;
......
......@@ -80,6 +80,9 @@ class Volusion: public Utils::QT::SimpleQGLV
bool render_topo;
bool render_MovingObject;
bool render_topoTemp;
bool display_obj;
bool obj_belong;
bool obj_neighbors;
// bool clip_volume;
// bool hide_clipping;
bool draw_dart;
......@@ -136,6 +139,9 @@ public:
render_topo(false),
render_MovingObject(true),
render_topoTemp(false),
display_obj(true),
obj_belong(false),
obj_neighbors(false),
// clip_volume(false),
// hide_clipping(true),
draw_dart(false),
......@@ -149,6 +155,8 @@ public:
{}
void displayMO();
void displayObj();
protected:
void cb_redraw();
......@@ -169,8 +177,11 @@ public slots:
void belonging_onoff(bool x);
void neighbors_onoff(bool x);
void comboEdge(int x);
void clipping_onoff(bool x);
void hide_onoff(bool x);
void obj_onoff(bool x);
void objBelong_onoff(bool x);
void objNeighbors_onoff(bool x);
// void clipping_onoff(bool x);
// void hide_onoff(bool x);
void slider_explode(int x);
void slider_pressed();
void slider_released();
......
......@@ -6,50 +6,87 @@
*/
void ArticulatedObject::addGeneralCell (std::vector< std::pair<Dart,int> > general_belonging, Dart d)
void ArticulatedObject::addGeneralCell ( Dart d)
{
bool added = false;
std::vector< std::pair<Dart,int> >::iterator it =general_belonging.begin();
while (it != general_belonging.end() )
{
if(sim_->envMap_.map.sameVolume((*it).first,d))
{
(*it).second ++;
added= true;
break;
}
else ++it;
};
if (!added)
{
general_belonging.push_back(std::make_pair(d,1));
}
bool added = false;
for(std::pair<Dart,int> pere : general_belonging)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second ++;
added= true;
break;
}
}
if (!added)
{
general_belonging.push_back(std::make_pair(d,1));
}
}
/*removeGeneralCell
* removes cell d to general belonging decreases the number of instance of the cell, if the number is 0 the celle is removed *forever*
*/
bool ArticulatedObject::removeGeneralCell (std::vector< std::pair<Dart,int> > general_belonging,Dart d)
bool ArticulatedObject::removeGeneralCell (Dart d)
{
std::vector< std::pair<Dart,int> >::iterator it =general_belonging.begin();
while (it != general_belonging.end() )
{
if(sim_->envMap_.map.sameVolume((*it).first,d))
{
if(--((*it).second)==0)
{
*it = general_belonging.back() ;
general_belonging.pop_back() ;
}
return true;
}
else ++it;
};
return false;
for(std::pair<Dart,int> pere : general_belonging)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second--;
if(pere.second==0)
{
pere=general_belonging.back() ;
general_belonging.pop_back() ;
}
return true;
}
};
return false;
}
void ArticulatedObject::addGeneralNeighbor ( Dart d)
{
bool added = false;
for(std::pair<Dart,int> pere : general_neighbors)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second ++;
added= true;
break;
}
}
if (!added)
{
general_neighbors.push_back(std::make_pair(d,1));
}
}
/*removeGeneralCell
* removes cell d to general belonging decreases the number of instance of the cell, if the number is 0 the celle is removed *forever*
*/
bool ArticulatedObject::removeGeneralNeighbor (Dart d)
{
for(std::pair<Dart,int> pere : general_neighbors)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second--;
if(pere.second==0)
{
pere=general_neighbors.back() ;
general_neighbors.pop_back() ;
}
return true;
}
};
return false;
}
VEC3 ArticulatedObject::getPosition(int index)
{
......
This diff is collapsed.
......@@ -132,6 +132,7 @@ void Surface::initPlane()
Algo::Surface::Tilings::Triangular::Grid<PFPSurface> prim(surfaceMap, 1,1) ;
prim.embedIntoGrid(positionSurface,1.0f,1.0f, 0.0f) ;
......@@ -156,12 +157,12 @@ void Surface::initPlane()
}
bool test = false;
while (!test)
{
test = subdiveMap();
// CGoGNout<<"subdiv effectuée ? " <<!test<<CGoGNendl;
}
// bool test = false;
// while (!test)
// {
// test = subdiveMap();
//// CGoGNout<<"subdiv effectuée ? " <<!test<<CGoGNendl;
// }
}
......@@ -281,22 +282,19 @@ void Surface::changeColor(Triangle *t , float distance)
void Surface::addGeneralCell (std::vector< std::pair<Dart,int> > general_belonging, Dart d)
void Surface::addGeneralCell ( Dart d)
{
bool added = false;
std::vector< std::pair<Dart,int> >::iterator it =general_belonging.begin();
while (it != general_belonging.end() )
for(std::pair<Dart,int> pere : general_belonging)
{
if(sim_->envMap_.map.sameVolume((*it).first,d))
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
(*it).second ++;
pere.second ++;
added= true;
break;
}
else ++it;
};
}
if (!added)
{
general_belonging.push_back(std::make_pair(d,1));
......@@ -305,21 +303,62 @@ void Surface::addGeneralCell (std::vector< std::pair<Dart,int> > general_belong
/*removeGeneralCell
* removes cell d to general belonging decreases the number of instance of the cell, if the number is 0 the celle is removed *forever*
*/
bool Surface::removeGeneralCell (std::vector< std::pair<Dart,int> > general_belonging,Dart d)
bool Surface::removeGeneralCell (Dart d)
{
std::vector< std::pair<Dart,int> >::iterator it =general_belonging.begin();
while (it != general_belonging.end() )
for(std::pair<Dart,int> pere : general_belonging)
{
if(sim_->envMap_.map.sameVolume((*it).first,d))
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
if(--((*it).second)==0)
pere.second--;
if(pere.second==0)
{
*it = general_belonging.back() ;
pere=general_belonging.back() ;
general_belonging.pop_back() ;
}
return true;
}
else ++it;
};
return false;
}
void Surface::addGeneralNeighbor ( Dart d)
{
bool added = false;
for(std::pair<Dart,int> pere : general_neighbors)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second ++;
added= true;
break;
}
}
if (!added)
{
general_neighbors.push_back(std::make_pair(d,1));
}
}
/*removeGeneralCell
* removes cell d to general belonging decreases the number of instance of the cell, if the number is 0 the celle is removed *forever*
*/
bool Surface::removeGeneralNeighbor (Dart d)
{
for(std::pair<Dart,int> pere : general_neighbors)
{
if(sim_->envMap_.map.sameVolume(pere.first,d))
{
pere.second--;
if(pere.second==0)
{
pere=general_neighbors.back() ;
general_neighbors.pop_back() ;
}
return true;
}
};
return false;
......
This diff is collapsed.
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