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)
DartMarkerNoUnmark m(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(unsigned int i = 0 ; i < nbv ; ++i)
{
......@@ -562,6 +565,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
}
}
/*
if(nbf == 4) //tetrahedral case
{
Dart d = Surface::Modelisation::createTetrahedron<PFP>(map,false);
......@@ -601,7 +605,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
dd = map.phi1(map.phi2(dd));
} while(dd != d);
}
}
else if(nbf == 5) //pyramidal case
{
Dart d = Surface::Modelisation::createQuadrangularPyramid<PFP>(map,false);
......@@ -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);
}
else if(nbf == 6) //prism case
else */
if(nbf == 6) //prism case
{
Dart d = Surface::Modelisation::createTriangularPrism<PFP>(map,false);
nbPyra++;
// 1.
unsigned int em = edgesBuffer[0]; // get embedding
......@@ -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);
}
else if(nbf == 8) //hexahedral case
}
/*
else if(nbf == 8) //hexahedral case
{
Dart d = Surface::Modelisation::createHexahedron<PFP>(map,false);
......@@ -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);
} //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
unsigned int nbBoundaryFaces = 0 ;
......@@ -831,39 +843,66 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
unsigned int degD = map.faceDegree(d);
unsigned int degGD = map.faceDegree(good_dart);
// std::cout << "degD = " << degD << std::endl;
// std::cout << "degGD = " << degGD << std::endl << std::endl;
if(degD < degGD)
{
Dart dt = map.phi1(good_dart);
map.PFP::MAP::ParentMap::splitFace(dt,map.phi_1(good_dart));
Dart dt = map.phi1(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)) ;
//map.template initDartEmbedding<VERTEX>(map.phi_1(dt), map.template getEmbedding<VERTEX>(map.phi_1(good_dart))) ;
//ne change rien sur l'exemple test
//m.mark(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)));
//ne change rien sur l'exemple test
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)
{
Dart dt = map.phi1(map.phi1(d));
map.PFP::MAP::ParentMap::splitFace(d,dt);
{
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.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)) ;
m.mark(map.phi2(map.phi_1(d)));
//unsigned int emb1 = map.template getEmbedding<VERTEX>(d);
//vecDartsPerVertex[emb1].push_back(map.phi2(map.phi_1(d)));
//ne change rien sur l'exemple test
//m.mark(map.phi_1(d));
// map.sewVolumes(d,good_dart,false);
// m.unmarkOrbit<FACE>(d);
//ne change rien sur l'exemple test
unsigned int emb1 = map.template getEmbedding<VERTEX>(d);
vecDartsPerVertex[emb1].push_back(map.phi2(map.phi_1(d)));
}
//else
//{
map.sewVolumes(d, good_dart, false);
m.unmarkOrbit<FACE>(d);
//}
else if(degD > 3 && degGD > 3)
{
if(map.template getEmbedding<VERTEX>(map.phi1(map.phi1(good_dart))) != map.template getEmbedding<VERTEX>(map.phi_1(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
{
......@@ -875,7 +914,7 @@ bool importMesh(typename PFP::MAP& map, MeshTablesVolume<PFP>& mtv)
if (nbBoundaryFaces > 0)
{
unsigned int nbH = map.closeMap();
unsigned int nbH = map.closeMap();
CGoGNout << "Map closed (" << nbBoundaryFaces << " boundary faces / " << nbH << " holes)" << CGoGNendl;
}
......
......@@ -243,6 +243,28 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
oss >> s3;
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[s1]);
m_emb.push_back(verticesID[s2]);
......@@ -263,25 +285,31 @@ bool MeshTablesVolume<PFP>::importTet(const std::string& filename, std::vector<s
oss >> s4;
oss >> s5;
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 prism ok sans cette partie
// typename PFP::VEC3 P = position[verticesID[s5]];
// typename PFP::VEC3 A = position[verticesID[s0]];
// 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)
{
int ui = s0;
s0 = s4;
s4 = ui;
// if (Geom::testOrientation3D<typename PFP::VEC3>(P,A,B,C) == Geom::OVER)
// {
// int pt[6];
ui = s1;
s1 = s5;
s5 = ui;
// pt[0] = s0;
// pt[1] = s1;
// pt[2] = s2;
// pt[3] = s3;
// pt[4] = s4;
// pt[5] = s5;
ui = s2;
s2 = s3;
s3 = ui;
}
// s0 = pt[0];
// s1 = pt[1];
// s2 = pt[2];
// s3 = pt[3];
// s4 = pt[4];
// s5 = pt[5];
// }
m_emb.push_back(verticesID[s0]);
m_emb.push_back(verticesID[s1]);
......@@ -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 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;
s0 = s3;
s3 = ui;
ui = s1;
s1 = s2;
s2 = ui;
ui = s4;
s4 = s7;
s7 = ui;
ui = s5;
s5 = s6;
s6 = ui;
unsigned int pt[8];
pt[0] = s0;
pt[1] = s1;
pt[2] = s3;
pt[3] = s2;
pt[4] = s4;
pt[5] = s5;
pt[6] = s7;
pt[7] = s6;
s0 = pt[0];
s1 = pt[1];
s2 = pt[2];
s3 = pt[3];
s4 = pt[4];
s5 = pt[5];
s6 = pt[6];
s7 = pt[7];
}
m_emb.push_back(verticesID[s0]);
......
......@@ -26,6 +26,7 @@
#define __TETRAHEDRALIZATION_H__
//#include "tetgen/tetgen.h"
#include "Algo/Geometry/normal.h"
namespace CGoGN
{
......
......@@ -643,7 +643,31 @@ template <typename PFP>
Dart swapGen3To2(typename PFP::MAP& map, Dart 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;
Dart dit = stop;
......@@ -688,10 +712,32 @@ Dart swapGen3To2(typename PFP::MAP& map, Dart d)
template <typename PFP>
std::vector<Dart> swapGen3To2Optimized(typename PFP::MAP& map, Dart d)
{
std::vector<Dart> resTets;
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;
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