Commit d1687ca2 authored by untereiner's avatar untereiner

embeddedMap3 on the road

parent 5e70a78b
......@@ -91,7 +91,9 @@ bool EmbeddedMap2::uncutEdge(Dart d)
if(Map2::uncutEdge(d))
{
if(isOrbitEmbedded(EDGE))
{
copyDartEmbedding(EDGE, phi2(d), d) ;
}
return true ;
}
return false ;
......
......@@ -29,9 +29,15 @@ namespace CGoGN
Dart EmbeddedMap3::deleteVertex(Dart d)
{
//the merge volumes inside deleteVertex merges the volume embedding
return Map3::deleteVertex(d);
Dart v = Map3::deleteVertex(d) ;
if(v != NIL)
{
if (isOrbitEmbedded(VOLUME))
{
embedOrbit(VOLUME, v, getEmbedding(VOLUME, v)) ;
}
}
return v ;
}
void EmbeddedMap3::cutEdge(Dart d)
......@@ -42,11 +48,9 @@ void EmbeddedMap3::cutEdge(Dart d)
{
Dart nd = phi1(d) ;
//embed the new darts created in the cutted edge
unsigned int vEmb = getEmbedding(EDGE, d);
embedOrbit(EDGE, d, vEmb) ;
//embed a new cell for the new edge and copy the embedding
// embed the new darts created in the cut edge
embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
// embed a new cell for the new edge and copy the attributes' line (c) Lionel
embedNewCell(EDGE, nd) ;
copyCell(EDGE, nd, d) ;
}
......@@ -58,14 +62,8 @@ void EmbeddedMap3::cutEdge(Dart d)
{
Dart nd = phi1(f) ;
copyDartEmbedding(FACE, nd, f);
Dart f2 = phi2(nd);
if(f2!=nd)
{
Dart nd2 = phi2(f);
copyDartEmbedding(FACE, nd2, f2);
}
Dart e = phi2(nd);
copyDartEmbedding(FACE, phi1(e), e);
f = alpha2(f);
} while(f != d);
}
......@@ -75,13 +73,9 @@ void EmbeddedMap3::cutEdge(Dart d)
Dart f = d;
do
{
Dart nd = phi1(f) ;
copyDartEmbedding(VOLUME, nd, f);
Dart nd2 = phi2(f);
if(f!=nd2)
copyDartEmbedding(VOLUME, nd2, f);
unsigned int vEmb = getEmbedding(VOLUME, f) ;
setDartEmbedding(VOLUME, phi1(f), vEmb);
setDartEmbedding(VOLUME, phi2(f), vEmb);
f = alpha2(f);
} while(f != d);
}
......@@ -94,8 +88,7 @@ bool EmbeddedMap3::uncutEdge(Dart d)
//embed all darts from the old two edges to one of the two edge embedding
if(isOrbitEmbedded(EDGE))
{
unsigned int vEmb = getEmbedding(EDGE, d);
embedOrbit(EDGE, d, vEmb) ;
embedOrbit(EDGE, d, getEmbedding(EDGE, d)) ;
}
return true ;
}
......
......@@ -720,439 +720,4 @@ void Map3::closeMap()
}
}
//bool Map3::foreach_connex_volume(Dart d, int degree, FunctorType& f, FunctorSelect<Dart>& s)
//{
// Marker m = this->getNewMarker();
// bool found = false;
// std::list<Dart> darts_list;
// std::list<Dart> neighbours_list;
// darts_list.push_back(d);
// this->markOrbit(DART,d,m);
//
// std::list<Dart>::iterator prem = darts_list.begin();
//
// while (!found && prem != darts_list.end()) {
// Dart d1 = *prem;
// Dart dd;
// switch(degree) {
// case 0 : //vertex connexity
// {
// dd=d1;
// std::list<Dart> darts_list2;
// darts_list2.push_back(dd);
// this->markOrbit(DART,dd,m);
// neighbours_list.push_back(dd);
// std::list<Dart>::iterator prem2 = darts_list2.begin();
//
// while (!found && prem2 != darts_list2.end()) {
// Dart dd1 = *prem2;
// Dart d3 = phi2(dd1);
// Dart d2 = phi1(d3); // turn in volume
// Dart d4 = phi3(d3); // change volume
//
// if(s(dd1))
// found = f(dd1);
//
// if(!this->isMarkedDart(d2,m)) {
// darts_list2.push_back(d2);
// markOrbit(DART,d2,m);
// }
//
// if(!this->isMarkedDart(d4,m)) {
// darts_list2.push_back(d4);
// markOrbit(DART,d4,m);
// }
//
// ++prem2;
// }
// }
// break;
// case 1 : //edge connexity
// dd=d1;
// neighbours_list.push_back(dd);
// do {
// if(!this->isMarkedDart(dd,m)) {
// markOrbit(DART,dd,m);
// if(s(dd))
// found = f(dd);
// }
// dd = alpha2(dd);
// } while(!found && dd!=d1);
// break;
// default : //face connexity
// dd = phi3(d1);
// if(!this->isMarkedDart(dd,m)) {
// neighbours_list.push_back(dd);
// markOrbit(2,dd,m);
// if(s(dd)) {
// found = f(dd);
// }
// }
// } //end switch
//
// //test rest of the volume
// // add phi1 and phi2 successor of they are not yet marked
// Dart d2 = phi1(d1); // turn in face
// Dart d3 = phi2(d1); // change volume
//
// if (!this->isMarkedDart(d2,m)) {
// darts_list.push_back(d2);
// this->markOrbit(DART,d2,m);
// }
// if (!this->isMarkedDart(d3,m)) {
// darts_list.push_back(d3);
// this->markOrbit(DART,d3,m);
// }
//
// ++prem;
// }
//
// //unmark current volume
// for (std::list<Dart>::iterator it = darts_list.begin(); it != darts_list.end(); ++it) {
// this->unmarkOrbit(DART,(*it),m);
// }
//
// //unmark connex volumes checked
// FunctorUnmark<Map3 > fum(*this,m);
// for (std::list<Dart>::iterator it = neighbours_list.begin(); it != neighbours_list.end(); ++it) {
// switch(degree) {
// case 0 :
// foreach_dart_of_vertex((*it),fum);
// break;
// case 1 :
// foreach_dart_of_edge((*it),fum);
// break;
// default :
// foreach_dart_of_face((*it),fum);
// }
// }
// this->releaseMarker(DART,m);
// return found;
//}
//// template <typename DART>
//// void Map3::foreach_volume(FunctorType<Dart>* funct)
//// {
//// // lock a marker
//// int markOV = this->getMarkerIndex();
//// for(Dart d = this->begin(); d != this->end(); this->next(d))
//// {
//// if (!this->isMarkedDart(d,markOV)) // if not yet treated
//// {
//// (*funct)(d); // call the functor and
//// this->markVolume(d,markOV); // mark all dart of the vol
//// }
//// }
//// this->releaseMarker(DART,markOV);
//// }
//void Map3::reverseOrientation()
//{
// Marker mf2 = this->getNewMarker();
// Marker mf3 = this->getNewMarker();
//
// // reverse all faces (only phi1 is modified)
// for (Dart d= this->begin(); d != this->end(); this->next(d))
// {
// if (!isMarkedDart(d,mf2))
// {
// reverseFace(d);
//
// Dart e=d;
// do
// {
// markOrbit(DART,e,mf2);
// markOrbit(DART,e,mf3);
// e=phi1(e);
// }
// while (e!=d);
// }
// }
//
// // store all new phi2 and phi3
// std::vector<Dart> vdphi2;
// std::vector<Dart> vdphi3;
// vdphi2.reserve(this->getNbDarts());
// vdphi3.reserve(this->getNbDarts());
// for (Dart d= this->begin(); d != this->end(); this->next(d))
// {
// Dart e = phi_1(phi2(phi1(d)));
// vdphi2.push_back(e);
// Dart f = phi_1(phi3(phi1(d)));
// vdphi3.push_back(f);
// }
//
// // apply the phi2sew with stored phi2 on all darts
// std::vector<Dart>::iterator id2 = vdphi2.begin();
// std::vector<Dart>::iterator id3 = vdphi3.begin();
// for (Dart d= this->begin(); d != this->end(); this->next(d),++id2,++id3)
// {
// if (isMarkedDart(d,mf2))
// {
// unmarkOrbit(DART,d,mf2); // unmark the two darts
// unmarkOrbit(DART,*id2,mf2);
//
// if (phi2(d) != d)
// phi2unsew(d); // unsew the two darts if necessary
// if (phi2(*id2) != *id2)
// phi2unsew(*id2);
// phi2sew(d,*id2); // sew the darts
// }
//
// if (isMarkedDart(d,mf3))
// {
// unmarkOrbit(DART,d,mf3); // unmark the two darts
// unmarkOrbit(DART,*id3,mf3);
//
// if (phi3(d) != d)
// phi3unsew(d); // unsew the two darts if necessary
// if (phi3(*id3) != *id3)
// phi3unsew(*id3);
// phi3sew(d,*id3); // sew the darts
// }
// }
//
// // no need to clear marker second pass do it
// this->releaseMarker(DART,mf2);
// this->releaseMarker(DART,mf3);
//}
//
//void Map3::deleteEdge(Dart d)
//{
// Dart e = d;
// std::list<Dart> tmp;
// do
// {
// tmp.push_back(e);
// e=phi3(phi2(e));
// }
// while (e!=d);
//
// for (std::list<Dart>::iterator it=tmp.begin();it!=tmp.end();++it)
// {
// Map2::deleteEdge(*it);
// }
//
//}
//
//
//void Map3::removeEdge(Dart d)
//{
//
// Dart e = d;
// std::list<Dart> tmp;
// do
// {
// tmp.push_back(e);
// e=phi3(phi2(e));
// }
// while (e!=d);
//
// for (std::list<Dart>::iterator it=tmp.begin();it!=tmp.end();++it)
// {
// removeFace(*it);
// }
//}
//
//
//void Map3::removeVertex(Dart d)
//{
// std::vector<Dart> store;
// FunctorStore<Dart> fs(store);
// foreach_dart_of_vertex(d,fs);
//
// Marker toMerge = this->getNewMarker();
//
// for (std::vector<Dart>::iterator it = store.begin() ; it!=store.end() ; ++it)
// {
// if (!this->isMarkedDart(*it,toMerge))
// {
// this->markOrbit(DART,this->phi3(this->phi_1(*it)),toMerge);
// }
// else
// {
// this->removeFace(*it);
// }
// }
// this->releaseMarker(DART,toMerge);
//}
//
//
//
//
//
//Dart Map3::trianguleFace(Dart d0)
//{
// Dart d1 = phi1(d0); // Begin with d1 to avoid looking for the dart before d0
// Dart d = d1; // Dart d is used to turn around the face
//
// if (d1 == d0)
// CGoGNout << "Warning: triangulation of a face with only one edge" << CGoGNendl;
//
// if (phi1(d1) == d0)
// CGoGNout << "Warning: triangulation of a face with only two edges" << CGoGNendl;
//
// Dart n = newEdge(2); // Create the first edge with n in the central vertex
// Dart first = phi2(n); // Store the opposite of the first edge
// Dart prec = phi3(n);
// Dart next = phi1(d); // Get the next edge in the face of d
// phi1sew(n,d); // Insert the edge in the face of d (between d and next)
//
// AttributeHandler<Marker> dmarkers( VERTEX<<24 ,*this); // a modifier pour virer <<24
//
// dmarkers[n] = dmarkers[d]; // n->setMarkerVal(d->getMarkerVal());
// dmarkers[phi2(n)] = dmarkers[d]; // phi2(n)->setMarkerVal(d->getMarkerVal());
//
// phi1sew(phi1(phi3(n)),phi3(next));
//
// dmarkers[phi3(n)] = dmarkers[phi3(d)]; // phi3(n)->setMarkerVal(phi3(d)->getMarkerVal());
// dmarkers[phi1(phi3(n))] = dmarkers[phi3(d)]; // phi1(phi3(n))->setMarkerVal(phi3(d)->getMarkerVal());
//
// d = next; // Go to the next edge
//
// while (d != d1)
// {
// n = newEdge(2); // Create an edge
// next = phi1(d); // Get the next edge in the face of d
// phi1sew(n,d); // Insert the edge in the face of d (between d and next)
//
// dmarkers[n] = dmarkers[d];// n->setMarkerVal(d->getMarkerVal());
// dmarkers[phi2(n)] = dmarkers[d]; // phi2(n)->setMarkerVal(d->getMarkerVal());
//
// phi1sew(phi1(phi3(n)),phi3(next));
//
// dmarkers[phi3(n)] = dmarkers[phi3(d)]; // phi3(n)->setMarkerVal(phi3(d)->getMarkerVal());
// dmarkers[phi1(phi3(n))] = dmarkers[phi3(d)]; // phi1(phi3(n))->setMarkerVal(phi3(d)->getMarkerVal());
//
// phi1sew(phi2(n),first); // Sew the edge with the first one around central vertex
// phi1sew(prec,phi3(n));
// prec = phi3(n);
// d = next; // Go to next edge
// }
//
// return n; // Return the last created edge
//}
//
//
//
//
//
//Dart Map3::cutSpike(Dart d)
//{
// Dart e=d;
// int nb=0;
// Dart dNew;
//
// //count the valence of the vertex
// do {
// nb++;
// e=phi1(phi2(e));
// } while (e!=d);
//
// if(nb<3)
// {
// CGoGNout << "Warning : cannot cut 2 volumes without creating a degenerated face " << CGoGNendl;
// return d;
// }
// else
// {
// //triangulate around the vertex
// do {
// if(phi1(phi1(phi1(e)))!=e)
// cutFace(phi_1(e),phi1(e));
// e=phi1(phi2(e));
// } while (e!=d);
//
// dNew=newFace(nb);
//
// //sew a face following the triangles
// Dart dTurn=dNew;
// do {
// Dart d1 = phi1(e);
// Dart dSym = phi2(d1);
// phi2unsew(d1);
// phi2sew(dTurn,d1);
// phi2sew(phi3(dTurn),dSym);
// dTurn = phi1(dTurn);
// e=phi1(phi2(e));
// }while(e!=d);
// }
//
// return dNew;
//}
//
//
//Dart Map3::tetrahedrizeVolume(Dart d)
//{
// // store all the dart of the volume
// std::vector<Dart> vStore;
// FunctorStore<Dart> fs(vStore);
// foreach_dart_of_volume(d,fs);
//
// //get a new marker
// Marker traite = this->getNewMarker();
//
// //the dart that will be returned
// Dart ret;
// //for each dart of the volume
// for (std::vector<Dart>::iterator it = vStore.begin() ; it != vStore.end() ; ++it )
// {
// Dart dc=*it;
// //if not processed
// if (!isMarkedDart(dc,traite))
// {
// Dart dc2 = phi2(dc);
//
// //mark the dart
// markOrbit(DART,dc,traite);
// markOrbit(DART,dc2,traite);
//
// //create the new triangles
// Dart dd=this->newFace(3);
// Dart ee=phi3(dd);
//
// //and sew them
// phi2unsew(dc);
// phi2unsew(dc2);
// phi2sew(dc,dd);
// phi2sew(dc2,ee);
//
// //prepare the returned dart
// ret=phi_1(dd);
// }
// }
//
// //for each dart
// for (std::vector<Dart>::iterator it = vStore.begin() ; it != vStore.end() ; ++it)
// {
// Dart dc=*it;
// //if processed
// if (isMarkedDart(dc,traite))
// {
// //get the previous dart in the face
// Dart dc2 = phi_1(dc);
//
// //unmark them
// unmarkOrbit(DART,dc,traite);
//
// //and sew them to create the tetra
// phi2sew(phi1(phi2(dc)),phi_1(phi2(dc2)));
// }
// }
//
// this->unmarkAll(DART,traite);
// this->releaseMarker(DART,traite);
//
// return ret;
//
//}
//
//
} // namespace CGoGN
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