Commit ed04faec authored by untereiner's avatar untereiner

Correction TraversorCell (manque 1 parametre)

parent 6a50a13f
...@@ -137,6 +137,12 @@ public: ...@@ -137,6 +137,12 @@ public:
*/ */
void constructSplittingPath(Dart d, std::vector<Dart>& v, DartMarker& m); void constructSplittingPath(Dart d, std::vector<Dart>& v, DartMarker& m);
//!
/*!
*
*/
void swapEdges(Dart d, Dart e);
// //! // //!
// /*! // /*!
// * // *
......
...@@ -639,7 +639,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -639,7 +639,7 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
{ {
//volCenter += position[d]; //volCenter += position[d];
//++degree; //++degree;
Dart f1 = map.phi1(dit);
Dart e = dit; Dart e = dit;
std::vector<Dart> v ; std::vector<Dart> v ;
...@@ -684,17 +684,17 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -684,17 +684,17 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
} }
while(dd != stop); while(dd != stop);
} }
// else else
// { {
// unsigned int idface = map.getNewFaceId(); unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f1),idface, FACE); map.setFaceId(map.phi2(v.front()),idface, FACE);
// } }
} }
//switch inner faces //switch inner faces
if(isNotTet) if(isNotTet)
{ {
unsigned int i = 0; DartMarker me(map);
for(Dart dit = traV.begin(); dit != traV.end(); dit = traV.next()) for(Dart dit = traV.begin(); dit != traV.end(); dit = traV.next())
{ {
...@@ -704,58 +704,56 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -704,58 +704,56 @@ void subdivideLoop(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
do do
{ {
Dart f3 = map.phi3(f); Dart f3 = map.phi3(f);
Dart tmp = map.phi_1(map.phi2(map.phi_1(map.phi2(map.phi_1(f3))))); //future voisin par phi2
map.unsewFaces(f3); if(!me.isMarked(f3))
map.unsewFaces(tmp); {
map.sewFaces(f3, tmp, false); Dart tmp = map.phi_1(map.phi2(map.phi_1(map.phi2(map.phi_1(f3))))); //future voisin par phi2
map.copyDartEmbedding(VERTEX, map.phi2(f3), tmp); Dart f32 = map.phi2(f3);
map.copyDartEmbedding(VERTEX, map.phi2(tmp), f3); map.swapEdges(f3, tmp);
// map.embedOrbit(VERTEX, f3, map.getEmbedding(VERTEX, f3)) ; unsigned int idface = map.getNewFaceId();
// map.embedOrbit(VERTEX, tmp, map.getEmbedding(VERTEX, tmp)) ; map.setFaceId(map.phi2(f3),idface, FACE);
me.markOrbit(EDGE, f3);
me.markOrbit(EDGE, f32);
}
// unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f3),idface, FACE);
f = map.phi2(map.phi_1(f)); f = map.phi2(map.phi_1(f));
}while(f != x); }while(f != x);
} }
} }
position[centralDart] = volCenter; //Third step : 3-sew internal faces
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
{
Dart f1 = (*it).first;
Dart f2 = (*it).second;
//FAIS a la couture !!!!!!!
//id pour toutes les aretes exterieurs des faces quadrangulees
unsigned int idedge = map.getEdgeId(f1);
map.setEdgeId(map.phi2(f1), idedge, DART);
map.setEdgeId( map.phi2(f2), idedge, DART);
// //Third step : 3-sew internal faces }
// for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
// { //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
// Dart f1 = (*it).first; //id pour les aretes interieurs : (i.e. 16 pour un octa)
// Dart f2 = (*it).second; DartMarker mne(map);
// for(std::vector<Dart>::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it)
// //FAIS a la couture !!!!!!! {
// //id pour toutes les aretes exterieurs des faces quadrangulees if(!mne.isMarked(*it))
// unsigned int idedge = map.getEdgeId(f1); {
// map.setEdgeId(map.phi2(f1), idedge, DART); unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId( map.phi2(f2), idedge, DART); map.setEdgeId(*it, idedge, EDGE);
// mne.markOrbit(EDGE,*it);
// } }
// }
// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
// //id pour les aretes interieurs : (i.e. 16 pour un octa)
// DartMarker mne(map); map.setCurrentLevel(cur) ;
// for(std::vector<Dart>::iterator it = newEdges.begin() ; it != newEdges.end() ; ++it)
// {
// if(!mne.isMarked(*it))
// {
// unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId(*it, idedge, EDGE);
// mne.markOrbit(EDGE,*it);
// }
// }
//
//
// map.setCurrentLevel(cur) ;
} }
......
...@@ -139,7 +139,7 @@ Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides) ...@@ -139,7 +139,7 @@ Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides)
res = map.phi2(firstP); res = map.phi2(firstP);
map.sewVolumes(firstP, secondP); map.sewVolumes(firstP, secondP);
map.mergeVolumes(firstP); //map.mergeVolumes(firstP);
return res; return res;
} }
......
...@@ -108,8 +108,8 @@ public: ...@@ -108,8 +108,8 @@ public:
* @param positions attribute of position vertices * @param positions attribute of position vertices
* @param good selector * @param good selector
*/ */
// template<typename PFP> template<typename PFP>
// void updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good = allDarts) ; void updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good = allDarts) ;
/** /**
* update all drawing buffers * update all drawing buffers
......
...@@ -75,103 +75,103 @@ inline ExplodeVolumeRender::~ExplodeVolumeRender() ...@@ -75,103 +75,103 @@ inline ExplodeVolumeRender::~ExplodeVolumeRender()
delete m_shaderL; delete m_shaderL;
} }
//template<typename PFP> template<typename PFP>
//void ExplodeVolumeRender::updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good) void ExplodeVolumeRender::updateData(typename PFP::MAP& map, typename PFP::TVEC3& positions, const FunctorSelect& good)
//{ {
// if (m_cpf) if (m_cpf)
// { {
// CGoGNerr<< "ExplodeVolumeRender: problem wrong update fonction use the other" << CGoGNendl; CGoGNerr<< "ExplodeVolumeRender: problem wrong update fonction use the other" << CGoGNendl;
// return; return;
// } }
//
// typedef typename PFP::VEC3 VEC3; typedef typename PFP::VEC3 VEC3;
// typedef typename PFP::REAL REAL; typedef typename PFP::REAL REAL;
//
// CellMarker cmv(map,VOLUME); CellMarker cmv(map,VOLUME);
// AutoAttributeHandler<VEC3> centerVolumes(map,VOLUME,"centerVolumes"); AutoAttributeHandler<VEC3> centerVolumes(map,VOLUME,"centerVolumes");
// TraversorW<typename PFP::MAP> traVol(map,good); TraversorW<typename PFP::MAP> traVol(map,good);
// for (Dart d=traVol.begin(); d!=traVol.end(); d=traVol.next()) for (Dart d=traVol.begin(); d!=traVol.end(); d=traVol.next())
// { {
// centerVolumes[d] = Algo::Geometry::volumeCentroid<PFP>(map, d, positions); centerVolumes[d] = Algo::Geometry::volumeCentroid<PFP>(map, d, positions);
// } }
//
// std::vector<VEC3> buffer; std::vector<VEC3> buffer;
// buffer.reserve(16384); buffer.reserve(16384);
//
//
// TraversorCell<typename PFP::MAP> traFace(map, PFP::MAP::ORBIT_IN_PARENT(FACE),good); TraversorCell<typename PFP::MAP> traFace(map, PFP::MAP::ORBIT_IN_PARENT(FACE),good);
//
// for (Dart d=traFace.begin(); d!=traFace.end(); d=traFace.next()) for (Dart d=traFace.begin(); d!=traFace.end(); d=traFace.next())
// { {
// if (m_ef) if (m_ef)
// { {
// VEC3 centerFace = Algo::Geometry::faceCentroid<PFP>(map,d,positions); VEC3 centerFace = Algo::Geometry::faceCentroid<PFP>(map,d,positions);
// Dart a = d; Dart a = d;
// Dart b = map.phi1(a); Dart b = map.phi1(a);
// Dart c = map.phi1(b); Dart c = map.phi1(b);
//
// // loop to cut a polygon in triangle on the fly (works only with convex faces) // loop to cut a polygon in triangle on the fly (works only with convex faces)
// do do
// { {
// buffer.push_back(centerVolumes[d]); buffer.push_back(centerVolumes[d]);
// buffer.push_back(positions[d]); buffer.push_back(positions[d]);
// buffer.push_back(positions[b]); buffer.push_back(positions[b]);
// buffer.push_back(positions[c]); buffer.push_back(positions[c]);
// buffer.push_back(centerFace); // not used buffer.push_back(centerFace); // not used
// buffer.push_back(centerFace); buffer.push_back(centerFace);
// b = c; b = c;
// c = map.phi1(b); c = map.phi1(b);
//
// } while (c != d); } while (c != d);
// } }
// else else
// { {
// Dart a = d; Dart a = d;
// Dart b = map.phi1(a); Dart b = map.phi1(a);
// Dart c = map.phi1(b); Dart c = map.phi1(b);
//
// // loop to cut a polygon in triangle on the fly (works only with convex faces) // loop to cut a polygon in triangle on the fly (works only with convex faces)
// do do
// { {
// buffer.push_back(centerVolumes[d]); buffer.push_back(centerVolumes[d]);
// buffer.push_back(positions[d]); buffer.push_back(positions[d]);
// buffer.push_back(positions[b]); buffer.push_back(positions[b]);
// buffer.push_back(positions[c]); buffer.push_back(positions[c]);
// b = c; b = c;
// c = map.phi1(b); c = map.phi1(b);
//
// } while (c != d); } while (c != d);
// } }
// } }
//
// m_nbTris = buffer.size()/4; m_nbTris = buffer.size()/4;
//
// m_vboPos->allocate(buffer.size()); m_vboPos->allocate(buffer.size());
// VEC3* ptrPos = reinterpret_cast<VEC3*>(m_vboPos->lockPtr()); VEC3* ptrPos = reinterpret_cast<VEC3*>(m_vboPos->lockPtr());
// memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3)); memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
// m_vboPos->releasePtr(); m_vboPos->releasePtr();
// m_shader->setAttributePosition(m_vboPos); m_shader->setAttributePosition(m_vboPos);
//
// buffer.clear(); buffer.clear();
//
// TraversorCell<typename PFP::MAP> traEdge(map, PFP::MAP::ORBIT_IN_PARENT(EDGE),good); TraversorCell<typename PFP::MAP> traEdge(map, PFP::MAP::ORBIT_IN_PARENT(EDGE),good);
// for (Dart d=traEdge.begin(); d!=traEdge.end(); d=traEdge.next()) for (Dart d=traEdge.begin(); d!=traEdge.end(); d=traEdge.next())
// { {
// buffer.push_back(centerVolumes[d]); buffer.push_back(centerVolumes[d]);
// buffer.push_back(positions[d]); buffer.push_back(positions[d]);
// buffer.push_back(positions[ map.phi1(d)]); buffer.push_back(positions[ map.phi1(d)]);
// } }
//
// m_nbLines = buffer.size()/3; m_nbLines = buffer.size()/3;
//
// m_vboPosLine->allocate(buffer.size()); m_vboPosLine->allocate(buffer.size());
//
// ptrPos = reinterpret_cast<VEC3*>(m_vboPosLine->lockPtr()); ptrPos = reinterpret_cast<VEC3*>(m_vboPosLine->lockPtr());
// memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3)); memcpy(ptrPos,&buffer[0],buffer.size()*sizeof(VEC3));
//
// m_vboPosLine->releasePtr(); m_vboPosLine->releasePtr();
// m_shaderL->setAttributePosition(m_vboPosLine); m_shaderL->setAttributePosition(m_vboPosLine);
//} }
template<typename PFP> template<typename PFP>
......
...@@ -62,7 +62,7 @@ template <typename MAP> ...@@ -62,7 +62,7 @@ template <typename MAP>
class TraversorV : public TraversorCell<MAP> class TraversorV : public TraversorCell<MAP>
{ {
public: public:
TraversorV(MAP& m, const FunctorSelect& good = allDarts, unsigned int thread = 0) : TraversorCell<MAP>(m, VERTEX, good, thread) TraversorV(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP>(m, VERTEX, good, forceDartMarker, thread)
{} {}
}; };
...@@ -70,7 +70,7 @@ template <typename MAP> ...@@ -70,7 +70,7 @@ template <typename MAP>
class TraversorE : public TraversorCell<MAP> class TraversorE : public TraversorCell<MAP>
{ {
public: public:
TraversorE(MAP& m, const FunctorSelect& good = allDarts, unsigned int thread = 0) : TraversorCell<MAP>(m, EDGE, good, thread) TraversorE(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP>(m, EDGE, good, forceDartMarker, thread)
{} {}
}; };
...@@ -79,7 +79,7 @@ template <typename MAP> ...@@ -79,7 +79,7 @@ template <typename MAP>
class TraversorF : public TraversorCell<MAP> class TraversorF : public TraversorCell<MAP>
{ {
public: public:
TraversorF(MAP& m, const FunctorSelect& good = allDarts, unsigned int thread = 0) : TraversorCell<MAP>(m, FACE, good, thread) TraversorF(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP>(m, FACE, good, forceDartMarker, thread)
{} {}
}; };
...@@ -87,7 +87,7 @@ template <typename MAP> ...@@ -87,7 +87,7 @@ template <typename MAP>
class TraversorW : public TraversorCell<MAP> class TraversorW : public TraversorCell<MAP>
{ {
public: public:
TraversorW(MAP& m, const FunctorSelect& good = allDarts, unsigned int thread = 0) : TraversorCell<MAP>(m, VOLUME, good, thread) TraversorW(MAP& m, const FunctorSelect& good = allDarts, bool forceDartMarker = false, unsigned int thread = 0) : TraversorCell<MAP>(m, VOLUME, good, forceDartMarker, thread)
{} {}
}; };
......
...@@ -68,6 +68,11 @@ public: ...@@ -68,6 +68,11 @@ public:
*/ */
virtual Dart collapseEdge(Dart d, bool delDegenerateVolumes=true); virtual Dart collapseEdge(Dart d, bool delDegenerateVolumes=true);
//!
/*!
*/
virtual bool collapseDegeneratedFace(Dart d);
//! //!
/*! /*!
*/ */
......
...@@ -170,6 +170,14 @@ public: ...@@ -170,6 +170,14 @@ public:
*/ */
virtual Dart collapseEdge(Dart d, bool delDegenerateVolumes = true); virtual Dart collapseEdge(Dart d, bool delDegenerateVolumes = true);
//! Delete a face if and only if it has one or two edges
/*! If the face is sewed to two distinct adjacent faces,
* then those two faces are sewed
* @param d a dart of the face
* @return true if the collapse has been executed, false otherwise
*/
virtual bool collapseDegeneratedFace(Dart d);
//! Split a face inserting an edge between two vertices //! Split a face inserting an edge between two vertices
/*! \pre Dart d and e should belong to the same face and be distinct /*! \pre Dart d and e should belong to the same face and be distinct
* @param d dart of first vertex * @param d dart of first vertex
......
...@@ -155,6 +155,36 @@ void ImplicitHierarchicalMap3::constructSplittingPath(Dart d, std::vector<Dart>& ...@@ -155,6 +155,36 @@ void ImplicitHierarchicalMap3::constructSplittingPath(Dart d, std::vector<Dart>&
} }
void ImplicitHierarchicalMap3::swapEdges(Dart d, Dart e)
{
Dart d2 = phi2(d);
Dart e2 = phi2(e);
Map2::unsewFaces(d);
Map2::unsewFaces(e);
Map2::sewFaces(d, e);
Map2::sewFaces(d2, e2);
if(isOrbitEmbedded(VERTEX))
{
copyDartEmbedding(VERTEX, d, phi2(phi_1(d)));
copyDartEmbedding(VERTEX, e, phi2(phi_1(e)));
copyDartEmbedding(VERTEX, d2, phi2(phi_1(d2)));
copyDartEmbedding(VERTEX, e2, phi2(phi_1(d2)));
}
if(isOrbitEmbedded(EDGE))
{
}
if(isOrbitEmbedded(VOLUME))
embedNewCell(VOLUME, d);
}
//Dart ImplicitHierarchicalMap3::cutEdge(Dart d) //Dart ImplicitHierarchicalMap3::cutEdge(Dart d)
//{ //{
// Dart resV = EmbeddedMap3::cutEdge(d); // Dart resV = EmbeddedMap3::cutEdge(d);
......
...@@ -154,6 +154,11 @@ Dart EmbeddedMap3::collapseEdge(Dart d, bool delDegenerateVolumes) ...@@ -154,6 +154,11 @@ Dart EmbeddedMap3::collapseEdge(Dart d, bool delDegenerateVolumes)
return resV; return resV;
} }
bool EmbeddedMap3::collapseDegeneratedFace(Dart d)
{
return Map3::collapseDegeneratedFace(d);
}
void EmbeddedMap3::splitFace(Dart d, Dart e) void EmbeddedMap3::splitFace(Dart d, Dart e)
{ {
Dart dd = phi1(phi3(d)); Dart dd = phi1(phi3(d));
......
...@@ -355,7 +355,18 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes) ...@@ -355,7 +355,18 @@ Dart Map3::collapseEdge(Dart d, bool delDegenerateVolumes)
// } // }
// } // }
bool Map3::collapseDegeneratedFace(Dart d)
{
Dart d3 = phi3(d);
Map3::unsewVolumes(d);
std::cout << Map2::collapseDegeneratedFace(d) << std::endl;
std::cout << Map2::collapseDegeneratedFace(d3) << std::endl;
std::cout << std::endl;
return true;
}
void Map3::splitFace(Dart d, Dart e) void Map3::splitFace(Dart d, Dart e)
{ {
......
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