Commit 0755cb16 authored by untereiner's avatar untereiner

remove edges handles boundary edges

parent 4ede83de
...@@ -544,6 +544,9 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -544,6 +544,9 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
DartMarkerNoUnmark m(map) ; DartMarkerNoUnmark m(map) ;
FunctorInitEmb<typename PFP::MAP, VERTEX> fsetemb(map); FunctorInitEmb<typename PFP::MAP, VERTEX> fsetemb(map);
unsigned int nbTet, nbPrism, nbPyra, nbHexa;
nbTet = nbPrism = nbPyra = nbHexa = 0;
//for each volume of table //for each volume of table
for(unsigned int i = 0 ; i < nbv ; ++i) for(unsigned int i = 0 ; i < nbv ; ++i)
{ {
...@@ -562,6 +565,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -562,6 +565,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
} }
} }
/*
if(nbf == 4) //tetrahedral case if(nbf == 4) //tetrahedral case
{ {
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false); Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
...@@ -601,7 +605,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -601,7 +605,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
dd = map.phi1(map.phi2(dd)); dd = map.phi1(map.phi2(dd));
} while(dd != d); } while(dd != d);
} }
else if(nbf == 5) //pyramidal case else if(nbf == 5) //pyramidal case
{ {
Dart d = Surface::Modelisation::createQuadrangularPyramid<PFP>(map,false); Dart d = Surface::Modelisation::createQuadrangularPyramid<PFP>(map,false);
...@@ -656,9 +660,11 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -656,9 +660,11 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd));
vecDartsPerVertex[em].push_back(dd); m.mark(dd); vecDartsPerVertex[em].push_back(dd); m.mark(dd);
} }
else if(nbf == 6) //prism case else */
if(nbf == 6) //prism case
{ {
Dart d = Surface::Modelisation::createTriangularPrism<PFP>(map,false); Dart d = Surface::Modelisation::createTriangularPrism<PFP>(map,false);
nbPyra++;
// 1. // 1.
unsigned int em = edgesBuffer[0]; // get embedding unsigned int em = edgesBuffer[0]; // get embedding
...@@ -719,8 +725,9 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -719,8 +725,9 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd));
vecDartsPerVertex[em].push_back(dd); m.mark(dd); vecDartsPerVertex[em].push_back(dd); m.mark(dd);
} }
else if(nbf == 8) //hexahedral case /*
else if(nbf == 8) //hexahedral case
{ {
Dart d = Surface::Modelisation::createHexahedron<PFP>(map,false); Dart d = Surface::Modelisation::createHexahedron<PFP>(map,false);
...@@ -803,10 +810,15 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -803,10 +810,15 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd)); vecDartsPerVertex[em].push_back(dd); m.mark(dd); dd = map.phi1(map.phi2(dd));
vecDartsPerVertex[em].push_back(dd); m.mark(dd); vecDartsPerVertex[em].push_back(dd); m.mark(dd);
} //end of hexa } //end of hexa
*/
} }
std::cout << " elements created " << std::endl; std ::cout << " elements created " << std::endl;
std::cout << "nbPyra = " << nbPyra << std::endl;
std::cout << "nb darts = " << map.getNbDarts() << std::endl;
//reconstruct neighbourhood //reconstruct neighbourhood
unsigned int nbBoundaryFaces = 0 ; unsigned int nbBoundaryFaces = 0 ;
...@@ -831,39 +843,66 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -831,39 +843,66 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
unsigned int degD = map.faceDegree(d); unsigned int degD = map.faceDegree(d);
unsigned int degGD = map.faceDegree(good_dart); unsigned int degGD = map.faceDegree(good_dart);
// std::cout << "degD = " << degD << std::endl;
// std::cout << "degGD = " << degGD << std::endl << std::endl;
if(degD < degGD) if(degD < degGD)
{ {
Dart dt = map.phi1(good_dart); Dart dt = map.phi1(good_dart);
map.PFP::MAP::ParentMap::splitFace(dt,map.phi_1(good_dart)); map.PFP::MAP::ParentMap::splitFace(dt,map.phi_1(good_dart));
map.template initDartEmbedding<VERTEX>(map.phi1(good_dart), map.template getEmbedding<VERTEX>(dt)) ;
map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(map.phi_1(good_dart))) ;
m.mark(map.phi2(map.phi1(good_dart)));
//map.template initDartEmbedding<VERTEX>(map.phi_1(map.phi_1(good_dart)), map.template getEmbedding<VERTEX>(dt)) ; //ne change rien sur l'exemple test
//map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(map.phi_1(good_dart))) ; //m.mark(map.phi1(good_dart));
//unsigned int emb2 = map.template getEmbedding<VERTEX>(map.phi_1(d)); //ne change rien sur l'exemple test
//vecDartsPerVertex[emb2].push_back(map.phi2(map.phi1(good_dart))); unsigned int emb2 = map.template getEmbedding<VERTEX>(map.phi_1(d));
vecDartsPerVertex[emb2].push_back(map.phi2(map.phi1(good_dart)));
// map.sewVolumes(d,good_dart,false);
// m.unmarkOrbit<FACE>(d);
} }
else if(degD > degGD) else if(degD > degGD)
{ {
Dart dt = map.phi1(map.phi1(d)); Dart dt = map.phi1(map.phi1(d));
map.PFP::MAP::ParentMap::splitFace(d,dt); map.PFP::MAP::ParentMap::splitFace(d,dt);
map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(d)) ;
map.template initDartEmbedding<VERTEX>(map.phi_1(d), map.template getEmbedding<VERTEX>(dt)) ;
//map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(d)) ; m.mark(map.phi2(map.phi_1(d)));
//map.template initDartEmbedding<VERTEX>(map.phi_1(d), map.template getEmbedding<VERTEX>(dt)) ;
//unsigned int emb1 = map.template getEmbedding<VERTEX>(d); //ne change rien sur l'exemple test
//vecDartsPerVertex[emb1].push_back(map.phi2(map.phi_1(d))); //m.mark(map.phi_1(d));
// map.sewVolumes(d,good_dart,false); //ne change rien sur l'exemple test
// m.unmarkOrbit<FACE>(d); unsigned int emb1 = map.template getEmbedding<VERTEX>(d);
vecDartsPerVertex[emb1].push_back(map.phi2(map.phi_1(d)));
} }
//else else if(degD > 3 && degGD > 3)
//{ {
map.sewVolumes(d, good_dart, false); if(map.template getEmbedding<VERTEX>(map.phi1(map.phi1(good_dart))) != map.template getEmbedding<VERTEX>(map.phi_1(d)))
m.unmarkOrbit<FACE>(d); {
//} std::cout << "2 faces quad" << std::endl;
Dart dtgd = map.phi1(good_dart);
map.PFP::MAP::ParentMap::splitFace(dtgd,map.phi_1(good_dart));
map.template initDartEmbedding<VERTEX>(map.phi1(good_dart), map.template getEmbedding<VERTEX>(dtgd)) ;
map.template initDartEmbedding<VERTEX>(map.phi_1(dtgd), map.template getEmbedding<VERTEX>(map.phi_1(good_dart))) ;
Dart dt = map.phi1(map.phi1(d));
map.PFP::MAP::ParentMap::splitFace(d,dt);
map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(d)) ;
map.template initDartEmbedding<VERTEX>(map.phi_1(d), map.template getEmbedding<VERTEX>(dt)) ;
}
}
//map.sewVolumes(d, good_dart, false);
m.unmarkOrbit<FACE>(d);
} }
else else
{ {
...@@ -875,7 +914,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv) ...@@ -875,7 +914,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
if (nbBoundaryFaces > 0) if (nbBoundaryFaces > 0)
{ {
unsigned int nbH = map.closeMap(); unsigned int nbH = map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryFaces << " boundary faces / " << nbH << " holes)" << CGoGNendl; CGoGNout << "Map closed (" << nbBoundaryFaces << " boundary faces / " << nbH << " holes)" << CGoGNendl;
} }
......
...@@ -243,6 +243,28 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s ...@@ -243,6 +243,28 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
oss >> s3; oss >> s3;
oss >> s4; oss >> s4;
typename PFP::VEC3 P = position[verticesID[s4]];
typename PFP::VEC3 A = position[verticesID[s0]];
typename PFP::VEC3 B = position[verticesID[s1]];
typename PFP::VEC3 C = position[verticesID[s2]];
// 1 pyra ok avec cette partie
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
{
unsigned int pt[5];
pt[0] = s4;
pt[1] = s0;
pt[2] = s1;
pt[3] = s2;
pt[4] = s3;
s0 = pt[0];
s1 = pt[1];
s2 = pt[2];
s3 = pt[3];
s4 = pt[4];
}
m_emb.push_back(verticesID[s0]); m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]); m_emb.push_back(verticesID[s1]);
m_emb.push_back(verticesID[s2]); m_emb.push_back(verticesID[s2]);
...@@ -263,25 +285,31 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s ...@@ -263,25 +285,31 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
oss >> s4; oss >> s4;
oss >> s5; oss >> s5;
typename PFP::VEC3 P = position[verticesID[s4]]; // 1 prism ok sans cette partie
typename PFP::VEC3 A = position[verticesID[s0]]; // typename PFP::VEC3 P = position[verticesID[s5]];
typename PFP::VEC3 B = position[verticesID[s1]]; // typename PFP::VEC3 A = position[verticesID[s0]];
typename PFP::VEC3 C = position[verticesID[s2]]; // typename PFP::VEC3 B = position[verticesID[s1]];
// typename PFP::VEC3 C = position[verticesID[s2]];
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER) // if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
{ // {
int ui = s0; // int pt[6];
s0 = s4;
s4 = ui;
ui = s1; // pt[0] = s0;
s1 = s5; // pt[1] = s1;
s5 = ui; // pt[2] = s2;
// pt[3] = s3;
// pt[4] = s4;
// pt[5] = s5;
ui = s2; // s0 = pt[0];
s2 = s3; // s1 = pt[1];
s3 = ui; // s2 = pt[2];
} // s3 = pt[3];
// s4 = pt[4];
// s5 = pt[5];
// }
m_emb.push_back(verticesID[s0]); m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]); m_emb.push_back(verticesID[s1]);
...@@ -311,23 +339,27 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s ...@@ -311,23 +339,27 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
typename PFP::VEC3 B = position[verticesID[s1]]; typename PFP::VEC3 B = position[verticesID[s1]];
typename PFP::VEC3 C = position[verticesID[s2]]; typename PFP::VEC3 C = position[verticesID[s2]];
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER) // 1 hexa ok avec cette partie
if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::UNDER)
{ {
int ui = s0; unsigned int pt[8];
s0 = s3; pt[0] = s0;
s3 = ui; pt[1] = s1;
pt[2] = s3;
ui = s1; pt[3] = s2;
s1 = s2; pt[4] = s4;
s2 = ui; pt[5] = s5;
pt[6] = s7;
ui = s4; pt[7] = s6;
s4 = s7;
s7 = ui; s0 = pt[0];
s1 = pt[1];
ui = s5; s2 = pt[2];
s5 = s6; s3 = pt[3];
s6 = ui; s4 = pt[4];
s5 = pt[5];
s6 = pt[6];
s7 = pt[7];
} }
m_emb.push_back(verticesID[s0]); m_emb.push_back(verticesID[s0]);
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __TETRAHEDRALIZATION_H__ #define __TETRAHEDRALIZATION_H__
//#include "tetgen/tetgen.h" //#include "tetgen/tetgen.h"
#include "Algo/Geometry/normal.h"
namespace CGoGN namespace CGoGN
{ {
......
...@@ -643,7 +643,31 @@ template <typename PFP> ...@@ -643,7 +643,31 @@ template <typename PFP>
Dart swapGen3To2(typename PFP::MAP& map, Dart d) Dart swapGen3To2(typename PFP::MAP& map, Dart d)
{ {
Dart stop = map.phi1(map.phi2(map.phi_1(d))); Dart stop = map.phi1(map.phi2(map.phi_1(d)));
map.deleteEdge(d); if(map.deleteEdge(d) == NIL)
{
std::cout << "boundary" << std::endl;
std::vector<Dart> edges;
Dart dbegin = map.findBoundaryFaceOfEdge(d);
Traversor3EW<typename PFP::MAP> t(map, d);
for(Dart dit = t.begin() ; dit != t.end() ; dit = t.next())
edges.push_back(dit);
for(unsigned int i = 0 ; i < edges.size() ; ++i)
map.mergeVolumes(edges[i]);
Dart d = dbegin;
Dart e = map.phi2(d);
map.flipBackEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
d = map.phi3(dbegin);
e = map.phi2(d);
map.flipEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
}
std::vector<Dart> edges; std::vector<Dart> edges;
Dart dit = stop; Dart dit = stop;
...@@ -688,10 +712,32 @@ Dart swapGen3To2(typename PFP::MAP& map, Dart d) ...@@ -688,10 +712,32 @@ Dart swapGen3To2(typename PFP::MAP& map, Dart d)
template <typename PFP> template <typename PFP>
std::vector<Dart> swapGen3To2Optimized(typename PFP::MAP& map, Dart d) std::vector<Dart> swapGen3To2Optimized(typename PFP::MAP& map, Dart d)
{ {
std::vector<Dart> resTets;
Dart stop = map.phi1(map.phi2(map.phi_1(d))); Dart stop = map.phi1(map.phi2(map.phi_1(d)));
map.deleteEdge(d); if(map.deleteEdge(d) == NIL)
{
std::cout << "boundary" << std::endl;
std::vector<Dart> edges;
Dart dbegin = map.findBoundaryFaceOfEdge(d);
Traversor3EW<typename PFP::MAP> t(map, d);
for(Dart dit = t.begin() ; dit != t.end() ; dit = t.next())
edges.push_back(dit);
for(unsigned int i = 0 ; i < edges.size() ; ++i)
map.mergeVolumes(edges[i]);
Dart d = dbegin;
Dart e = map.phi2(d);
map.flipBackEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
d = map.phi3(dbegin);
e = map.phi2(d);
map.flipEdge(d);
map.template copyDartEmbedding<VERTEX>(d, map.phi1(e)) ;
map.template copyDartEmbedding<VERTEX>(e, map.phi1(d)) ;
}
std::vector<Dart> edges; std::vector<Dart> edges;
Dart dit = stop; Dart dit = stop;
......
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