Commit 4e931ee3 authored by Thomas Pitiot 's avatar Thomas Pitiot

working particules

parent 9a66c2b7
...@@ -63,9 +63,10 @@ public : ...@@ -63,9 +63,10 @@ public :
Algo::MovingObjects::ParticleBase<PFP>(pos), Algo::MovingObjects::ParticleBase<PFP>(pos),
m(map), m(map),
position(tabPos), position(tabPos),
d(belonging_cell), face_center(fa_center),
volume_center(vol_center), volume_center(vol_center),
face_center(fa_center) d(belonging_cell)
{ {
reset_positionFace(); reset_positionFace();
reset_positionVolume(); reset_positionVolume();
...@@ -114,9 +115,10 @@ public : ...@@ -114,9 +115,10 @@ public :
void placeOnRightFaceAndRightEdge(const VEC3& current,bool * casON, bool * enDessous); void placeOnRightFaceAndRightEdge(const VEC3& current,bool * casON, bool * enDessous);
void reset_positionFace(); void reset_positionFace(); // remet a jour la positionFace
void reset_positionVolume(); void reset_positionVolume(); // remet a jour la positionVolume
void resetParticule(); // a appeler pour replacer correctement une particule (apres une subdivision par exemple)
void move(const VEC3& newCurrent) void move(const VEC3& newCurrent)
{ {
crossCell = NO_CROSS ; crossCell = NO_CROSS ;
......
...@@ -73,6 +73,22 @@ void ParticleCell3D<PFP>:: reset_positionVolume() ...@@ -73,6 +73,22 @@ void ParticleCell3D<PFP>:: reset_positionVolume()
} }
} }
template <typename PFP>
void ParticleCell3D<PFP>::resetParticule(){
VEC3 oldPos=this->m_position;
reset_positionFace();
reset_positionVolume();
CGoGN::Algo::MovingObjects::ParticleBase<PFP>::move(m_positionVolume);
#ifdef DEBUG
CGoGNout<<"part moved to centroid ,d : "<< this->getPosition()<<" || "<<this->getCell()<<CGoGNendl;
#endif
this->setState(VOLUME) ;
move(oldPos);
}
template <typename PFP> template <typename PFP>
inline Geom::Orientation3D ParticleCell3D<PFP>::isLeftENextVertex(const VEC3& c, Dart d, const VEC3& base) inline Geom::Orientation3D ParticleCell3D<PFP>::isLeftENextVertex(const VEC3& c, Dart d, const VEC3& base)
{ {
...@@ -104,15 +120,6 @@ Geom::Orientation3D ParticleCell3D<PFP>::whichSideOfPlanVolume(const VEC3& c, Da ...@@ -104,15 +120,6 @@ Geom::Orientation3D ParticleCell3D<PFP>::whichSideOfPlanVolume(const VEC3& c, Da
return Geom::Plane3D<typename PFP::REAL>(top, position[d], base).orient(c); return Geom::Plane3D<typename PFP::REAL>(top, position[d], base).orient(c);
} }
//template <typename PFP>
//Geom::Orientation3D ParticleCell3D<PFP>::isAbove(const VEC3& c, Dart d, const VEC3& top)
//{
// return Geom::Plane3D<typename PFP::REAL>(top,
// position[m.phi1(d)],
// position[d]
// ).orient(c);
//}
template <typename PFP> template <typename PFP>
int ParticleCell3D<PFP>::whichSideOfPlan(const VEC3& c, Dart d, const VEC3& base, const VEC3& normal) // orientation par rapport au plan de gauche de l'arete visée int ParticleCell3D<PFP>::whichSideOfPlan(const VEC3& c, Dart d, const VEC3& base, const VEC3& normal) // orientation par rapport au plan de gauche de l'arete visée
{ {
...@@ -175,125 +182,6 @@ Dart ParticleCell3D<PFP>::nextDartOfVertexNotMarked(Dart d, CellMarkerStore<MAP, ...@@ -175,125 +182,6 @@ Dart ParticleCell3D<PFP>::nextDartOfVertexNotMarked(Dart d, CellMarkerStore<MAP,
return d; return d;
} }
template <typename PFP>
Dart ParticleCell3D<PFP>::nextNonPlanar(Dart d)
{
// lock a marker
Dart d1;
DartMarkerNoUnmark<MAP> markCC(m);
// init algo with parameter dart
std::list<Dart> darts_list;
darts_list.push_back(d);
markCC.mark(d);
// use iterator for begin of not yet treated darts
std::list<Dart>::iterator beg = darts_list.begin();
// until all darts treated
while (beg != darts_list.end()) {
d1 = *beg;
// add phi1, phi2 and phi3 successor if they are not yet marked
Dart d2 = m.phi1(d1);
Dart d3 = m.phi2(d1);
Dart d4 = m.phi_1(d1);
if (!markCC.isMarked(d2)) {
darts_list.push_back(d2);
markCC.mark(d2);
}
if (!markCC.isMarked(d3)) {
darts_list.push_back(d3);
markCC.mark(d3);
}
if (!markCC.isMarked(d4)) {
darts_list.push_back(d4);
markCC.mark(d4);
}
beg++;
// apply functor
Geom::Plane3D<typename PFP::REAL> pl1 = Algo::Surface::Geometry::facePlane<PFP>(m,d,position);
Geom::Plane3D<typename PFP::REAL> pl2 = Algo::Surface::Geometry::facePlane<PFP>(m,d1,position);
if ((pl1.normal()-pl2.normal()).norm2()>0.000001)
beg = darts_list.end();
// remove the head of the list
}
// clear markers
for (std::list<Dart>::iterator it=darts_list.begin(); it!=darts_list.end(); ++it)
markCC.unmark(*it);
return d1;
}
template <typename PFP>
Dart ParticleCell3D<PFP>::nextFaceNotMarked(Dart d, CellMarkerStore<MAP, FACE>& mark)
{
// lock a marker
Dart d1;
DartMarkerNoUnmark<MAP> markCC(m);
// init algo with parameter dart
std::list<Dart> darts_list;
darts_list.push_back(d);
markCC.mark(d);
// use iterator for begin of not yet treated darts
std::list<Dart>::iterator beg = darts_list.begin();
// until all darts treated
while (beg != darts_list.end())
{
d1 = *beg;
if(!mark.isMarked(d1))
{
for (std::list<Dart>::iterator it=darts_list.begin(); it!=darts_list.end(); ++it)
{
markCC.unmark(*it);
}
return d1;
}
// add phi1, phi2 and phi3 successor if they are not yet marked
Dart d2 = m.phi1(d1);
Dart d3 = m.phi2(d1);
Dart d4 = m.phi_1(d1);
if (!markCC.isMarked(d2))
{
darts_list.push_back(d2);
markCC.mark(d2);
}
if (!markCC.isMarked(d3))
{
darts_list.push_back(d3);
markCC.mark(d3);
}
if (!markCC.isMarked(d4))
{
darts_list.push_back(d4);
markCC.mark(d4);
}
beg++;
}
// clear markers
for (std::list<Dart>::iterator it=darts_list.begin(); it!=darts_list.end(); ++it)
{
markCC.unmark(*it);
}
// if(beg==darts_list.end())
return d;
// return d1;
}
template <typename PFP> template <typename PFP>
Geom::Orientation3D ParticleCell3D<PFP>::whichSideOfEdge(const VEC3& c, Dart d) // orientation par rapport au plan orthogonal a la face passant par l'arete visée Geom::Orientation3D ParticleCell3D<PFP>::whichSideOfEdge(const VEC3& c, Dart d) // orientation par rapport au plan orthogonal a la face passant par l'arete visée
{ {
...@@ -434,8 +322,6 @@ void ParticleCell3D<PFP>::vertexState(const VEC3& current) ...@@ -434,8 +322,6 @@ void ParticleCell3D<PFP>::vertexState(const VEC3& current)
if(wsof != 0) if(wsof != 0)
{ {
d = nextNonPlanar(d);
reset_positionFace(); reset_positionFace();
reset_positionVolume(); reset_positionVolume();
this->m_position = this->m_positionFace ; this->m_position = this->m_positionFace ;
...@@ -515,7 +401,6 @@ void ParticleCell3D<PFP>::edgeState(const VEC3& current) ...@@ -515,7 +401,6 @@ void ParticleCell3D<PFP>::edgeState(const VEC3& current)
} }
else { // on a trouvé le camembert et on est dans le volume else { // on a trouvé le camembert et on est dans le volume
// d = nextNonPlanar(m.phi1(d));
d=m.phi1(d); d=m.phi1(d);
reset_positionFace(); reset_positionFace();
reset_positionVolume(); reset_positionVolume();
...@@ -541,14 +426,12 @@ void ParticleCell3D<PFP>::faceState(const VEC3& current, Geom::Orientation3D wso ...@@ -541,14 +426,12 @@ void ParticleCell3D<PFP>::faceState(const VEC3& current, Geom::Orientation3D wso
if (wsof==Geom::OVER) { // si on y est on va dans le volume concerné if (wsof==Geom::OVER) { // si on y est on va dans le volume concerné
d = m.phi3(d); d = m.phi3(d);
d = nextNonPlanar(d);
reset_positionFace(); reset_positionFace();
reset_positionVolume(); reset_positionVolume();
volumeState(current); volumeState(current);
return; return;
} }
else if(wsof==Geom::UNDER) { // si on y est on va dans le volume concerné bis else if(wsof==Geom::UNDER) { // si on y est on va dans le volume concerné bis
d = nextNonPlanar(d);
reset_positionFace(); reset_positionFace();
reset_positionVolume(); reset_positionVolume();
volumeState(current); volumeState(current);
......
...@@ -192,7 +192,6 @@ void ParticleCell3DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<MA ...@@ -192,7 +192,6 @@ void ParticleCell3DMemo<PFP>::vertexState(const VEC3& current, CellMarkerMemo<MA
if(wsof != 0) if(wsof != 0)
{ {
this->d = this->nextNonPlanar(this->d);
this->reset_positionFace(); this->reset_positionFace();
this->reset_positionVolume(); this->reset_positionVolume();
this->m_position = this->m_positionFace ; this->m_position = this->m_positionFace ;
...@@ -302,7 +301,6 @@ void ParticleCell3DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<MAP, ...@@ -302,7 +301,6 @@ void ParticleCell3DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<MAP,
std::cout << "wsof OVER" << std::endl; std::cout << "wsof OVER" << std::endl;
#endif #endif
this->d = this->m.phi3(this->d); this->d = this->m.phi3(this->d);
this->d = this->nextNonPlanar(this->d);
this->reset_positionFace(); this->reset_positionFace();
this->reset_positionVolume(); this->reset_positionVolume();
volumeState(current, memo_cross); volumeState(current, memo_cross);
...@@ -312,7 +310,6 @@ void ParticleCell3DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<MAP, ...@@ -312,7 +310,6 @@ void ParticleCell3DMemo<PFP>::edgeState(const VEC3& current, CellMarkerMemo<MAP,
#ifdef DEBUG #ifdef DEBUG
std::cout << "wsof UNDER" << std::endl; std::cout << "wsof UNDER" << std::endl;
#endif #endif
this->d = this->nextNonPlanar(this->d);
this->reset_positionFace(); this->reset_positionFace();
this->reset_positionVolume(); this->reset_positionVolume();
volumeState(current, memo_cross); volumeState(current, memo_cross);
......
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