Commit e0942ffc authored by Pierre Kraemer's avatar Pierre Kraemer

boolean to chose to share vertex embeddings

parent 03b5d009
......@@ -32,23 +32,12 @@ namespace CGoGN
class Map2MR_Primal : public EmbeddedMap2
{
protected:
bool shareVertexEmbeddings ;
public:
Map2MR_Primal() ;
void copyVertexEmbeddings()
{
unsigned int maxL = getMaxLevel() ;
for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
{
unsigned int previdx = (*m_mrDarts[maxL - 1])[i] ;
unsigned int newidx = (*m_mrDarts[maxL])[i] ;
unsigned int emb = (*m_embeddings[VERTEX])[previdx] ;
(*m_embeddings[VERTEX])[newidx] = emb ;
if(emb != EMBNULL)
m_attribs[VERTEX].refLine(emb);
}
}
/***************************************************
* CELLS INFORMATION *
***************************************************/
......@@ -106,10 +95,21 @@ public:
*/
bool faceIsSubdividedOnce(Dart d) ;
/***************************************************
* EMBEDDINGS MANAGEMENT *
***************************************************/
void copyVertexEmbeddings() ;
/***************************************************
* SUBDIVISION *
***************************************************/
/**
* add a new resolution level
*/
void addNewLevel() ;
/**
* subdivide the edge of d to the next level
*/
......
......@@ -27,7 +27,7 @@
namespace CGoGN
{
Map2MR_Primal::Map2MR_Primal()
Map2MR_Primal::Map2MR_Primal() : shareVertexEmbeddings(true)
{
initMR() ;
}
......@@ -248,10 +248,35 @@ bool Map2MR_Primal::faceIsSubdividedOnce(Dart d)
return false ;
}
/***************************************************
* EMBEDDINGS MANAGEMENT *
***************************************************/
void Map2MR_Primal::copyVertexEmbeddings()
{
unsigned int maxL = getMaxLevel() ;
for(unsigned int i = m_mrattribs.begin(); i != m_mrattribs.end(); m_mrattribs.next(i))
{
unsigned int previdx = (*m_mrDarts[maxL - 1])[i] ;
unsigned int newidx = (*m_mrDarts[maxL])[i] ;
unsigned int emb = (*m_embeddings[VERTEX])[previdx] ;
(*m_embeddings[VERTEX])[newidx] = emb ;
if(emb != EMBNULL)
m_attribs[VERTEX].refLine(emb);
}
}
/***************************************************
* SUBDIVISION *
***************************************************/
void Map2MR_Primal::addNewLevel()
{
addLevel() ;
if(shareVertexEmbeddings)
copyVertexEmbeddings() ;
}
void Map2MR_Primal::subdivideEdge(Dart d)
{
assert(getDartLevel(d) <= getCurrentLevel() || !"subdivideEdge : called with a dart introduced after current level") ;
......@@ -262,10 +287,7 @@ void Map2MR_Primal::subdivideEdge(Dart d)
pushLevel() ;
if(eLevel == getMaxLevel())
{
addLevel() ;
copyVertexEmbeddings() ;
}
addNewLevel() ;
setCurrentLevel(eLevel + 1) ;
cutEdge(d) ;
......
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