Commit 972f331f authored by Jund Thomas's avatar Jund Thomas

Merge cgogn.unistra.fr:~thery/CGoGN

parents e4bfd421 01ef1b3d
......@@ -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);
......
......@@ -26,8 +26,6 @@
#include "Topology/generic/dartmarker.h"
#include <vector>
#include "Algo/Modelisation/boundEmb.h"
namespace CGoGN
{
......@@ -119,9 +117,7 @@ void MarchingCube<DataType, Windowing, PFP>::deleteMesh()
template< typename DataType, template < typename D2 > class Windowing, typename PFP >
Dart MarchingCube<DataType, Windowing, PFP>::createTriEmb(unsigned int e1, unsigned int e2, unsigned int e3)
{
// L_DART d = m_map->newFace(3,false);
L_DART d = Modelisation::newFaceEmb<PFP>(*m_map,3);
L_DART d = m_map->newFace(3,false);
FunctorSetEmb<GenericMap, VERTEX> fsetemb(*m_map, e1);
m_map->template foreach_dart_of_orbit<PFP::MAP::VERTEX_OF_PARENT>(d, fsetemb);
......@@ -926,9 +922,7 @@ void MarchingCube<DataType, Windowing, PFP>::setNeighbourSimple(L_DART d1, L_DAR
{
if (m_map->phi2(d1) != d2)
{
// m_map->sewFaces(d1,d2,false);
Modelisation::sewFaceEmb<PFP>(*m_map,d1,d2);
m_map->sewFaces(d1,d2,false);
#ifdef MC_WIDTH_EDGE_Z_EMBEDED
if (m_zslice!=NULL)
{
......@@ -945,9 +939,7 @@ void MarchingCube<DataType, Windowing, PFP>::setNeighbour(L_DART d1, L_DART d2)
{
if (m_map->phi2(d1) != d2)
{
// m_map->sewFaces(d1,d2,false);
Modelisation::sewFaceEmb<PFP>(*m_map,d1,d2);
m_map->sewFaces(d1,d2,false);
#ifdef MC_WIDTH_EDGE_Z_EMBEDED
if (m_zslice!=NULL)
{
......
......@@ -200,7 +200,8 @@ protected:
void computeCenter();
Dart grid_topo_open(unsigned int x, unsigned int y);
Dart cylinder_topo_open(unsigned int n, unsigned int z);
public:
/**
* Constructor
......@@ -239,6 +240,8 @@ public:
*/
std::vector<Dart>& getVertexDarts() { return m_tableVertDarts; }
/**
* Create a 2D grid
* quads are oriented counter-clockwise and the returned dart
......
This diff is collapsed.
......@@ -137,8 +137,8 @@ inline T& AttributeHandler<T, ORBIT>::operator[](Dart d)
assert(valid || !"Invalid AttributeHandler") ;
unsigned int a = m_map->getEmbedding<ORBIT>(d) ;
// if (a == EMBNULL)
// a = m_map->setOrbitEmbeddingOnNewCell<ORBIT>(d) ;
if (a == EMBNULL)
a = m_map->setOrbitEmbeddingOnNewCell<ORBIT>(d) ;
return m_attrib->operator[](a) ;
}
......
......@@ -132,8 +132,8 @@ public:
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding<CELL>(d) ;
// if (a == EMBNULL)
// a = m_map.setOrbitEmbeddingOnNewCell<CELL>(d) ;
if (a == EMBNULL)
a = m_map.setOrbitEmbeddingOnNewCell<CELL>(d) ;
m_markVector->operator[](a).setMark(m_mark) ;
}
......@@ -146,8 +146,8 @@ public:
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding<CELL>(d) ;
// if (a == EMBNULL)
// a = m_map.setOrbitEmbeddingOnNewCell<CELL>(d) ;
if (a == EMBNULL)
a = m_map.setOrbitEmbeddingOnNewCell<CELL>(d) ;
m_markVector->operator[](a).unsetMark(m_mark) ;
}
......@@ -160,8 +160,8 @@ public:
assert(m_markVector != NULL);
unsigned int a = m_map.getEmbedding<CELL>(d) ;
// if (a == EMBNULL)
// return false ;
if (a == EMBNULL)
return false ;
return m_markVector->operator[](a).testMark(m_mark) ;
}
......
......@@ -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 ;
}
/****************************************
......
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