Commit 7159e0d2 authored by untereiner's avatar untereiner

embeddedMap3

parent 111baf0e
......@@ -98,6 +98,8 @@ public:
virtual unsigned int closeHole(Dart d);
virtual void closeMap(DartMarker &marker);
} ;
} // namespace CGoGN
......
......@@ -31,19 +31,14 @@ namespace CGoGN
template <typename MAP3>
void EmbeddedMap3<MAP3>::sewVolumes(Dart d, Dart e)
{
unsigned int vEmb1 = EMBNULL ;
if(MAP3::isOrbitEmbedded(VERTEX_ORBIT))
{
}
//topological sewing
MAP3::sewVolumes(d,e);
//embed the new vertex orbit (with the new cell) with old vertex orbit value
//embed the vertex orbits from the oriented face with dart e
//with vertex orbits value from oriented face with dart d
if (MAP3::isOrbitEmbedded(VERTEX_ORBIT))
{
unsigned int vEmb1 = EMBNULL ;
Dart dd = d ;
do {
vEmb1 = MAP3::getEmbedding(VERTEX_ORBIT, d);
......@@ -53,97 +48,74 @@ void EmbeddedMap3<MAP3>::sewVolumes(Dart d, Dart e)
}
//embed the new edge orbit with the old edge orbit value
//for all the face
if (MAP3::isOrbitEmbedded(EDGE_ORBIT))
{
unsigned int vEmb1 = EMBNULL ;
Dart dd = d ;
do {
MAP3::copyDartEmbedding(EDGE_ORBIT, e, d) ;
vEmb1 = MAP3::getEmbedding(EDGE_ORBIT, d);
MAP3::embedOrbit(EDGE_ORBIT, d, vEmb1) ;
dd = MAP3::phi1(dd) ;
} while(dd != d) ;
}
//embed the face orbit from the volume sewn
if (MAP3::isOrbitEmbedded(FACE_ORBIT))
MAP3::copyDartEmbedding(FACE_ORBIT, e, d) ;
}
template <typename MAP3>
void EmbeddedMap3<MAP3>::unsewVolumes(Dart d)
{
unsigned int vEmb1 = EMBNULL ;
Dart dd = d ;
do {
//embed the vertex in the dart of the two volumes for the face
// if (MAP3::isOrbitEmbedded(VERTEX_ORBIT))
// {
// Dart e = MAP3::alpha1(dd);
//
// vEmb1 = MAP3::getEmbedding(dd, VERTEX_ORBIT) ;
// MAP3::setDartEmbedding(VERTEX_ORBIT, dd, vEmb1);
//
// if(e != MAP3::phi1(dd))
// {
// MAP3::embedNewCell(VERTEX_ORBIT, e);
// MAP3::copyCell(VERTEX_ORBIT, e, dd);
// }
// }
Dart d3 = MAP3::phi3(d);
bool boundaryD = false;
bool boundaryE = false;
if(MAP3::isOrbitEmbedded(VERTEX_ORBIT))
{
if(MAP3::isBoundaryVertex(d))
boundaryD = true;
if(MAP3::isBoundaryVertex(MAP3::phi1(d)))
boundaryE = true;
}
MAP3::unsewVolumes(d);
Dart dd = d;
Dart dd3 = d3;
do
{
if(MAP3::isOrbitEmbedded(VERTEX_ORBIT))
MAP3::copyCell(VERTEX_ORBIT, dd3, MAP3::phi1(dd));
if(MAP3::isOrbitEmbedded(EDGE_ORBIT))
{
Dart e = MAP3::phi3(dd);
vEmb1 = MAP3::getEmbedding(EDGE_ORBIT, dd);
MAP3::setDartEmbedding(EDGE_ORBIT, dd, vEmb1) ;
if(MAP3::isOrbitEmbedded(FACE_ORBIT))
if(e != dd)
{
MAP3::embedNewCell(EDGE_ORBIT, e);
MAP3::copyCell(EDGE_ORBIT, e, d);
}
}
dd = MAP3::phi1(dd) ;
} while(dd != d) ;
}while( dd != d );
MAP3::unsewVolumes(d);
}
template <typename MAP3>
bool EmbeddedMap3<MAP3>::mergeVolumes(Dart d)
{
unsigned int fEmb = EMBNULL;
unsigned int eEmb = EMBNULL;
Dart d2 = MAP3::phi2(d);
Dart a2 = MAP3::alpha2(d);
if (MAP3::isOrbitEmbedded(VOLUME_ORBIT))
{
fEmb = MAP3::getEmbedding(VOLUME_ORBIT, d);
if(fEmb != EMBNULL)
MAP3::setDartEmbedding(VOLUME_ORBIT, d2, fEmb) ;
}
if (MAP3::isOrbitEmbedded(EDGE_ORBIT))
{
eEmb = MAP3::getEmbedding(EDGE_ORBIT, d);
if(eEmb != EMBNULL)
MAP3::setDartEmbedding(EDGE_ORBIT, a2, eEmb);
}
Dart a_2 = MAP3::phi3(MAP3::phi2(d));
if(MAP3::mergeVolumes(d))
{
if (MAP3::isOrbitEmbedded(VOLUME_ORBIT))
{
MAP3::embedOrbit(VOLUME_ORBIT, d2, fEmb) ;
}
if (MAP3::isOrbitEmbedded(EDGE_ORBIT))
{
MAP3::embedOrbit(EDGE_ORBIT, a2, eEmb);
unsigned int vEmb = MAP3::getEmbedding(VOLUME_ORBIT, d2);
MAP3::embedOrbit(VOLUME_ORBIT, a_2, vEmb) ;
}
return true;
}
return false;
......@@ -170,6 +142,12 @@ void EmbeddedMap3<MAP3>::splitFace(Dart d, Dart e)
}
if(MAP3::isOrbitEmbedded(FACE_ORBIT))
{
MAP3::embedNewCell(FACE_ORBIT, MAP3::phi2(MAP3::phi_1(d)));
MAP3::copyCell(FACE_ORBIT, MAP3::phi2(MAP3::phi_1(d)), d);
}
if(MAP3::isOrbitEmbedded(VOLUME_ORBIT))
{
MAP3::copyDartEmbedding(VOLUME_ORBIT, MAP3::phi_1(d), d);
......@@ -193,6 +171,16 @@ void EmbeddedMap3<MAP3>::cutEdge(Dart d)
MAP3::cutEdge(d);
if(MAP3::isOrbitEmbedded(EDGE_ORBIT))
{
}
if(MAP3::isOrbitEmbedded(FACE_ORBIT))
{
}
if(MAP3::isOrbitEmbedded(VOLUME_ORBIT))
{
Dart demb = d;
......@@ -268,6 +256,8 @@ void EmbeddedMap3<MAP3>::collapseFace(Dart d, bool delDegenerateFaces,
}
//TODO collapseVolume
template <typename MAP3>
Dart EmbeddedMap3<MAP3>::cutSpike(Dart d)
{
......@@ -302,4 +292,22 @@ unsigned int EmbeddedMap3<MAP3>::closeHole(Dart d)
}
template <typename MAP3>
void EmbeddedMap3<MAP3>::closeMap(DartMarker &marker)
{
MAP3::closeMap(marker);
for(Dart d = MAP3::begin() ; d != MAP3::end() ; MAP3::next(d))
{
if(marker.isMarked(d))
{
if(MAP3::isOrbitEmbedded(VERTEX_ORBIT))
{
MAP3::copyDartEmbedding(VERTEX_ORBIT, d, MAP3::phi1(MAP3::phi3(d)));
}
}
}
}
} // namespace CGoGN
......@@ -146,19 +146,8 @@ public:
//! Uncut the edge of d
/*! @param d a dart of the edge to cut
*/
//virtual void uncutEdge(Dart d);
virtual void unCutEdge(Dart d);
//! Sew a face e in the edge d
/*! @param d dart from the edge
* @param e dart from the face
*/
//virtual void sewFace(Dart d, Dart e);
//! Unsew a face d from an edge
/*! \pre Dart d is a dart from the face to unsew
* @param d the edge to unlink
*/
//virtual void unsewFace(Dart d);
//!
/*! Flip the edge of d (rotation in phi1 order)
......@@ -178,14 +167,14 @@ public:
/*!
*
*/
virtual bool flipFace(Dart d);
//virtual bool flipFace(Dart d);
//! Insert a face in phi2 along the orbit phi<-1,2,-1>
/*! The cardinality of <phi1>(nF) must be equal to the cardinality of <phi(-1,2,-1)>(d)
* @param d a dart where the face should be inserted
* @param e a dart from the face to insert
*/
virtual void insertFace(Dart d, Dart e);
//virtual void insertFace(Dart d, Dart e);
//! Collapse an edge (that is deleted) possibly merging its vertices
/*! If delDegenerateFaces is true, the method checks that no degenerate
......@@ -329,7 +318,7 @@ public:
* WARNING: all added dart are marked !!
* @ return index of the marker which with addes darts are marked
*/
//virtual Marker closeMap();
virtual void closeMap(DartMarker& marker);
//TODO a mettre en algo
/**
......
......@@ -178,30 +178,11 @@ void Map3::cutEdge(Dart d)
}
}
//void Map3::sewFace(Dart d, Dart e)
//{
// Dart d2 = phi2(d);
//
// unsewFaces(d);
//
// sewFaces(d2,phi3(e));
// sewFaces(d,e);
//}
//
//void Map3::unsewFace(Dart d)
//{
// if(phi3(d) != d)
// {
// Dart e = phi2(phi3(d));
//
// Dart d2 = phi2(d);
// Dart e2 = phi2(e);
//
// unsewFaces(d);
// unsewFaces(e);
// sewFaces(d2 , e);
// }
//}
void Map3::unCutEdge(Dart d)
{
}
//TODO
//bool Map3::flipEdge(Dart d)
......@@ -236,49 +217,49 @@ void Map3::cutEdge(Dart d)
// return false;
//}
//TODO
bool Map3::flipFace(Dart d)
{
//prevoir de refaire un linkFace et de ne pas
//faire inserFace si flipEdge renvoie faux
//save a dart from a non-modifed-face of one tetrahedron
Dart r = phi2(d);
//detach common face from tetrahedron from the rest of the faces
//unlinkFace(d);
Map3::mergeVolumes(d);
//flip the common edge
Map2::flipEdge(r);
//insert the old face in the new flipped edge
//Map3::insertFace(r,d);
Map3::splitFace(r,d);
return true;
}
void Map3::insertFace(Dart d, Dart e)
{
assert(faceDegree(d) == faceDegree(e)); //les faces ont la meme longueur
Dart dd = d;
Dart nFd = e;
do {
//sewFace(dd,nFd);
Dart d2 = phi2(dd);
unsewFaces(dd);
sewFaces(d2,phi3(nFd));
sewFaces(dd,nFd);
dd = phi_1(phi2(phi_1(dd)));
nFd = phi1(nFd);
} while (nFd != e);
////TODO
//bool Map3::flipFace(Dart d)
//{
// //prevoir de refaire un linkFace et de ne pas
// //faire inserFace si flipEdge renvoie faux
//
// //save a dart from a non-modifed-face of one tetrahedron
// Dart r = phi2(d);
//
// //detach common face from tetrahedron from the rest of the faces
// //unlinkFace(d);
// Map3::mergeVolumes(d);
//
// //flip the common edge
// Map2::flipEdge(r);
//
// //insert the old face in the new flipped edge
// //Map3::insertFace(r,d);
// Map3::splitFace(r,d);
//
// return true;
//}
}
//void Map3::insertFace(Dart d, Dart e)
//{
// assert(faceDegree(d) == faceDegree(e)); //les faces ont la meme longueur
//
// Dart dd = d;
// Dart nFd = e;
//
// do {
// //sewFace(dd,nFd);
//
// Dart d2 = phi2(dd);
// unsewFaces(dd);
// sewFaces(d2,phi3(nFd));
// sewFaces(dd,nFd);
//
// dd = phi_1(phi2(phi_1(dd)));
// nFd = phi1(nFd);
// } while (nFd != e);
//
//}
int Map3::collapseEdge(Dart d, bool delDegenerateFaces,
......@@ -913,53 +894,51 @@ bool Map3::foreach_dart_of_cc(Dart d, FunctorType& f, unsigned int thread)
//Marker Map3::closeMap()
//{
// Marker md = this->getNewMarker();
// std::list<Dart> dartList;
//
//// step 1: double,mark & store darts that have fixed point phi3
// for(Dart d = this->begin(); d != this->end(); this->next(d))
// {
// if (phi3(d) == d)
// {
// Dart e = this->newDart();
// this->markOrbit(DART_ORBIT,e,md);
// phi3sew(d,e);
// dartList.push_back(e);
// }
// }
//
//// step 2: update phi1 of new darts
// for (std::list<Dart>::iterator it=dartList.begin(); it!=dartList.end(); ++it)
// {
// Dart d = *it; // external dart
// Dart e = phi3(d); // internal dart
//
// // update phi1 if not already sewn (the last dart of the dart is automatiquely sewn)
// // test à faire dans sewPhi ?
// //if (phi1(d) != phi3(phi_1(e))) phi1sew(d, phi3(phi_1(e)));
// if (phi1(d) == d) {
// Dart eNext = phi1(e);
// do {
// phi1sew(d, phi3(eNext));
// eNext = phi1(eNext);
// } while (eNext != e);
// }
// // search the dart for phi2:
// e = phi3(phi2(e));
// while (!this->isMarkedDart(e,md))
// {
// e = phi3(phi2(e));
// }
// //update phi2 if not already sewn (if e have previously been sewn with d)
// //test à faire dans sewPhi ?
// if (phi2(d) != e) phi2sew(d,e);
// }
// return md;
//
//}
//
void Map3::closeMap(DartMarker& marker)
{
std::list<Dart> dartList;
// step 1: double,mark & store darts that have fixed point phi3
for(Dart d = this->begin(); d != this->end(); this->next(d))
{
if (phi3(d) == d)
{
Dart e = this->newDart();
marker.markOrbit(DART_ORBIT,e);
phi3sew(d,e);
dartList.push_back(e);
}
}
// step 2: update phi1 of new darts
for (std::list<Dart>::iterator it=dartList.begin(); it!=dartList.end(); ++it)
{
Dart d = *it; // external dart
Dart e = phi3(d); // internal dart
// update phi1 if not already sewn (the last dart of the dart is automatiquely sewn)
// test à faire dans sewPhi ?
//if (phi1(d) != phi3(phi_1(e))) phi1sew(d, phi3(phi_1(e)));
if (phi1(d) == d) {
Dart eNext = phi1(e);
do {
phi1sew(d, phi3(eNext));
eNext = phi1(eNext);
} while (eNext != e);
}
// search the dart for phi2:
e = phi3(phi2(e));
while (!marker.isMarked(e))
{
e = phi3(phi2(e));
}
//update phi2 if not already sewn (if e have previously been sewn with d)
//test à faire dans sewPhi ?
if (phi2(d) != e) phi2sew(d,e);
}
}
//void Map3::reverseOrientation()
//{
// Marker mf2 = this->getNewMarker();
......
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