Commit 62be2547 authored by Sylvain Thery's avatar Sylvain Thery

Merge cgogn:~untereiner/CGoGN

parents 6d8c1419 daa19158
......@@ -25,6 +25,8 @@
#ifndef __IMPORT_MR_DAT__
#define __IMPORT_MR_DAT__
#include "Topology/generic/autoAttributeHandler.h"
namespace CGoGN
{
......@@ -97,25 +99,31 @@ public:
unsigned int idx = emb == v0 ? 0 : emb == v1 ? 1 : 2 ;
map.incCurrentLevel() ;
Dart dd = map.phi1(next) ;
unsigned int oldEmb = map.template getEmbedding<VERTEX>(dd) ;
// unsigned int oldEmb = map.template getEmbedding<VERTEX>(dd) ;
unsigned int newEmb = vID[children[0]->indices[idx]] ;
if(oldEmb == EMBNULL)
{
// if(oldEmb == EMBNULL)
// {
//std::cout << "oldEmb == NULL"<< std::endl;
map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ;
map.pushLevel() ;
//needed because the darts are duplicated at each level
//and the vertex orbits are initialized at the creation of each level with wrong embedding indices
//map.pushLevel() ;
unsigned int cur = map.getCurrentLevel(); //necessary because IHM2 does not allow a Stack
for(unsigned int i = map.getCurrentLevel() + 1; i <= map.getMaxLevel(); ++i)
{
map.setCurrentLevel(i) ;
map.template setOrbitEmbedding<VERTEX>(dd, newEmb) ;
}
map.popLevel() ;
}
else
{
//std::cout << "oldEmb != NULL"<< std::endl;
assert(oldEmb == newEmb) ;
}
//map.popLevel() ;
map.setCurrentLevel(cur);
// }
// else
// {
// //std::cout << "oldEmb != NULL"<< std::endl;
// assert(oldEmb == newEmb) ;
// }
map.decCurrentLevel() ;
it = next ;
......
......@@ -30,6 +30,8 @@
#include "Topology/generic/traversor2.h"
#include "Algo/Multiresolution/filter.h"
#include "Algo/Import/importMRDAT.h"
#include <cmath>
......@@ -39,6 +41,9 @@ namespace CGoGN
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -77,14 +82,19 @@ public:
void synthesis() ;
void addLevelFront();
void import(Algo::Surface::Import::QuadTree& qt);
} ;
} // namespace Adaptive
} // namespace Regular
} // namespace Primal
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......
......@@ -22,12 +22,16 @@
* *
*******************************************************************************/
namespace CGoGN
{
namespace Algo
{
namespace Surface
{
namespace MR
{
......@@ -154,10 +158,8 @@ void IHM2<PFP>::addNewLevel(bool triQuad)
template <typename PFP>
void IHM2<PFP>::addLevelFront()
{
std::vector<Dart> irregVertices;
irregVertices.reserve(1024);
//look for an irregular vertex
//1. look for an irregular vertex
Dart irregVertex = NIL;
TraversorV<typename PFP::MAP> tv(m_map);
bool found = false;
......@@ -166,13 +168,13 @@ void IHM2<PFP>::addLevelFront()
if(m_map.vertexDegree(d) != 6)
{
found = true;
irregVertices.push_back(d);
irregVertex = d;
}
}
//found the number of levels
//2. found the number of levels
bool finished = false;
Dart dit = irregVertices[0];
Dart dit = irregVertex;
unsigned int nbSteps = 0;
do
{
......@@ -191,10 +193,11 @@ void IHM2<PFP>::addLevelFront()
nbSteps /= 2 ;
++nbLevel ;
}
m_map.setMaxLevel(nbLevel);
m_map.setMaxLevel(nbLevel);
std::cout << "nb levels = " << nbLevel+1 << std::endl;
//3. construct the topology of the differents levels
unsigned int curLevel = nbLevel;
do
......@@ -202,7 +205,9 @@ void IHM2<PFP>::addLevelFront()
m_map.setCurrentLevel(curLevel);
DartMarker md(m_map);
std::vector<Dart> visitedVertices(irregVertices);
std::vector<Dart> visitedVertices;
visitedVertices.reserve(1024);
visitedVertices.push_back(irregVertex);
std::cout << "getCurrentLevel = " << m_map.getCurrentLevel() << std::endl;
......@@ -240,7 +245,7 @@ void IHM2<PFP>::addLevelFront()
m_map.setDartLevel(m_map.phi2(fit3), curLevel);
m_map.setDartLevel(m_map.phi1(m_map.phi2(fit3)), curLevel);
if(curLevel == maxLevel)
if(curLevel == m_map.getMaxLevel())
{
unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1));
m_map.setEdgeId(m_map.phi2(fit1), id);
......@@ -256,31 +261,28 @@ void IHM2<PFP>::addLevelFront()
}
else
{
}
// if(curLevel == 2)
// {
// unsigned int id = m_map.getTriRefinementEdgeId(m_map.phi2(fit1));
// m_map.setEdgeId(m_map.phi2(fit1), id);
// m_map.setEdgeId(fit1, id);
//m_map.setEdgeId(fit1, id);
// /std::cout << "fit1 = " << fit1 << std::endl;
//std::cout << "m_map.phi2(fit1) = " << m_map.phi2(fit1) << std::endl;
// m_map.incCurrentLevel();
// m_map.setEdgeId(m_map.phi2(fit1), id);
// m_map.decCurrentLevel();
// id = m_map.getTriRefinementEdgeId(m_map.phi2(fit2));
// m_map.setEdgeId(m_map.phi2(fit2), id);
// m_map.setEdgeId(fit2, id);
//m_map.setEdgeId(fit2, id);
//std::cout << "fit2 = " << fit2 << std::endl;
//std::cout << "m_map.phi2(fit2) = " << m_map.phi2(fit2) << std::endl;
// m_map.incCurrentLevel();
// m_map.setEdgeId(m_map.phi2(fit2), id);
// m_map.decCurrentLevel();
// id = m_map.getTriRefinementEdgeId(m_map.phi2(fit3));
// m_map.setEdgeId(m_map.phi2(fit3), id);
// m_map.setEdgeId(fit3, id);
//m_map.setEdgeId(fit3, id);
//std::cout << "fit3 = " << fit3 << std::endl;
//std::cout << "m_map.phi2(fit3) = " << m_map.phi2(fit3) << std::endl;
// }
// m_map.incCurrentLevel();
// m_map.setEdgeId(m_map.phi2(fit3), id);
// m_map.decCurrentLevel();
}
}
}
}
......@@ -316,12 +318,33 @@ void IHM2<PFP>::synthesis()
m_map.incCurrentLevel() ;
}
template <typename PFP>
void IHM2<PFP>::import(Algo::Surface::Import::QuadTree& qt)
{
std::cout << " Create finer resolution levels.." << std::flush ;
for(unsigned int i = 0; i < qt.depth; ++i)
addNewLevel(true) ;
std::cout << "..done" << std::endl ;
std::cout << " Embed finer resolution levels.." << std::flush ;
m_map.setCurrentLevel(0) ;
qt.embed<PFP>(m_map) ;
m_map.setCurrentLevel(m_map.getMaxLevel()) ;
std::cout << "..done" << std::endl ;
}
} // namespace Regular
} // namespace Primal
} // namespace MR
} // namespace Surface
} // namespace Algo
} // namespace CGoGN
......@@ -310,7 +310,6 @@ void Map2MR<PFP>::addLevelFront()
Dart fit1 = m_map.phi2(m_map.phi1(d));
//m_map.mergeFaces(fit1) ;
// Traversor2VE<typename PFP::MAP> tve(m_map, d);
// for(Dart eit = tve.begin() ; eit != tve.end() ; eit = tve.next())
// {
......
......@@ -351,10 +351,13 @@ inline unsigned int ImplicitHierarchicalMap2::getTriRefinementEdgeId(Dart d)
else if(id == 1)
return 2;
else if(id == 2)
{
if(dId == eId)
return 0;
else
return 1;
}
//else if(id == 3)
return 0;
}
......@@ -370,11 +373,6 @@ inline unsigned int ImplicitHierarchicalMap2::getQuadRefinementEdgeId(Dart d)
return 0;
}
inline void ImplicitHierarchicalMap2::setTriRefinementEdgeId(Dart d)
{
}
/***************************************************
* CELLS INFORMATION *
***************************************************/
......
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