Commit c8834f1d authored by untereiner's avatar untereiner

Merge cgogn:~thery/CGoGN

parents 31d661f3 4e02ea52
......@@ -440,17 +440,17 @@ void computeCurvatureVertices_NormalCycles(
if (!map. template isOrbitEmbedded<VERTEX>())
{
CellMarkerNoUnmark<VERTEX> cm(map);
map. template initOrbitEmbedding<VERTEX>();
map. template initAllOrbitsEmbedding<VERTEX>();
}
if (!map. template isOrbitEmbedded<EDGE>())
{
CellMarkerNoUnmark<EDGE> cm(map);
map. template initOrbitEmbedding<EDGE>();
map. template initAllOrbitsEmbedding<EDGE>();
}
if (!map. template isOrbitEmbedded<FACE>())
{
CellMarkerNoUnmark<FACE> cm(map);
map. template initOrbitEmbedding<FACE>();
map. template initAllOrbitsEmbedding<FACE>();
}
FunctorComputeCurvatureVertices_NormalCycles<PFP> funct(map, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal);
......
......@@ -438,6 +438,14 @@ public:
template <unsigned int ORBIT>
void initCell(unsigned int i) ;
/**
* Traverse the map and embed all orbits of the given dimension with a new cell
* @param realloc if true -> all the orbits are embedded on new cells, if false -> already embedded orbits are not impacted
*/
template <unsigned int ORBIT>
void initAllOrbitsEmbedding(bool realloc = false) ;
/****************************************
* QUICK TRAVERSAL MANAGEMENT *
****************************************/
......
......@@ -397,12 +397,12 @@ inline void GenericMap::copyCell(Dart d, Dart e)
assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded");
unsigned int dE = getEmbedding<ORBIT>(d) ;
unsigned int eE = getEmbedding<ORBIT>(e) ;
// if(eE != EMBNULL) // if the source is NULL, nothing to copy
// {
// if(dE == EMBNULL) // if the dest is NULL, create a new cell
// dE = setOrbitEmbeddingOnNewCell<ORBIT>(d) ;
if(eE != EMBNULL) // if the source is NULL, nothing to copy
{
if(dE == EMBNULL) // if the dest is NULL, create a new cell
dE = setOrbitEmbeddingOnNewCell<ORBIT>(d) ;
m_attribs[ORBIT].copyLine(dE, eE) ; // copy the data
// }
}
}
template <unsigned int ORBIT>
......@@ -419,6 +419,23 @@ inline void GenericMap::initCell(unsigned int i)
m_attribs[ORBIT].initLine(i) ;
}
template <unsigned int ORBIT>
void GenericMap::initAllOrbitsEmbedding(bool realloc)
{
assert(isOrbitEmbedded<ORBIT>() || !"Invalid parameter: orbit not embedded") ;
DartMarker mark(*this) ;
for(Dart d = begin(); d != end(); next(d))
{
if(!mark.isMarked(d))
{
mark.markOrbit<ORBIT>(d) ;
if(realloc || getEmbedding<ORBIT>(d) == EMBNULL)
setOrbitEmbeddingOnNewCell<ORBIT>(d) ;
}
}
}
/****************************************
* QUICK TRAVERSAL MANAGEMENT *
****************************************/
......@@ -538,18 +555,9 @@ void GenericMap::addEmbedding()
AttributeMultiVector<unsigned int>* amv = dartCont.addAttribute<unsigned int>(oss.str()) ;
m_embeddings[ORBIT] = amv ;
FunctorInitEmb<GenericMap, ORBIT> fsetemb(*this);
DartMarker dm(*this);
for(Dart d = this->begin(); d != this->end(); this->next(d))
{
if(!dm.isMarked(d))
{
dm.markOrbit<ORBIT>(d);
unsigned int em = newCell<ORBIT>();
fsetemb.changeEmb(em);
foreach_dart_of_orbit<ORBIT>(d, fsetemb);
}
}
// set new embedding to EMBNULL for all the darts of the map
for(unsigned int i = dartCont.begin(); i < dartCont.end(); dartCont.next(i))
(*amv)[i] = EMBNULL ;
}
/****************************************
......
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
#ifndef __TRAVERSOR2_CLOSED_H__
#define __TRAVERSOR2_CLOSED_H__
#include "Topology/generic/dart.h"
#include "Topology/generic/traversorGen.h"
namespace CGoGN
{
namespace ClosedMap
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the edges incident to a given vertex
template <typename MAP>
class Traversor2VE: public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2VE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces incident to a given vertex
template <typename MAP>
class Traversor2VF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2VF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the vertices adjacent to a given vertex through sharing a common edge
template <typename MAP>
class Traversor2VVaE : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2VVaE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the vertices adjacent to a given vertex through sharing a common face
template <typename MAP>
class Traversor2VVaF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop ;
public:
Traversor2VVaF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
/*******************************************************************************
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the vertices incident to a given edge
template <typename MAP>
class Traversor2EV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2EV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces incident to a given edge
template <typename MAP>
class Traversor2EF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2EF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges adjacent to a given edge through sharing a common vertex
template <typename MAP>
class Traversor2EEaV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop1, stop2 ;
public:
Traversor2EEaV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges adjacent to a given edge through sharing a common face
template <typename MAP>
class Traversor2EEaF : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop1, stop2 ;
public:
Traversor2EEaF(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
/*******************************************************************************
FACE CENTERED TRAVERSALS
*******************************************************************************/
// Traverse the vertices incident to a given face
template <typename MAP>
class Traversor2FV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2FV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the edges incident to a given face (equivalent to vertices)
template <typename MAP>
class Traversor2FE: public Traversor2FV<MAP>
{
public:
Traversor2FE(MAP& map, Dart dart):Traversor2FV<MAP>(map,dart){}
} ;
// Traverse the faces adjacent to a given face through sharing a common vertex
template <typename MAP>
class Traversor2FFaV : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
Dart stop ;
public:
Traversor2FFaV(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
// Traverse the faces adjacent to a given face through sharing a common edge
template <typename MAP>
class Traversor2FFaE : public Traversor<MAP>
{
private:
MAP& m ;
Dart start ;
Dart current ;
public:
Traversor2FFaE(MAP& map, Dart dart) ;
Dart begin() ;
Dart end() ;
Dart next() ;
} ;
} // namespace ClosedMap
} // namespace CGoGN
#include "Topology/generic/traversor2_closed.hpp"
#endif
/*******************************************************************************
* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps *
* version 0.1 *
* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg *
* *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation; either version 2.1 of the License, or (at your *
* option) any later version. *
* *
* This library is distributed in the hope that it will be useful, but WITHOUT *
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or *
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License *
* for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
* *
* Web site: http://cgogn.unistra.fr/ *
* Contact information: cgogn@unistra.fr *
* *
*******************************************************************************/
namespace CGoGN
{
namespace ClosedMap
{
/*******************************************************************************
VERTEX CENTERED TRAVERSALS
*******************************************************************************/
// Traversor2VE
template <typename MAP>
Traversor2VE<MAP>::Traversor2VE(MAP& map, Dart dart) : m(map), start(dart)
{}
template <typename MAP>
Dart Traversor2VE<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VE<MAP>::next()
{
if(current != NIL)
{
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2VF
template <typename MAP>
Traversor2VF<MAP>::Traversor2VF(MAP& map, Dart dart) : m(map), start(dart)
{
}
template <typename MAP>
Dart Traversor2VF<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VF<MAP>::next()
{
if(current != NIL)
{
current = m.phi2(m.phi_1(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2VVaE
template <typename MAP>
Traversor2VVaE<MAP>::Traversor2VVaE(MAP& map, Dart dart) : m(map)
{
start = m.phi2(dart) ;
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VVaE<MAP>::next()
{
if(current != NIL)
{
current = m.phi_1(m.phi2(current)) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2VVaF
template <typename MAP>
Traversor2VVaF<MAP>::Traversor2VVaF(MAP& map, Dart dart) : m(map)
{
if(m.isBoundaryMarked(dart))
dart = m.phi2(m.phi_1(dart)) ;
start = m.phi1(m.phi1(dart)) ;
if(start == dart)
start = m.phi1(dart) ;
stop = dart ;
}
template <typename MAP>
Dart Traversor2VVaF<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2VVaF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2VVaF<MAP>::next()
{
if(current != NIL)
{
current = m.phi1(current) ;
if(current == stop)
{
Dart d = m.phi2(m.phi_1(current)) ;
current = m.phi1(m.phi1(d)) ;
if(current == d)
current = m.phi1(d) ;
stop = d ;
}
if(current == start)
current = NIL ;
}
return current ;
}
/*******************************************************************************
EDGE CENTERED TRAVERSALS
*******************************************************************************/
// Traversor2EV
template <typename MAP>
Traversor2EV<MAP>::Traversor2EV(MAP& map, Dart dart) : m(map), start(dart)
{}
template <typename MAP>
Dart Traversor2EV<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2EV<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2EV<MAP>::next()
{
if(current != NIL)
{
current = m.phi2(current) ;
if(current == start)
current = NIL ;
}
return current ;
}
// Traversor2EF
template <typename MAP>
Traversor2EF<MAP>::Traversor2EF(MAP& map, Dart dart) : m(map), start(dart)
{
}
template <typename MAP>
Dart Traversor2EF<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2EF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2EF<MAP>::next()
{
if(current != NIL)
{
current = m.phi2(current) ;
if(current == start) // do not consider a boundary face
current = NIL ;
}
return current ;
}
// Traversor2EEaV
template <typename MAP>
Traversor2EEaV<MAP>::Traversor2EEaV(MAP& map, Dart dart) : m(map)
{
start = m.phi2(m.phi_1(dart)) ;
stop1 = dart ;
stop2 = m.phi2(dart) ;
}
template <typename MAP>
Dart Traversor2EEaV<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2EEaV<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2EEaV<MAP>::next()
{
if(current != NIL)
{
current = m.phi2(m.phi_1(current)) ;
if(current == stop1)
current = m.phi2(m.phi_1(stop2)) ;
else if(current == stop2)
current = NIL ;
}
return current ;
}
// Traversor2EEaF
template <typename MAP>
Traversor2EEaF<MAP>::Traversor2EEaF(MAP& map, Dart dart) : m(map)
{
start = m.phi1(dart) ;
stop1 = dart ;
stop2 = m.phi2(dart) ;
}
template <typename MAP>
Dart Traversor2EEaF<MAP>::begin()
{
current = start ;
return current ;
}
template <typename MAP>
Dart Traversor2EEaF<MAP>::end()
{
return NIL ;
}
template <typename MAP>
Dart Traversor2EEaF<MAP>::next()
{
if(current != NIL)
{
current = m.phi1(current) ;
if(current == stop1)
current = m.phi1(stop2) ;
else if(current == stop2)
current = NIL ;
}
return current ;
}