Commit 9d11a4ad authored by untereiner's avatar untereiner

encore quelques modifs sur les 3-cartes

parent 790ec12a
......@@ -58,6 +58,7 @@ template <typename PFP>
bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vector<std::string>& attrNames)
{
typedef typename PFP::VEC3 VEC3;
unsigned int em;
AttributeHandler<VEC3> position = map.template addAttribute<VEC3>(VERTEX_ORBIT, "position") ;
attrNames.push_back(position.name()) ;
......@@ -86,8 +87,39 @@ bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vecto
//Bounding box : first coord & second coord
bg = line.substr(0, posData);
posCoord = bg.find(") (");
stringToEmb<PFP>(bg.substr(0, posCoord));
stringToEmb<PFP>(bg.substr(posCoord+3));
VEC3 c1 = stringToEmb<PFP>(bg.substr(0, posCoord));
VEC3 c2 = stringToEmb<PFP>(bg.substr(posCoord+3));
std::vector<std::vector<VEC3> > coordonnees; //tableau 2D avec les x en fonction des y
coordonnees.reserve(50);
// Dart d = map.newFace(4);
//
// em = container.insertLine();
// position[em] = c1;
// map.setDartEmbedding(VERTEX_ORBIT, d, em);
// d = map.phi1(d);
//
// em = container.insertLine();
// position[em] = VEC3(c2[0],c1[1],c2[2]);
// map.setDartEmbedding(VERTEX_ORBIT, d, em);
// d = map.phi1(d);
//
// em = container.insertLine();
// position[em] = c2;
// map.setDartEmbedding(VERTEX_ORBIT, d, em);
// d = map.phi1(d);
//
// em = container.insertLine();
// position[em] = VEC3(c1[0],c2[1],c1[2]);
// map.setDartEmbedding(VERTEX_ORBIT, d, em);
// d = map.phi1(d);
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(0, posCoord));
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(posCoord+3));
while ( std::getline( fp, line ) )
{
......@@ -97,14 +129,44 @@ bool importInESS(typename PFP::MAP& map, const std::string& filename, std::vecto
//Bounding box : first coord & second coord
bg = line.substr(0, posData);
posCoord = bg.find(") (");
stringToEmb<PFP>(bg.substr(0,posCoord));
stringToEmb<PFP>(bg.substr(posCoord+3));
VEC3 c1 = stringToEmb<PFP>(bg.substr(0, posCoord));
VEC3 c2 = stringToEmb<PFP>(bg.substr(posCoord+3));
Dart d = map.newFace(4);
em = container.insertLine();
position[em] = c1;
map.setDartEmbedding(VERTEX_ORBIT, d, em);
d = map.phi1(d);
em = container.insertLine();
position[em] = VEC3(c2[0],c1[1],c2[2]);
map.setDartEmbedding(VERTEX_ORBIT, d, em);
d = map.phi1(d);
em = container.insertLine();
position[em] = c2;
map.setDartEmbedding(VERTEX_ORBIT, d, em);
d = map.phi1(d);
em = container.insertLine();
position[em] = VEC3(c1[0],c2[1],c1[2]);
map.setDartEmbedding(VERTEX_ORBIT, d, em);
d = map.phi1(d);
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(0,posCoord));
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(posCoord+3));
//Second column
bg = line.substr(posData+1);
posCoord = bg.find(") (");
stringToEmb<PFP>(bg.substr(0, posCoord));
stringToEmb<PFP>(bg.substr(posCoord+3));
// bg = line.substr(posData+1);
// posCoord = bg.find(") (");
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(0, posCoord));
// id = container.insertLine();
// position[id] = stringToEmb<PFP>(bg.substr(posCoord+3));
++count;
}
......
......@@ -104,6 +104,8 @@ void quadranguleFacesVolume(typename PFP::MAP& map, EMBV& attributs, const Funct
template <typename PFP, typename EMBV, typename EMB>
void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs);
template <typename PFP, typename EMBV, typename EMB>
void dooSabinVolume(typename PFP::MAP& map, Dart d, EMBV& attributs);
/*
* Quadrangule a Volume
......
......@@ -579,6 +579,8 @@ void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
}
}
moe.unmarkAll();
//Fifth pass : traversal to phi3 sewing
std::vector<Dart>::iterator nvol;
for (nvol = quadfaces.begin(); nvol != quadfaces.end(); nvol = nvol + 2)
......@@ -639,6 +641,83 @@ void hexaCutVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
// }
}
template <typename PFP, typename EMBV, typename EMB>
void dooSabinVolume(typename PFP::MAP& map, Dart d, EMBV& attributs)
{
DartMarker mf(map) ; //mark face
DartMarker me(map) ; //mark edge
DartMarkerStore mark(map); // Lock a marker
//Store faces that are traversed and start with the face of d
std::vector<Dart> visitedFaces;
visitedFaces.reserve(100);
visitedFaces.push_back(d);
std::vector<Dart>::iterator face;
//Store a dart from a each face
std::vector<Dart> faces;
faces.reserve(100);
// First pass : for every face added to the list save a dart
for (face = visitedFaces.begin(); face != visitedFaces.end(); ++face)
{
if (!mark.isMarked(*face)) // Face has not been visited yet
{
faces.push_back(*face);
Dart dNext = *face ;
do
{
mark.mark(dNext); // Mark
Dart adj = map.phi2(dNext); // Get adjacent face
if (adj != dNext && !mark.isMarked(adj))
visitedFaces.push_back(adj); // Add it
dNext = map.phi1(dNext);
} while(dNext != *face);
}
}
// Second pass : for every edges insert a face
for(face = faces.begin() ; face != faces.end() ; ++face)
{
Dart e = *face;
do
{
if(!me.isMarked(e))
{
//insertion d'une face dans l'arete
Dart e2 = map.phi2(e);
map.unsewFaces(e);
Dart ne = map.newOrientedFace(4);
map.sewFaces(e,ne);
map.sewFaces(e2, map.phi1(map.phi1(ne)));
//marquage de l'orbite arete
me.markOrbit(EDGE_ORBIT,e);
}
e = map.phi1(e);
}while (e != *face);
}
// Dart f = map.phi1(d);
// map.cutEdge(d);
// Dart e = map.phi1(d);
// attributs[e] = attributs[d];
// attributs[e] += attributs[f];
// attributs[e] *= 0.5;
//
// Dart dPrev = d;
// Dart ePrev = map.phi2(d);
// map.splitFace(dPrev,ePrev);
//
// attributs[map.phi_1(d)] = attributs[map.phi1(ePrev)];
}
} // namespace Modelisation
} // namespace Algo
......
......@@ -113,8 +113,6 @@ public:
*/
virtual void collapseFace(Dart d, bool delDegenerateFaces = true,
bool delDegenerateVolumes = true);
virtual void unsewFaces(Dart d);
} ;
} // namespace CGoGN
......
......@@ -310,53 +310,10 @@ Dart EmbeddedMap3<MAP3>::cutSpike(Dart d)
Dart e = MAP3::cutSpike(d);
// if(MAP3::isOrbitEmbedded(VERTEX_ORBIT))
// {
// }
return e;
}
template <typename MAP3>
void EmbeddedMap3<MAP3>::unsewFaces(Dart d)
{
// unsigned int vEmb1 = EMBNULL ;
// unsigned int vEmb2 = EMBNULL ;
// if (MAP3::isOrbitEmbedded(VERTEX_ORBIT))
// {
// vEmb1 = MAP3::getEmbedding(d, VERTEX_ORBIT) ;
// vEmb2 = MAP3::getEmbedding(MAP3::phi1(d), VERTEX_ORBIT) ;
// }
// unsigned int eEmb = EMBNULL ;
// if (MAP3::isOrbitEmbedded(EDGE_ORBIT))
// {
// eEmb = MAP3::getEmbedding(d, EDGE_ORBIT) ;
// }
Dart e = MAP3::phi2(d) ;
MAP3::unsewFaces(d) ;
// if (MAP3::isOrbitEmbedded(VERTEX_ORBIT))
// {
// MAP3::setDartEmbedding(VERTEX_ORBIT, d, vEmb1) ;
// MAP3::setDartEmbedding(VERTEX_ORBIT, MAP3::phi1(d), vEmb2) ;
// if(e != d)
// {
// MAP3::embedNewCell(VERTEX_ORBIT, e) ;
// MAP3::copyCell(VERTEX_ORBIT, e, d) ;
// MAP3::embedNewCell(VERTEX_ORBIT, MAP3::phi1(e)) ;
// MAP3::copyCell(VERTEX_ORBIT, MAP3::phi1(e), MAP3::phi1(d)) ;
// }
// }
//
// if (MAP3::isOrbitEmbedded(EDGE_ORBIT))
// {
// MAP3::setDartEmbedding(EDGE_ORBIT, d, eEmb) ;
// MAP3::embedNewCell(EDGE_ORBIT, e) ;
// MAP3::copyCell(EDGE_ORBIT, e, d) ;
// }
}
} // namespace CGoGN
......@@ -240,6 +240,10 @@ public:
*/
virtual bool isBoundaryVolume(Dart d);
/**
*
*/
virtual bool isBoundaryVertex(Dart d);
//@}
......
......@@ -607,6 +607,44 @@ bool Map3::isBoundaryVolume(Dart d)
return isBoundary;
}
bool Map3::isBoundaryVertex(Dart d)
{
DartMarkerStore mv(*this); // Lock a marker
bool found = false; // Last functor return value
std::list<Dart> darts_list; //Darts that are traversed
darts_list.push_back(d); //Start with the dart d
std::list<Dart>::iterator darts;
mv.mark(d);
for(darts = darts_list.begin(); !found && darts != darts_list.end() ; ++darts)
{
Dart dc = *darts;
//add phi21 and phi23 successor if they are not marked yet
Dart d2 = phi2(dc);
Dart d21 = phi1(d2); // turn in volume
Dart d23 = phi3(d2); // change volume
if(!mv.isMarked(d21))
{
darts_list.push_back(d21);
mv.mark(d21);
}
if((d23!=d2) && !mv.isMarked(d23))
{
darts_list.push_back(d23);
mv.mark(d23);
}
found = phi3(dc) == dc;
}
return found;
}
/*! @name Cell Functors
* Apply functors to all darts of a cell
*************************************************************************/
......
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