Commit 7f2d298b authored by untereiner's avatar untereiner

deleteCC dans Map2

parent 89786538
......@@ -163,20 +163,20 @@ Polyhedron<PFP>::Polyhedron(const Polyhedron<PFP>& p1, const Polyhedron<PFP>& p2
template <typename PFP>
Dart Polyhedron<PFP>::createTetra(typename PFP::MAP& the_map)
{
Dart base = the_map.newFace(3,false);
Dart base = the_map.newFace(3, false);
Dart side1 = the_map.newFace(3,false);
the_map.sewFaces(base,side1,false);
Dart side1 = the_map.newFace(3, false);
the_map.sewFaces(base, side1, false);
Dart side2 = the_map.newFace(3,false);
the_map.sewFaces(the_map.phi1(base),side2,false);
the_map.sewFaces(the_map.phi_1(side1), the_map.phi1(side2),false);
Dart side2 = the_map.newFace(3, false);
the_map.sewFaces(the_map.phi1(base), side2, false);
the_map.sewFaces(the_map.phi_1(side1), the_map.phi1(side2), false);
Dart side3 = the_map.newFace(3,false);
the_map.sewFaces(the_map.phi_1(base),side3,false);
the_map.sewFaces(the_map.phi_1(side2), the_map.phi1(side3),false);
Dart side3 = the_map.newFace(3, false);
the_map.sewFaces(the_map.phi_1(base), side3, false);
the_map.sewFaces(the_map.phi_1(side2), the_map.phi1(side3), false);
the_map.sewFaces(the_map.phi_1(side3), the_map.phi1(side1),false);
the_map.sewFaces(the_map.phi_1(side3), the_map.phi1(side1), false);
return base;
}
......
......@@ -113,6 +113,11 @@ public:
*/
virtual void deleteFace(Dart d) ;
//! Delete a connected component of the map
/*! @param d a dart of the connected component
*/
virtual void deleteCC(Dart d) ;
//! Fill a hole with a face
/*! \pre Dart d is boundary marked
* @param d a dart of the face to fill
......
......@@ -110,6 +110,12 @@ public:
* @param d a dart of the volume
*/
virtual void deleteVolume(Dart d);
//! Fill a hole with a volume
/*! \pre Dart d is boundary marked
* @param d a dart of the volume to fill
*/
virtual void fillHole(Dart d) ;
//@}
/*! @name Topological Operators
......
......@@ -111,57 +111,53 @@ inline Dart Map3::alpha0(Dart d)
*/
inline Dart Map3::alpha1(Dart d)
{
return phi1(phi3(d)) ;
return phi_1(phi3(d)) ;
}
#ifdef NO_BOUND_MAP
inline Dart Map3::alpha2(Dart d)
{
return phi2(phi3(d));
return phi3(phi2(d));
}
#else
inline Dart Map3::alpha2(Dart d)
{
Dart e = phi2(d);
Dart f = phi3(e);
if (f != e)
return f;
f = d;
e = phi3(f);
while (e != f)
{
f = phi2(e);
e = phi3(f);
}
return f;
}
#endif
//inline Dart Map3::alpha2(Dart d)
//{
// Dart e = phi2(d);
// Dart f = phi3(e);
//
// if (f != e)
// return f;
//
// f = d;
// e = phi3(f);
// while (e != f)
// {
// f = phi2(e);
// e = phi3(f);
// }
// return f;
//}
#ifdef NO_BOUND_MAP
inline Dart Map3::alpha_2(Dart d)
{
return phi3(phi2(d));
return phi2(phi3(d));
}
#else
inline Dart Map3::alpha_2(Dart d)
{
Dart e = phi3(d);
if (e != d)
return phi2(e);
e = d;
Dart f = phi2(d);
while (phi3(f) != f)
{
e = phi3(f);
f = phi2(e);
}
return e;
}
#endif
//inline Dart Map3::alpha_2(Dart d)
//{
// Dart e = phi3(d);
//
// if (e != d)
// return phi2(e);
//
// e = d;
// Dart f = phi2(d);
// while (phi3(f) != f)
// {
// e = phi3(f);
// f = phi2(e);
// }
// return e;
//}
inline void Map3::phi3sew(Dart d, Dart e)
{
......
......@@ -24,6 +24,7 @@
#include "Topology/map/map2.h"
#include "Topology/generic/traversorCell.h"
#include "Topology/generic/traversor2CC.h"
namespace CGoGN
{
......@@ -124,6 +125,37 @@ void Map2::deleteFace(Dart d)
Map1::deleteCycle(dd) ;
}
void Map2::deleteCC(Dart d)
{
DartMarkerStore mark(*this);
std::vector<Dart> visited;
visited.push_back(d);
std::vector<Dart>::iterator it;
for (it = visited.begin(); it != visited.end(); ++it)
{
if (!mark.isMarked(*it))
{
Dart d1 = phi1(*it) ;
if(!mark.isMarked(d1))
{
mark.mark(d1);
visited.push_back(d1) ;
}
Dart d2 = phi2(*it) ;
if(!mark.isMarked(d2))
{
mark.mark(d2);
visited.push_back(d2) ;
}
}
}
for(it = visited.begin(); it != visited.end(); ++it)
deleteDart(*it) ;
}
void Map2::fillHole(Dart d)
{
assert(isBoundaryMarked(d)) ;
......@@ -709,7 +741,7 @@ bool Map2::foreach_dart_of_edge(Dart d, FunctorType& fonct, unsigned int thread)
bool Map2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int thread)
{
DartMarkerStore mark(*this,thread); // Lock a marker
DartMarkerStore mark(*this, thread); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> visitedFaces; // Faces that are traversed
......@@ -728,15 +760,15 @@ bool Map2::foreach_dart_of_oriented_volume(Dart d, FunctorType& f, unsigned int
// and add non visited adjacent faces to the list of face
if (!found)
{
Dart dNext = *face ;
Dart it = *face ;
do
{
mark.mark(dNext); // Mark
Dart adj = phi2(dNext); // Get adjacent face
mark.mark(it); // Mark
Dart adj = phi2(it); // Get adjacent face
if (!isBoundaryMarked(adj) && !mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
dNext = phi1(dNext);
} while(dNext != *face);
it = phi1(it);
} while(it != *face);
}
}
}
......
......@@ -39,7 +39,7 @@ void Map3::deleteVolume(Dart d)
visitedFaces.reserve(512);
visitedFaces.push_back(d); // Start with the face of d
mark.markOrbit(FACE, d) ;
mark.markOrbitInParent(FACE, d) ;
for(std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{
......@@ -53,16 +53,15 @@ void Map3::deleteVolume(Dart d)
if(!mark.isMarked(ee)) // not already marked
{
visitedFaces.push_back(ee) ;
mark.markOrbit(FACE, ee) ;
mark.markOrbitInParent(FACE, ee) ;
}
e = phi1(e) ;
} while(e != *face) ;
}
// delete every visited face
for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
deleteCycle(*face);
Dart dd = phi3(d) ;
Map2::deleteCC(d) ;
Map2::deleteCC(dd) ;
}
/*! @name Topological Operators
......
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