Commit 010b5977 authored by untereiner's avatar untereiner

Xmas modifications

parent e8b418ff
......@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8)
project(CGoGN)
#SET( CMAKE_VERBOSE_MAKEFILE 1 )
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR})
# for GLEW
......
......@@ -113,11 +113,23 @@ public:
Dart alpha_2(Dart d);
//@}
// /*! @name Topological Operators with Cells id management
// * Topological operations on Hierarchical Implicit 3-maps
// *************************************************************************/
//
// //@{
/*! @name Topological Operators with Cells id management
* Topological operations on Hierarchical Implicit 3-maps
*************************************************************************/
//@{
//!
/*!
*
*/
Dart beginSplittingPath(Dart d, DartMarker& m);
//!
/*!
*
*/
void constructSplittingPath(Dart d, std::vector<Dart>& v, DartMarker& m);
// //!
// /*!
// *
......@@ -147,7 +159,7 @@ public:
// *
// */
// virtual void splitVolume(std::vector<Dart>& vd);
// //@}
//@}
/*! @name Levels Management
* Operations to manage the levels of an Implicit Hierarchical 3-map
......
......@@ -123,7 +123,6 @@ inline Dart ImplicitHierarchicalMap3::phi_1(Dart d)
return it ;
}
//TODO A verifier si besoin d'assertion
inline Dart ImplicitHierarchicalMap3::phi2bis(Dart d)
{
unsigned int faceId = m_faceId[d];
......
......@@ -279,25 +279,40 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3&
std::vector<Dart> newEdges; //save darts from inner edges
newEdges.reserve(50);
DartMarker mSplitted(map);
int i = 0;
//Second step : deconnect each corner, close each hole, subdivide each new face into 3
for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge)
{
Dart e = *edge;
std::vector<Dart> v ;
Dart e = map.beginSplittingPath(*edge, mSplitted);
do
{
v.push_back(map.phi1(map.phi1(e)));
v.push_back(map.phi1(e));
std::cout << "e = " << e << "plop" << std::endl;
e = map.phi2(map.phi_1(e));
//Tous les brins ont deja ete decousus, il n'y a pas de chemin d'arete a construire
if(e == NIL)
{
return NIL;
}
while(e != *edge);
else
{
map.constructSplittingPath(e, v, mSplitted);
}
std::cout << std::endl;
for(std::vector<Dart>::iterator it = v.begin() ; it != v.end() ; ++it)
std::cout << *it << std::endl;
std::cout << std::endl;
i++;
if(i == 2)
return NIL;
map.splitVolume(v) ;
Dart old = map.phi2(map.phi1(e));
Dart old = map.phi2(map.phi1(*edge));
Dart dd = map.phi1(map.phi1(old)) ;
map.splitFace(old,dd) ;
......@@ -330,46 +345,46 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, typename PFP::TVEC3&
dd = map.phi1(map.phi1(dd));
}
while(dd != stop);
}
map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front()))));
//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;
if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2)))
{
//id pour toutes les faces interieures
map.sewVolumes(map.phi2(f1), map.phi2(f2));
//Fais a la couture !!!!!
unsigned int idface = map.getNewFaceId();
map.setFaceId(map.phi2(f1),idface, FACE);
}
//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);
}
//LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
//id pour les aretes interieurs : (i.e. 6 pour un hexa)
DartMarker mne(map);
for(unsigned int i = 0; i < newEdges.size(); ++i)
{
if(!mne.isMarked(newEdges[i]))
{
unsigned int idedge = map.getNewEdgeId();
map.setEdgeId(newEdges[i], idedge, EDGE);
mne.markOrbit(EDGE, newEdges[i]);
}
}
//map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front()))));
// //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;
//
// if(map.isBoundaryFace(map.phi2(f1)) && map.isBoundaryFace(map.phi2(f2)))
// {
// //id pour toutes les faces interieures
// map.sewVolumes(map.phi2(f1), map.phi2(f2));
//
// //Fais a la couture !!!!!
// unsigned int idface = map.getNewFaceId();
// map.setFaceId(map.phi2(f1),idface, FACE);
// }
//
// //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);
// }
//
// //LA copie de L'id est a gerer avec le sewVolumes normalement !!!!!!
// //id pour les aretes interieurs : (i.e. 6 pour un hexa)
// DartMarker mne(map);
// for(unsigned int i = 0; i < newEdges.size(); ++i)
// {
// if(!mne.isMarked(newEdges[i]))
// {
// unsigned int idedge = map.getNewEdgeId();
// map.setEdgeId(newEdges[i], idedge, EDGE);
// mne.markOrbit(EDGE, newEdges[i]);
// }
// }
map.setCurrentLevel(cur) ;
......@@ -644,7 +659,7 @@ Dart subdivideVolumeGen(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& pos
//Etape 2
for (std::vector<std::pair<Dart,Dart> >::iterator edges = subdividedfacesT.begin(); edges != subdividedfacesT.end(); ++edges)
{
Dart f1 = (*edges).first;
// Dart f1 = (*edges).first;
Dart f2 = (*edges).second;
//si ce n'est pas un tetrahedre
......
......@@ -68,6 +68,93 @@ void ImplicitHierarchicalMap3::init()
}
}
Dart ImplicitHierarchicalMap3::beginSplittingPath(Dart d, DartMarker& m)
{
Dart dres = NIL;
Dart dit = d;
bool found = false;
// Recherche d'un brin de depart du chemin d'arete
do
{
Dart eit = phi1(dit);
if(!m.isMarked(eit) && getDartLevel(eit) == getCurrentLevel())
{
found = true;
dres = eit;
}
dit = phi2(phi_1(dit));
}
while(!found && dit != d);
return dres;
}
void ImplicitHierarchicalMap3::constructSplittingPath(Dart d, std::vector<Dart>& v, DartMarker& m)
{
//Construction du chemin d'arete
Dart cit = d;
v.push_back(cit);
m.markOrbit(EDGE, cit);
do
{
if(std::min(getDartLevel(phi1(cit)),getDartLevel(phi2(phi1(cit)))) == getDartLevel(d))
{
if(m.isMarked(phi1(cit)))
{
cit = phi1(phi2(phi1(cit)));
std::cout << "1_1" << std::endl;
}
}
else if(std::min(getDartLevel(phi1(cit)),getDartLevel(phi2(phi1(cit)))) < getDartLevel(d))
{
cit = phi1(phi2(phi1(cit)));
std::cout << "2" << std::endl;
}
else
cit = phi1(cit);
v.push_back(cit);
m.markOrbit(EDGE, cit);
}
while(cit != d);
// do
// {
// v.push_back(cit);
// m.markOrbit(EDGE, cit);
//
// cit = phi1(cit);
//
// //std::cout << "cit = " << cit << std::endl;
//
// if(std::min(getDartLevel(cit), getDartLevel(phi2(cit))) == getDartLevel(d))
// {
// if(m.isMarked(cit))
// {
// cit = phi1(phi2(cit));
// //std::cout << "1_1" << std::endl;
// }
// }
// else if(std::min(getDartLevel(cit),getDartLevel(phi2(cit))) < getDartLevel(d))
// {
// cit = phi1(phi2(cit));
// //std::cout << "2" << std::endl;
// }
//
// }while(cit != d);
}
//Dart ImplicitHierarchicalMap3::cutEdge(Dart d)
//{
// Dart resV = EmbeddedMap3::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