Commit c3bafddc authored by untereiner's avatar untereiner

retour dans le namespace IHM

parent 9d11a4ad
...@@ -34,7 +34,7 @@ namespace CGoGN ...@@ -34,7 +34,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace IHM3 namespace IHM
{ {
template<typename T> class AttributeHandler_IHM ; template<typename T> class AttributeHandler_IHM ;
......
...@@ -28,7 +28,7 @@ namespace CGoGN ...@@ -28,7 +28,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace IHM3 namespace IHM
{ {
/*************************************************** /***************************************************
......
...@@ -32,7 +32,7 @@ namespace CGoGN ...@@ -32,7 +32,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace IHM3 namespace IHM
{ {
template <typename PFP> template <typename PFP>
......
...@@ -31,7 +31,7 @@ namespace CGoGN ...@@ -31,7 +31,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace IHM3 namespace IHM
{ {
//OK //OK
...@@ -91,7 +91,7 @@ Dart subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position ...@@ -91,7 +91,7 @@ Dart subdivideFace(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& position
++degree; ++degree;
p += position[it] ; p += position[it] ;
if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already) if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
Algo::IHM3::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
it = map.phi1(it) ; it = map.phi1(it) ;
} while(it != old) ; } while(it != old) ;
p /= typename PFP::REAL(degree) ; p /= typename PFP::REAL(degree) ;
...@@ -150,11 +150,8 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -150,11 +150,8 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
unsigned int cur = map.getCurrentLevel() ; unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(vLevel) ; // go to the level of the face to subdivide its edges map.setCurrentLevel(vLevel) ; // go to the level of the face to subdivide its edges
// compute volume centroid
typename PFP::VEC3 volCenter;// = Algo::Geometry::volumeCentroidGen<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, d, position);
std::cout << "vLevel=" << vLevel << std::endl; std::cout << "vLevel to subdivide volume=" << vLevel << std::endl;
/* /*
* ou niveau du volume courant i * ou niveau du volume courant i
...@@ -162,7 +159,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -162,7 +159,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
*/ */
DartMarkerStore mf(map); // Lock a face marker DartMarkerStore mf(map); // Lock a face marker
DartMarkerStore mv(map); // Lock a vertex marker
//Store faces that are traversed and start with the face of d //Store faces that are traversed and start with the face of d
std::vector<Dart> visitedFaces; std::vector<Dart> visitedFaces;
...@@ -173,11 +169,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -173,11 +169,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
std::vector<Dart> oldEdges; std::vector<Dart> oldEdges;
oldEdges.reserve(20); oldEdges.reserve(20);
//Store the darts from quadrangulated faces
std::vector<Dart> quadfaces;
quadfaces.reserve(100);
mf.markOrbit(FACE_ORBIT, old) ; mf.markOrbit(FACE_ORBIT, old) ;
for(std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face) for(std::vector<Dart>::iterator face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{ {
...@@ -185,11 +176,9 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -185,11 +176,9 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
do // add all face neighbours to the table do // add all face neighbours to the table
{ {
//if(!mv.isMarked(e))
//{ oldEdges.push_back(e);
oldEdges.push_back(e);
// mv.markOrbit(VERTEX_ORBIT, e);
//}
Dart ee = map.phi2(e) ; Dart ee = map.phi2(e) ;
if(!mf.isMarked(ee)) // not already marked if(!mf.isMarked(ee)) // not already marked
{ {
...@@ -200,12 +189,17 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -200,12 +189,17 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
} while(e != *face) ; } while(e != *face) ;
} }
/*
*
*/
// compute volume centroid
typename PFP::VEC3 volCenter = Algo::Geometry::volumeCentroidGen<PFP, typename PFP::TVEC3, typename PFP::VEC3>(map, d, position);
DartMarker me(map) ; //mark edge
unsigned int degree = 0 ; //Store the darts from quadrangulated faces
DartMarker mvolcent(map); //mark vertices vol centroid computing std::vector<Dart> quadfaces;
quadfaces.reserve(100);
//First step : subdivide edges and faces //First step : subdivide edges and faces
//creates a i+1 edge level and i+1 face level //creates a i+1 edge level and i+1 face level
...@@ -213,32 +207,68 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -213,32 +207,68 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
{ {
Dart d = *face; Dart d = *face;
std::cout << "subdiv de toutes les faces" << std::endl;
if(!map.faceIsSubdivided(d))
{
Dart it = d ;
unsigned int fLevel = map.faceLevel(d) ;
Dart old = map.faceOldestDart(d) ;
unsigned int cur = map.getCurrentLevel() ;
map.setCurrentLevel(fLevel) ; // go to the level of the face to subdivide its edges
std::cout << "fLevel=" << fLevel << std::endl;
unsigned int degree = 0 ;
typename PFP::VEC3 p ;
Dart it = old ;
do do
{ {
if(!mvolcent.isMarked(it)) ++degree;
{ p += position[it] ;
++degree; if(!map.edgeIsSubdivided(it)) // first cut the edges (if they are not already)
volCenter += position[it] ; Algo::IHM::subdivideEdge<PFP>(map, it, position) ; // and compute the degree of the face
mvolcent.markOrbit(VERTEX_ORBIT, it);
}
it = map.phi1(it) ; it = map.phi1(it) ;
} while(it != d) ; } while(it != old) ;
p /= typename PFP::REAL(degree) ;
map.setCurrentLevel(fLevel + 1) ; // go to the next level to perform face subdivision
Dart dd = map.phi1(old) ;
map.splitFace(dd, map.phi1(map.phi1(dd))) ;
unsigned int idface = map.getFaceId(d);
map.setFaceId(map.phi1(map.phi1(dd)), idface, FACE_ORBIT) ;
map.setFaceId(map.phi2(map.phi1(map.phi1(dd))), idface, FACE_ORBIT) ;
std::cout << "subdiv de toutes les faces" << std::endl; Dart ne = map.phi2(map.phi_1(dd));
if(!map.faceIsSubdivided(d)) Dart ne2 = map.phi2(ne);
{
Dart cf = Algo::IHM3::subdivideFace<PFP>(map, *face, position); map.cutEdge(ne) ;
std::cout << "face faite" << std::endl; unsigned int id = map.getNewEdgeId() ;
map.setEdgeId(ne, id, EDGE_ORBIT) ;
id = map.getNewEdgeId() ;
map.setEdgeId(ne2, id, EDGE_ORBIT) ;
Dart res = map.phi2(ne);
unsigned int fLevel = map.getDartLevel(cf) ; dd = map.phi1(map.phi1(map.phi1(map.phi1(ne)))) ;
while(dd != ne)
{
Dart next = map.phi1(map.phi1(dd)) ;
map.splitFace(map.phi1(ne), dd) ;
Dart nne = map.phi2(map.phi_1(dd)) ;
id = map.getNewEdgeId() ;
map.setEdgeId(nne, id, EDGE_ORBIT) ;
map.setFaceId(nne, idface, FACE_ORBIT) ;
dd = next ;
}
position[res] = p ;
map.setCurrentLevel(fLevel) ; Dart cf = res;
Dart e = cf; Dart e = cf;
do do
...@@ -247,11 +277,44 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -247,11 +277,44 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
quadfaces.push_back(map.phi2(e)); quadfaces.push_back(map.phi2(e));
e = map.phi2(map.phi_1(e)); e = map.phi2(map.phi_1(e));
}while (e != cf); }while (e != cf);
map.setCurrentLevel(cur) ;
//Dart cf = Algo::IHM::subdivideFace<PFP>(map, *face, position);
std::cout << "face faite" << std::endl;
// unsigned int fLevel = map.getDartLevel(cf) ;
//
// map.setCurrentLevel(fLevel) ;
//
// Dart e = cf;
// do
// {
// quadfaces.push_back(e);
// quadfaces.push_back(map.phi2(e));
// e = map.phi2(map.phi_1(e));
// }while (e != cf);
} }
} }
volCenter /= typename PFP::REAL(degree) ; /*
*
*/
map.setCurrentLevel(vLevel + 1) ; // go to the next level to perform volume subdivision map.setCurrentLevel(vLevel + 1) ; // go to the next level to perform volume subdivision
std::cout << "vLevel+1=" << vLevel + 1 << std::endl; std::cout << "vLevel+1=" << vLevel + 1 << std::endl;
...@@ -261,14 +324,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -261,14 +324,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
//Third pass : deconnect the corners //Third pass : deconnect the corners
for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge) for (std::vector<Dart>::iterator edge = oldEdges.begin(); edge != oldEdges.end(); ++edge)
{ {
// Dart e = *edge;
// do
// {
// map.unsewFaces(map.phi1(map.phi1(*edge)));
// map.unsewFaces(map.phi1(*edge));
// e = map.phi2(map.phi_1(e));
// }while (e != *edge);
map.unsewFaces(map.phi1(*edge)); map.unsewFaces(map.phi1(*edge));
moe.markOrbit(DART_ORBIT,map.phi1(*edge)); moe.markOrbit(DART_ORBIT,map.phi1(*edge));
} }
...@@ -325,7 +380,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi ...@@ -325,7 +380,6 @@ void subdivideVolume(typename PFP::MAP& map, Dart d, typename PFP::TVEC3& positi
moe.unmarkAll(); moe.unmarkAll();
for (std::vector<Dart>::iterator nvol = quadfaces.begin(); nvol != quadfaces.end(); nvol = nvol + 2) for (std::vector<Dart>::iterator nvol = quadfaces.begin(); nvol != quadfaces.end(); nvol = nvol + 2)
{ {
if(map.phi3(map.phi2(*nvol)) == map.phi2(*nvol) && map.phi3(map.phi2(*(nvol+1))) == map.phi2(*(nvol+1))) if(map.phi3(map.phi2(*nvol)) == map.phi2(*nvol) && map.phi3(map.phi2(*(nvol+1))) == map.phi2(*(nvol+1)))
......
...@@ -31,7 +31,7 @@ namespace CGoGN ...@@ -31,7 +31,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace IHM3 namespace IHM
{ {
//OK //OK
......
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