Commit 1344b138 authored by untereiner's avatar untereiner

qq modifs

parent a8ccbe42
...@@ -81,23 +81,17 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP ...@@ -81,23 +81,17 @@ void subdivideFace(typename PFP::MAP& map, Dart d, AttributeHandler<typename PFP
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
// unsigned int vLevel = map.volumeLevel(old); unsigned int vLevel = map.volumeLevel(old);
// //one level of subdivision in the neighbordhood //one level of subdivision in the neighbordhood
// Traversor3VW<typename PFP::MAP> trav3EW(map, old); // Traversor3VW<typename PFP::MAP> trav3EW(map, old);
// for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next()) // for(Dart dit = trav3EW.begin() ; dit != trav3EW.end() ; dit = trav3EW.next())
// { // {
// Dart oldit = map.volumeOldestDart(dit); // Dart oldit = map.volumeOldestDart(dit);
// if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
// Algo::IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
// //
//// Dart oldNeighbor = map.volumeOldestDart(map.phi3(old)); // //std::cout << "vLevel courant = " << map.volumeLevel(oldit) << std::endl;
//// unsigned int vLevel = map.volumeLevel(oldNeighbor); //
//// // if(((vLevel+1) - map.volumeLevel(oldit)) > 1)
//// std::cout << "vLevel courant = " << map.volumeLevel(old) << std::endl; // Algo::IHM::subdivideVolumeClassic<PFP>(map, oldit, position);
//// std::cout << "vLevel voisin = " << vLevel << std::endl;
////
//// if((map.volumeLevel(old)+1) - (vLevel) > 1)
//// Algo::IHM::subdivideVolumeClassic<PFP>(map, oldNeighbor, position);
// } // }
unsigned int degree = 0 ; unsigned int degree = 0 ;
......
...@@ -569,88 +569,92 @@ void swap5To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3 ...@@ -569,88 +569,92 @@ void swap5To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3
* Flip Functions * * Flip Functions *
************************************************************************************************/ ************************************************************************************************/
template <typename PFP> template <typename PFP>
void flip1To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position) void flip1To4(typename PFP::MAP& map, Dart d, VertexAttribute<typename PFP::VEC3>& position)
{ {
// typedef typename PFP::TVEC3 TVEC3; typedef typename PFP::VEC3 VEC3;
// typedef typename PFP::VEC3 VEC3;
//
// //parcourir le tetra est sauvegarder un brin de chaque face + calcul du centroid
// //parcourir le tetra est sauvegarder un brin de chaque face + calcul du centroid VEC3 volCenter;
// VEC3 volCenter; unsigned count = 0 ;
// unsigned count = 0 ;
// DartMarkerStore mf(map); // Lock a face marker to save one dart per face
// DartMarkerStore mf(map); // Lock a face marker to save one dart per face DartMarkerStore mv(map); // Lock a vertex marker to compute volume center
// DartMarkerStore mv(map); // Lock a vertex marker to compute volume center
// std::vector<Dart> visitedFaces;
// std::vector<Dart> visitedFaces; visitedFaces.reserve(4);
// visitedFaces.reserve(4); visitedFaces.push_back(d);
// visitedFaces.push_back(d);
// mf.markOrbit<FACE>(d) ;
// mf.markOrbit<FACE>(d) ;
// //TODO diminuer complexite avec boucle specifique aux tetras
// //TODO diminuer complexite avec boucle specifique aux tetras for(unsigned int i = 0; i < visitedFaces.size(); ++i)
// for(unsigned int i = 0; i < visitedFaces.size(); ++i) {
// { Dart e = visitedFaces[i] ;
// Dart e = visitedFaces[i] ; do
// do {
// { //compute volume centroid
// //compute volume centroid if(!mv.isMarked(e))
// if(!mv.isMarked(e)) {
// { volCenter += position[e];
// volCenter += position[e]; ++count;
// ++count; mv.markOrbit<VERTEX>(e);
// mv.markOrbit<VERTEX>(e); }
// }
// // add all face neighbours to the table
// // add all face neighbours to the table Dart ee = map.phi2(e) ;
// Dart ee = map.phi2(e) ; if(!mf.isMarked(ee)) // not already marked
// if(!mf.isMarked(ee)) // not already marked {
// { visitedFaces.push_back(ee) ;
// visitedFaces.push_back(ee) ; mf.markOrbit<FACE>(ee) ;
// mf.markOrbit<FACE>(ee) ; }
// }
// e = map.phi1(e) ;
// e = map.phi1(e) ; } while(e != visitedFaces[i]) ;
// } while(e != visitedFaces[i]) ; }
// }
// volCenter /= typename PFP::REAL(count) ;
// volCenter /= typename PFP::REAL(count) ;
// //store the new faces to 3-sew
// //store the new faces to 3-sew std::vector<std::pair<Dart,Dart> > nFaces;
// std::vector<std::pair<Dart,Dart> > nFaces; nFaces.reserve(6);
// nFaces.reserve(6);
// //triangule chaque face avec plongement au centroid
// //triangule chaque face avec plongement au centroid for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
// for (std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face) {
// { // on decoud et on ferme le trou
// // on decoud et on ferme le trou Dart temp = *face;
// Dart temp = *face; do
// do {
// { nFaces.push_back(std::pair<Dart,Dart>(temp, map.phi2(temp)));
// nFaces.push_back(std::pair<Dart,Dart>(temp, map.phi2(temp))); map.unsewFaces(temp);
// map.unsewFaces(temp); temp = map.phi1(temp);
// temp = map.phi1(temp); }
// } while(temp != *face);
// while(temp != *face);
// map.PFP::MAP::ParentMap::closeHole(*face);
// map.closeHole(*face);
// Dart fi = map.phi2(*face);
// Dart fi = map.phi2(*face);
// Dart cd = Algo::Modelisation::trianguleFace<PFP>(map, fi);
// Dart cd = Algo::Modelisation::trianguleFace<PFP>(map, fi); position[cd] = volCenter;
// position[cd] = volCenter; }
// }
// //coudre les nouveaux brins entre eux par phi3
// //coudre les nouveaux brins entre eux par phi3 for (std::vector<std::pair<Dart,Dart> >::iterator face =nFaces.begin(); face != nFaces.end(); ++face)
// for (std::vector<std::pair<Dart,Dart> >::iterator face =nFaces.begin(); face != nFaces.end(); ++face) {
// {
// if(map.phi3(map.phi2((*face).first)) == map.phi2((*face).first))
// if(map.phi3(map.phi2((*face).first)) == map.phi2((*face).first)) map.sewVolumes(map.phi2((*face).first), map.phi2((*face).second));
// map.sewVolumes(map.phi2((*face).first), map.phi2((*face).second)); }
// }
} }
/************************************************************************************************ /************************************************************************************************
* Bisection Functions * * Bisection Functions *
************************************************************************************************/ ************************************************************************************************/
......
...@@ -57,14 +57,9 @@ public: ...@@ -57,14 +57,9 @@ public:
private: private:
MAP& m_map ; MAP& m_map ;
VertexAttribute<VEC3>& m_position; VertexAttribute<VEC3>& m_position;
bool shareVertexEmbeddings ;
//SelectorUnmarked dartSelect ;
bool m_initOk ; bool m_initOk ;
DartMarker& inactiveMarker;
Algo::Decimation::EdgeSelector<PFP>* m_selector ; Algo::Decimation::EdgeSelector<PFP>* m_selector ;
std::vector<Algo::Decimation::ApproximatorGen<PFP>*> m_approximators ; std::vector<Algo::Decimation::ApproximatorGen<PFP>*> m_approximators ;
std::vector<Algo::Decimation::PredictorGen<PFP>*> m_predictors ; std::vector<Algo::Decimation::PredictorGen<PFP>*> m_predictors ;
...@@ -72,13 +67,14 @@ private: ...@@ -72,13 +67,14 @@ private:
Algo::Decimation::Approximator<PFP, VEC3>* m_positionApproximator ; Algo::Decimation::Approximator<PFP, VEC3>* m_positionApproximator ;
public: public:
Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker& inactive, Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position);
Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a) ;
~Map2MR_PM(); ~Map2MR_PM();
//create a progressive mesh (a coarser level) //create a progressive mesh (a coarser level)
void createPM(unsigned int percentWantedVertices); void createPM(Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, const FunctorSelect& select = allDarts) ;
void addNewLevel(unsigned int percentWantedVertices);
//coarsen the mesh -> analysis //coarsen the mesh -> analysis
void coarsen() ; void coarsen() ;
......
...@@ -33,10 +33,28 @@ namespace Multiresolution ...@@ -33,10 +33,28 @@ namespace Multiresolution
{ {
template <typename PFP> template <typename PFP>
Map2MR_PM<PFP>::Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker& inactive, Map2MR_PM<PFP>::Map2MR_PM(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position) : m_map(map), m_position(position)
Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a {
) : //TODO
m_map(map), m_position(position), inactiveMarker(inactive) //map.enableMR();
}
template <typename PFP>
Map2MR_PM<PFP>::~Map2MR_PM()
{
if(m_selector)
delete m_selector ;
for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
delete (*it) ;
for(typename std::vector<Algo::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
delete (*it) ;
//TODO
//map.disableMR()
}
template <typename PFP>
void Map2MR_PM<PFP>::createPM(Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a, const FunctorSelect& select = allDarts)
{ {
CGoGNout << " creating approximator and predictor.." << CGoGNflush ; CGoGNout << " creating approximator and predictor.." << CGoGNflush ;
...@@ -75,22 +93,22 @@ Map2MR_PM<PFP>::Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker& ...@@ -75,22 +93,22 @@ Map2MR_PM<PFP>::Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker&
switch(s) switch(s)
{ {
case Algo::Decimation::S_MapOrder : { case Algo::Decimation::S_MapOrder : {
m_selector = new Algo::Decimation::EdgeSelector_MapOrder<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_MapOrder<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
case Algo::Decimation::S_Random : { case Algo::Decimation::S_Random : {
m_selector = new Algo::Decimation::EdgeSelector_Random<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_Random<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
case Algo::Decimation::S_EdgeLength : { case Algo::Decimation::S_EdgeLength : {
m_selector = new Algo::Decimation::EdgeSelector_Length<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_Length<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
case Algo::Decimation::S_QEM : { case Algo::Decimation::S_QEM : {
m_selector = new Algo::Decimation::EdgeSelector_QEM<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_QEM<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
case Algo::Decimation::S_MinDetail : { case Algo::Decimation::S_MinDetail : {
m_selector = new Algo::Decimation::EdgeSelector_MinDetail<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_MinDetail<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
case Algo::Decimation::S_Curvature : { case Algo::Decimation::S_Curvature : {
m_selector = new Algo::Decimation::EdgeSelector_Curvature<PFP>(m_map, m_position, m_approximators, allDarts) ; m_selector = new Algo::Decimation::EdgeSelector_Curvature<PFP>(m_map, m_position, m_approximators, select) ;
break ; } break ; }
} }
CGoGNout << "..done" << CGoGNendl ; CGoGNout << "..done" << CGoGNendl ;
...@@ -112,32 +130,22 @@ Map2MR_PM<PFP>::Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker& ...@@ -112,32 +130,22 @@ Map2MR_PM<PFP>::Map2MR_PM(MAP& map, VertexAttribute<VEC3>& position, DartMarker&
if(! (*it)->init()) if(! (*it)->init())
m_initOk = false ; m_initOk = false ;
CGoGNout << "..done" << CGoGNendl ; CGoGNout << "..done" << CGoGNendl ;
}
template <typename PFP> CGoGNout << " initializing selector.." << CGoGNflush ;
Map2MR_PM<PFP>::~Map2MR_PM() m_initOk = m_selector->init() ;
{ CGoGNout << "..done" << CGoGNendl ;
if(m_selector)
delete m_selector ;
for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
delete (*it) ;
for(typename std::vector<Algo::Decimation::PredictorGen<PFP>*>::iterator it = m_predictors.begin(); it != m_predictors.end(); ++it)
delete (*it) ;
} }
template <typename PFP> template <typename PFP>
void Map2MR_PM<PFP>::createPM(unsigned int percentWantedVertices) void Map2MR_PM<PFP>::addNewLevel(unsigned int percentWantedVertices)
{ {
// level handling // level handling
m_map.pushLevel() ; m_map.pushLevel() ;
m_map.addLevel(); m_map.addLevel();
m_map.setCurrentLevel(m_map.getMaxLevel()) ; m_map.setCurrentLevel(m_map.getMaxLevel()) ;
// PM creation
CGoGNout << " initializing selector.." << CGoGNflush ;
m_initOk = m_selector->init() ;
CGoGNout << "..done" << CGoGNendl ;
unsigned int nbVertices = m_map.template getNbOrbits<VERTEX>() ; unsigned int nbVertices = m_map.template getNbOrbits<VERTEX>() ;
unsigned int nbWantedVertices = nbVertices * percentWantedVertices / 100 ; unsigned int nbWantedVertices = nbVertices * percentWantedVertices / 100 ;
CGoGNout << " creating PM (" << nbVertices << " vertices).." << /* flush */ CGoGNendl ; CGoGNout << " creating PM (" << nbVertices << " vertices).." << /* flush */ CGoGNendl ;
...@@ -153,6 +161,8 @@ void Map2MR_PM<PFP>::createPM(unsigned int percentWantedVertices) ...@@ -153,6 +161,8 @@ void Map2MR_PM<PFP>::createPM(unsigned int percentWantedVertices)
Dart d2 = m_map.phi2(m_map.phi_1(d)) ; Dart d2 = m_map.phi2(m_map.phi_1(d)) ;
Dart dd2 = m_map.phi2(m_map.phi_1(m_map.phi2(d))) ; Dart dd2 = m_map.phi2(m_map.phi_1(m_map.phi2(d))) ;
for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it) for(typename std::vector<Algo::Decimation::ApproximatorGen<PFP>*>::iterator it = m_approximators.begin(); it != m_approximators.end(); ++it)
{ {
(*it)->approximate(d) ; // compute approximated attributes with its associated detail (*it)->approximate(d) ; // compute approximated attributes with its associated detail
......
...@@ -77,6 +77,12 @@ public: ...@@ -77,6 +77,12 @@ public:
* *
*************************************************************************/ *************************************************************************/
//@{ //@{
//!
/*
*
*/
void addNewLevelSqrt3(bool embedNewVertices);
//! //!
/* /*
*/ */
......
...@@ -103,6 +103,69 @@ void Map3MR_PrimalRegular<PFP>::splitSurfaceInVolume(std::vector<Dart>& vd, bool ...@@ -103,6 +103,69 @@ void Map3MR_PrimalRegular<PFP>::splitSurfaceInVolume(std::vector<Dart>& vd, bool
/************************************************************************ /************************************************************************
* Level creation * * Level creation *
************************************************************************/ ************************************************************************/
template <typename PFP>
void Map3MR_PrimalRegular<PFP>::addNewLevelSqrt3(bool embedNewVertices)
{
m_map.pushLevel();
m_map.addLevel();
//m_map.setCurrentLevel(m_map.getMaxLevel());
unsigned int cur = m_map.getCurrentLevel();
//
TraversorW<typename PFP::MAP> travW(m_map);
for(Dart dit = travW.begin() ; dit != travW.end() ; dit = travW.next())
{
m_map.setCurrentLevel(cur+1);
//store the new faces to 3-sew
std::vector<std::pair<Dart,Dart> > nFaces;
nFaces.reserve(6);
Traversor3WF<typename PFP::MAP> travWF(m_map, dit);
for(Dart ditWF = travWF.begin() ; ditWF != travWF.end() ; ditWF = travWF.next())
{
// Dart temp = ditWF;
// do
// {
// nFaces.push_back(std::pair<Dart,Dart>(temp, m_map.phi2(temp)));
// m_map.unsewFaces(temp);
// temp = m_map.phi1(temp);
// }
// while(temp != ditWF);
//
// m_map.PFP::MAP::ParentMap::closeHole(ditWF, false);
//Dart fi = map.phi2(*face);
// std::vector<Dart> split;
// split.push_back(ditWF);
// split.push_back(m_map.phi1(ditWF));
// split.push_back(m_map.phi_1(ditWF));
//
// splitSurfaceInVolume(split,true,false);
}
//Dart fi = map.phi2(*face);
// //coudre les nouveaux brins entre eux par phi3
// for (std::vector<std::pair<Dart,Dart> >::iterator face =nFaces.begin(); face != nFaces.end(); ++face)
// {
//
// if(map.phi3(map.phi2((*face).first)) == map.phi2((*face).first))
// map.sewVolumes(map.phi2((*face).first), map.phi2((*face).second));
// }
//
m_map.setCurrentLevel(cur);
}
m_map.setCurrentLevel(m_map.getMaxLevel());
}
template <typename PFP> template <typename PFP>
void Map3MR_PrimalRegular<PFP>::addNewLevelTetraOcta(bool embedNewVertices) void Map3MR_PrimalRegular<PFP>::addNewLevelTetraOcta(bool embedNewVertices)
{ {
......
...@@ -728,10 +728,13 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersMoreThanOne(Dart d) ...@@ -728,10 +728,13 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersMoreThanOne(Dart d)
unsigned int vLevel = volumeLevel(d); unsigned int vLevel = volumeLevel(d);
bool isMoreThanOne = false; bool isMoreThanOne = false;
// std::cout << "niveau du courant : " << vLevel << std::endl;
Traversor3WWaV<ImplicitHierarchicalMap3> trav3WWaV(*this, d); Traversor3WWaV<ImplicitHierarchicalMap3> trav3WWaV(*this, d);
for(Dart dit = trav3WWaV.begin() ; !isMoreThanOne && dit != trav3WWaV.end() ; dit = trav3WWaV.next()) for(Dart dit = trav3WWaV.begin() ; !isMoreThanOne && dit != trav3WWaV.end() ; dit = trav3WWaV.next())
{ {
//Dart oldit = volumeOldestDart(dit); //Dart oldit = volumeOldestDart(dit);
// std::cout << "niveau du voisin : " << volumeLevel(dit) << std::endl;
// std::cout << "difference de niveau avec voisin : " << abs((volumeLevel(dit) - vLevel)) << std::endl;
if(abs((volumeLevel(dit) - vLevel)) > 1) if(abs((volumeLevel(dit) - vLevel)) > 1)
isMoreThanOne = true; isMoreThanOne = true;
} }
...@@ -751,18 +754,21 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersMoreThanOne(Dart d) ...@@ -751,18 +754,21 @@ bool ImplicitHierarchicalMap3::neighborhoodLevelDiffersMoreThanOne(Dart d)
bool ImplicitHierarchicalMap3::coarsenNeighborhoodLevelDiffersMoreThanOne(Dart d) bool ImplicitHierarchicalMap3::coarsenNeighborhoodLevelDiffersMoreThanOne(Dart d)
{ {
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ; assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
//assert(m_curLevel > 0 || !"Coarsen a volume at level 0"); // assert(m_curLevel > 0 || !"Coarsen a volume at level 0");
Dart old = volumeOldestDart(d); unsigned int vLevel = volumeLevel(d)-1;
bool isMoreThanOne = false; bool isMoreThanOne = false;
// if(m_curLevel > 0) // std::cout << "niveau du courant : " << vLevel << std::endl;
// --m_curLevel; Traversor3WWaV<ImplicitHierarchicalMap3> trav3WWaV(*this, d);
for(Dart dit = trav3WWaV.begin() ; !isMoreThanOne && dit != trav3WWaV.end() ; dit = trav3WWaV.next())
isMoreThanOne = neighborhoodLevelDiffersMoreThanOne(old); {
//Dart oldit = volumeOldestDart(dit);
// if(m_curLevel > 0) // std::cout << "niveau du voisin : " << volumeLevel(dit) << std::endl;
// ++m_curLevel; // std::cout << "difference de niveau avec voisin : " << abs((volumeLevel(dit) - vLevel)) << std::endl;
if(abs((volumeLevel(dit) - vLevel)) > 1)
isMoreThanOne = true;
}
return isMoreThanOne; return isMoreThanOne;
......
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