Commit 4d495942 authored by untereiner's avatar untereiner

ajout de la fonction coarsenNeighborhoodLevelDiffersByOne ...

parent fd210c16
......@@ -274,6 +274,10 @@ public:
*/
bool neighborhoodLevelDiffersByOne(Dart d);
/**
* wired !!!
*/
bool coarsenNeighborhoodLevelDiffersByOne(Dart d);
} ;
template <typename T>
......
......@@ -244,7 +244,7 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_vertex(Dart d, FunctorType
bool found = false; // Last functor return value
std::vector<Dart> darts_list; //Darts that are traversed
darts_list.reserve(50);
darts_list.reserve(512);
darts_list.push_back(d); //Start with the dart d
mv.mark(d);
......@@ -288,11 +288,8 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_edge(Dart d, FunctorType&
if (f(dNext))
return true;
Dart d2 = phi2(dNext);
if (d2 != dNext)
return f(d2);
else
return false;
if (f(phi2(dNext)))
return true;
dNext = alpha2(dNext);
} while (dNext != d);
......
......@@ -41,11 +41,15 @@ enum SubdivideType
S_QUAD
} ;
/***********************************************************************************
* Subdivision *
***********************************************************************************/
template <typename PFP>
void subdivideEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position) ;
template <typename PFP>
void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
void subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position, SubdivideType sType = S_TRI);
template <typename PFP>
Dart subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
......@@ -54,16 +58,18 @@ template <typename PFP>
Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
Dart subdivideVolumeOld(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
//template <typename PFP>
//void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
/***********************************************************************************
* Simplification *
***********************************************************************************/
template <typename PFP>
void coarsenEdge(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
void coarsenFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position, SubdivideType sType = S_TRI);
template <typename PFP>
void coarsenVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
......@@ -77,27 +83,7 @@ void coarsenVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
template <typename PFP>
void splitVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
/*******************************************************
*
*/
template <typename PFP>
void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position, SubdivideType sType);
template <typename PFP>
Dart subdivideFaceTri(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
void subdivideVolumeTri(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
void macCrackenJoy(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
void bajaj(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
template <typename PFP>
typename PFP::VEC3 bajajMask(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position);
} //namespace IHM
......
......@@ -222,7 +222,7 @@ public:
* @param d a dart in the first face
* @param e a dart in the second face
*/
virtual void mergeFaces(Dart d, Dart e);
virtual bool mergeFaces(Dart d, Dart e);
//!
/*!
......
......@@ -397,7 +397,7 @@ bool ImplicitHierarchicalMap3::volumeIsSubdivided(Dart d)
DartMarkerStore mark(*this); // Lock a marker
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(16);
visitedFaces.reserve(512);
visitedFaces.push_back(d); // Start with the face of d
std::vector<Dart>::iterator face;
......@@ -455,6 +455,8 @@ bool ImplicitHierarchicalMap3::edgeCanBeCoarsened(Dart d)
Dart d2 = phi2(d) ;
++m_curLevel ;
std::cout << "vertex degree = " << vertexDegree(phi1(d)) << std::endl;
if(vertexDegree(phi1(d)) == 2)
{
degree2 = true ;
......@@ -553,6 +555,7 @@ bool ImplicitHierarchicalMap3::faceIsSubdividedOnce(Dart d)
bool ImplicitHierarchicalMap3:: volumeIsSubdividedOnce(Dart d)
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
return true;
}
......@@ -563,7 +566,7 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
bool found = false;
unsigned int vLevel = volumeLevel(d) + 1;
unsigned int vLevel = volumeLevel(d);// + 1;
Dart old = volumeOldestDart(d);
......@@ -571,7 +574,7 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
//Store faces that are traversed and start with the face of d
std::vector<Dart> visitedFaces;
visitedFaces.reserve(20);
visitedFaces.reserve(512);
visitedFaces.push_back(old);
mf.markOrbit(FACE, old) ;
......@@ -586,7 +589,8 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
if(phi3(e) != e)
{
Dart old = volumeOldestDart(phi3(e));
if((abs(volumeLevel(old) - vLevel) > 1))
//if((abs(volumeLevel(old) - vLevel) > 1))
if(volumeLevel(old) < vLevel)
found = true;
}
......@@ -604,6 +608,55 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersByOne(Dart d)
return found;
}
bool ImplicitHierarchicalMap3::coarsenNeighborhoodLevelDiffersByOne(Dart d)
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
bool found = false;
//unsigned int vLevel = volumeLevel(d);
Dart old = volumeOldestDart(d);
DartMarkerStore mf(*this); // Lock a face marker to save one dart per face
//Store faces that are traversed and start with the face of d
std::vector<Dart> visitedFaces;
visitedFaces.reserve(512);
visitedFaces.push_back(old);
mf.markOrbit(FACE, old) ;
for(std::vector<Dart>::iterator face = visitedFaces.begin(); !found && face != visitedFaces.end(); ++face)
{
Dart e = *face ;
do
{
// add all face neighbours to the table
if(faceIsSubdivided(e))
{
++m_curLevel;
if(faceIsSubdividedOnce(e))
found = true;
--m_curLevel;
}
Dart ee = phi2(e) ;
if(!mf.isMarked(ee)) // not already marked
{
visitedFaces.push_back(ee) ;
mf.markOrbit(FACE, ee) ;
}
e = phi1(e) ;
} while(e != *face) ;
}
return found;
}
} //namespace IHM
} //namespace Algo
......
......@@ -41,7 +41,7 @@ void Map3::deleteOrientedVolume(Dart d)
DartMarkerStore mark(*this); // Lock a marker
std::vector<Dart> visitedFaces; // Faces that are traversed
visitedFaces.reserve(16);
visitedFaces.reserve(512);
visitedFaces.push_back(d); // Start with the face of d
// // For every face added to the list
......@@ -207,14 +207,15 @@ bool Map3::deleteVertex(Dart d)
{
DartMarkerStore mv(*this); // Lock a marker
std::list<Dart> darts_list; //Darts that are traversed
std::vector<Dart> darts_list; //Darts that are traversed
darts_list.reserve(512);
darts_list.push_back(d); //Start with the dart d
std::list<Dart>::iterator darts;
std::vector<Dart>::iterator darts;
mv.mark(d);
std::list<Dart> unique_darts_list;
//unique_darts_list.reserve(30);
std::vector<Dart> unique_darts_list;
unique_darts_list.reserve(512);
unique_darts_list.push_back(d);
......@@ -546,10 +547,11 @@ void Map3::collapseVolume(Dart d, bool delDegenerateFaces,
//contracter toutes les faces de la liste
}
//TODO
void Map3::mergeFaces(Dart d, Dart e)
bool Map3::mergeFaces(Dart d, Dart e)
{
}
Dart Map3::cutSpike(Dart d)
......@@ -663,8 +665,6 @@ unsigned int Map3::vertexDegree(Dart d)
}
}
std::cout << "#darts = " << darts.size() << std::endl;
DartMarkerStore me(*this);
for(std::vector<Dart>::iterator it = darts.begin(); it != darts.end() ; ++it)
......@@ -810,7 +810,6 @@ bool Map3::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread)
bool Map3::foreach_dart_of_open_edge(Dart d, FunctorType& f, unsigned int thread)
{
DartMarkerStore mv(*this,thread); // Lock a marker
bool found = false; // Last functor return value
......
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