Commit 88a0b0c1 authored by untereiner's avatar untereiner

begin subdiv Primal Regular for simploidal shapes

parent c8834f1d
...@@ -281,7 +281,7 @@ bool importMeshSurfToVol(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts, fl ...@@ -281,7 +281,7 @@ bool importMeshSurfToVol(typename PFP::MAP& map, MeshTablesSurface<PFP>& mts, fl
for(unsigned int k = 0 ; k < nbStage ; ++k) for(unsigned int k = 0 ; k < nbStage ; ++k)
{ {
Dart d = Algo::Modelisation::createPrism<PFP>(map, nbe); Dart d = Algo::Modelisation::createPrism<PFP>(map, nbe,false);
//Embed the base faces //Embed the base faces
for (unsigned int j = 0; j < nbe; ++j) for (unsigned int j = 0; j < nbe; ++j)
......
...@@ -146,7 +146,7 @@ bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenam ...@@ -146,7 +146,7 @@ bool importNodeWithELERegions(typename PFP::MAP& map, const std::string& filenam
std::stringstream oss(line); std::stringstream oss(line);
oss >> nbe; oss >> nbe;
Dart d = Algo::Modelisation::createTetrahedron<PFP>(map); Dart d = Algo::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt; Geom::Vec4ui pt;
oss >> pt[0]; oss >> pt[0];
--(pt[0]); --(pt[0]);
......
...@@ -145,7 +145,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename ...@@ -145,7 +145,7 @@ bool importOFFWithELERegions(typename PFP::MAP& map, const std::string& filename
std::stringstream oss(line); std::stringstream oss(line);
oss >> nbe; oss >> nbe;
Dart d = Algo::Modelisation::createTetrahedron<PFP>(map); Dart d = Algo::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt; Geom::Vec4ui pt;
oss >> pt[0]; oss >> pt[0];
oss >> pt[1]; oss >> pt[1];
......
...@@ -113,7 +113,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector< ...@@ -113,7 +113,7 @@ bool importTet(typename PFP::MAP& map, const std::string& filename, std::vector<
std::stringstream oss(ligne); std::stringstream oss(ligne);
oss >> nbe; //number of vertices = 4 or used for region mark oss >> nbe; //number of vertices = 4 or used for region mark
Dart d = Algo::Modelisation::createTetrahedron<PFP>(map); Dart d = Algo::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt; Geom::Vec4ui pt;
oss >> pt[0]; oss >> pt[0];
......
...@@ -121,7 +121,7 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s ...@@ -121,7 +121,7 @@ bool importTs(typename PFP::MAP& map, const std::string& filename, std::vector<s
oss >> nbe; //number of vertices = 4 oss >> nbe; //number of vertices = 4
assert(nbe == 4); assert(nbe == 4);
Dart d = Algo::Modelisation::createTetrahedron<PFP>(map); Dart d = Algo::Modelisation::createTetrahedron<PFP>(map,false);
Geom::Vec4ui pt; Geom::Vec4ui pt;
oss >> pt[0]; oss >> pt[0];
......
...@@ -81,49 +81,49 @@ void explodPolyhedron(typename PFP::MAP& map, Dart d, VertexAttribute<typename P ...@@ -81,49 +81,49 @@ void explodPolyhedron(typename PFP::MAP& map, Dart d, VertexAttribute<typename P
* create a n-sided pyramid * create a n-sided pyramid
*/ */
template <typename PFP> template <typename PFP>
Dart createPyramid(typename PFP::MAP& map, unsigned int nbSides); Dart createPyramid(typename PFP::MAP& map, unsigned int nbSides, bool withBoundary = true);
/** /**
* create a n-sided prism * create a n-sided prism
*/ */
template <typename PFP> template <typename PFP>
Dart createPrism(typename PFP::MAP& map, unsigned int nbSides); Dart createPrism(typename PFP::MAP& map, unsigned int nbSides, bool withBoundary = true);
/** /**
* create a n-sided diamond * create a n-sided diamond
*/ */
template <typename PFP> template <typename PFP>
Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides); Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides, bool withBoundary = true);
/** /**
* create a tetrahedron * create a tetrahedron
*/ */
template <typename PFP> template <typename PFP>
Dart createTetrahedron(typename PFP::MAP& map); Dart createTetrahedron(typename PFP::MAP& map, bool withBoundary = true);
/** /**
* create a hexahedron * create a hexahedron
*/ */
template <typename PFP> template <typename PFP>
Dart createHexahedron(typename PFP::MAP& map); Dart createHexahedron(typename PFP::MAP& map, bool withBoundary = true);
/** /**
* create a 3-sided prism * create a 3-sided prism
*/ */
template <typename PFP> template <typename PFP>
Dart createTriangularPrism(typename PFP::MAP& map); Dart createTriangularPrism(typename PFP::MAP& map, bool withBoundary = true);
/** /**
* create a 4-sided pyramid * create a 4-sided pyramid
*/ */
template <typename PFP> template <typename PFP>
Dart createQuadrangularPyramid(typename PFP::MAP& map); Dart createQuadrangularPyramid(typename PFP::MAP& map, bool withBoundary = true);
/** /**
* create 4-sided diamond (i.e. an octahedron) * create 4-sided diamond (i.e. an octahedron)
*/ */
template <typename PFP> template <typename PFP>
Dart createOctahedron(typename PFP::MAP& map); Dart createOctahedron(typename PFP::MAP& map, bool withBoundary = true);
......
...@@ -35,7 +35,7 @@ namespace Modelisation ...@@ -35,7 +35,7 @@ namespace Modelisation
* create a n-sided pyramid * create a n-sided pyramid
*/ */
template <typename PFP> template <typename PFP>
Dart createPyramid(typename PFP::MAP& map, unsigned int n) Dart createPyramid(typename PFP::MAP& map, unsigned int n, bool withBoundary)
{ {
Dart dres = Dart::nil(); Dart dres = Dart::nil();
std::vector<Dart> m_tableVertDarts; std::vector<Dart> m_tableVertDarts;
...@@ -69,42 +69,9 @@ Dart createPyramid(typename PFP::MAP& map, unsigned int n) ...@@ -69,42 +69,9 @@ Dart createPyramid(typename PFP::MAP& map, unsigned int n)
base = map.phi1(base); base = map.phi1(base);
} }
if(map.dimension() == 3) if(map.dimension() == 3 && withBoundary)
map.closeMap(); map.closeMap();
if(map.template isOrbitEmbedded<VERTEX>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<VERTEX>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<VERTEX>(map.phi_1(m_tableVertDarts[0]));
}
if(map.template isOrbitEmbedded<EDGE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<EDGE>(m_tableVertDarts[i]);
map.template initOrbitEmbeddingNewCell<EDGE>(map.phi1(m_tableVertDarts[i]));
}
}
if(map.template isOrbitEmbedded<FACE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<FACE>(dres);
}
if(map.template isOrbitEmbedded<VOLUME>())
{
map.template initOrbitEmbeddingNewCell<VOLUME>(dres);
}
//return a dart from the base //return a dart from the base
return dres; return dres;
} }
...@@ -113,7 +80,7 @@ Dart createPyramid(typename PFP::MAP& map, unsigned int n) ...@@ -113,7 +80,7 @@ Dart createPyramid(typename PFP::MAP& map, unsigned int n)
* create a n-sided prism * create a n-sided prism
*/ */
template <typename PFP> template <typename PFP>
Dart createPrism(typename PFP::MAP& map, unsigned int n) Dart createPrism(typename PFP::MAP& map, unsigned int n, bool withBoundary)
{ {
Dart dres = Dart::nil(); Dart dres = Dart::nil();
unsigned int nb = n*2; unsigned int nb = n*2;
...@@ -157,44 +124,9 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n) ...@@ -157,44 +124,9 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n)
bottom = map.phi_1(bottom); bottom = map.phi_1(bottom);
} }
if(map.dimension() == 3) if(map.dimension() == 3 && withBoundary)
map.closeMap(); map.closeMap();
if(map.template isOrbitEmbedded<VERTEX>())
{
for(unsigned int i = 0; i < nb; ++i)
{
map.template initOrbitEmbeddingNewCell<VERTEX>(m_tableVertDarts[i]);
}
}
if(map.template isOrbitEmbedded<EDGE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
map.template initOrbitEmbeddingNewCell<FACE>(map.phi1(m_tableVertDarts[i]));
map.template initOrbitEmbeddingNewCell<FACE>(map.phi1(map.phi1(m_tableVertDarts[i])));
}
}
if(map.template isOrbitEmbedded<FACE>())
{
for(unsigned int i = 0; i < n; ++i)
{
map.template initOrbitEmbeddingNewCell<FACE>(m_tableVertDarts[i]);
}
map.template initOrbitEmbeddingNewCell<FACE>(top);
map.template initOrbitEmbeddingNewCell<FACE>(bottom);
}
if(map.template isOrbitEmbedded<VOLUME>())
{
map.template initOrbitEmbeddingNewCell<VOLUME>(dres);
}
//return a dart from the base //return a dart from the base
return dres; return dres;
} }
...@@ -203,12 +135,12 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n) ...@@ -203,12 +135,12 @@ Dart createPrism(typename PFP::MAP& map, unsigned int n)
* create a n-sided diamond * create a n-sided diamond
*/ */
template <typename PFP> template <typename PFP>
Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides) Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides, bool withBoundary)
{ {
Dart res = Dart::nil(); Dart res = Dart::nil();
Dart firstP = createPyramid<PFP>(map,nbSides); Dart firstP = createPyramid<PFP>(map,nbSides, withBoundary);
Dart secondP = createPyramid<PFP>(map,nbSides); Dart secondP = createPyramid<PFP>(map,nbSides, withBoundary);
res = map.phi2(firstP); res = map.phi2(firstP);
...@@ -224,45 +156,45 @@ Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides) ...@@ -224,45 +156,45 @@ Dart createDiamond(typename PFP::MAP& map, unsigned int nbSides)
* create a 3-sided prism * create a 3-sided prism
*/ */
template <typename PFP> template <typename PFP>
Dart createTriangularPrism(typename PFP::MAP& map) Dart createTriangularPrism(typename PFP::MAP& map, bool withBoundary)
{ {
return createPrism<PFP>(map, 3); return createPrism<PFP>(map, 3, withBoundary);
} }
/** /**
* create a hexahedron * create a hexahedron
*/ */
template <typename PFP> template <typename PFP>
Dart createHexahedron(typename PFP::MAP& map) Dart createHexahedron(typename PFP::MAP& map, bool withBoundary)
{ {
return createPrism<PFP>(map, 4); return createPrism<PFP>(map, 4, withBoundary);
} }
/** /**
* create a tetrahedron * create a tetrahedron
*/ */
template <typename PFP> template <typename PFP>
Dart createTetrahedron(typename PFP::MAP& map) Dart createTetrahedron(typename PFP::MAP& map, bool withBoundary)
{ {
return createPyramid<PFP>(map, 3); return createPyramid<PFP>(map, 3, withBoundary);
} }
/** /**
* create a 4-sided pyramid * create a 4-sided pyramid
*/ */
template <typename PFP> template <typename PFP>
Dart createQuadrangularPyramid(typename PFP::MAP& map) Dart createQuadrangularPyramid(typename PFP::MAP& map, bool withBoundary)
{ {
return createPyramid<PFP>(map, 4); return createPyramid<PFP>(map, 4, withBoundary);
} }
/** /**
* create an octahedron (i.e. 4-sided diamond) * create an octahedron (i.e. 4-sided diamond)
*/ */
template <typename PFP> template <typename PFP>
Dart createOctahedron(typename PFP::MAP& map) Dart createOctahedron(typename PFP::MAP& map, bool withBoundary)
{ {
return createDiamond<PFP>(map,4); return createDiamond<PFP>(map,4, withBoundary);
} }
......
...@@ -123,7 +123,7 @@ void Map2MR<PFP>::addNewLevel(bool triQuad) ...@@ -123,7 +123,7 @@ void Map2MR<PFP>::addNewLevel(bool triQuad)
Dart next = m_map.phi1(m_map.phi1(dd)) ; Dart next = m_map.phi1(m_map.phi1(dd)) ;
m_map.splitFace(dd, next) ; // insert a first edge m_map.splitFace(dd, next) ; // insert a first edge
Dart ne = m_map.alpha1(dd) ; Dart ne = m_map.phi2(m_map.phi_1(dd)) ;
m_map.cutEdge(ne) ; // cut the new edge to insert the central vertex m_map.cutEdge(ne) ; // cut the new edge to insert the central vertex
travF.skip(dd) ; travF.skip(dd) ;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "Algo/Geometry/centroid.h" #include "Algo/Geometry/centroid.h"
#include "Algo/Modelisation/tetrahedralization.h" #include "Algo/Modelisation/tetrahedralization.h"
#include "Algo/Multiresolution/filter.h" #include "Algo/Multiresolution/filter.h"
#include "Topology/generic/traversor2_closed.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -174,28 +175,8 @@ public: ...@@ -174,28 +175,8 @@ public:
typename PFP::VEC3 ev(0.0); typename PFP::VEC3 ev(0.0);
typename PFP::VEC3 fv(0.0); typename PFP::VEC3 fv(0.0);
std::cout << "db = " << db << std::endl; // Dart dit = db;
// do
Dart dit = db;
do
{
std::cout << "dit = " << dit << std::endl;
m_map.incCurrentLevel() ;
Dart midEdgeV = m_map.phi1(dit);
ev += m_position[midEdgeV];
fv += m_position[m_map.phi1(midEdgeV)];
m_map.decCurrentLevel() ;
++count;
dit = m_map.phi2(m_map.phi_1(dit));
}while(dit != db);
//TODO Replace do--while with a Traversor2 on Boundary
// Traversor2VF<typename PFP::MAP> travVF(m_map,db);
// for(Dart dit = travVF.begin(); dit != travVF.end() ; dit = travVF.next())
// { // {
// std::cout << "dit = " << dit << std::endl; // std::cout << "dit = " << dit << std::endl;
// m_map.incCurrentLevel() ; // m_map.incCurrentLevel() ;
...@@ -206,9 +187,24 @@ public: ...@@ -206,9 +187,24 @@ public:
// //
// m_map.decCurrentLevel() ; // m_map.decCurrentLevel() ;
// ++count; // ++count;
// } //
// dit = m_map.phi2(m_map.phi_1(dit));
//
// }while(dit != db);
//TODO Replace do--while with a Traversor2 on Boundary
ClosedMap::Traversor2VF<typename PFP::MAP> travVF(m_map,db);
for(Dart dit = travVF.begin(); dit != travVF.end() ; dit = travVF.next())
{
m_map.incCurrentLevel() ;
std::cout << std::endl; Dart midEdgeV = m_map.phi1(dit);
ev += m_position[midEdgeV];
fv += m_position[m_map.phi1(midEdgeV)];
m_map.decCurrentLevel() ;
++count;
}
fv /= count; fv /= count;
fv *= 4 * m_a * m_a; fv *= 4 * m_a * m_a;
...@@ -276,26 +272,26 @@ public: ...@@ -276,26 +272,26 @@ public:
Dart db = m_map.findBoundaryFaceOfEdge(d); Dart db = m_map.findBoundaryFaceOfEdge(d);
typename PFP::VEC3 fe(0.0); typename PFP::VEC3 fe(0.0);
m_map.incCurrentLevel() ;
Dart midV = m_map.phi1(m_map.phi1(db));
fe += m_position[midV];
midV = m_map.phi_1(m_map.phi2(db));
fe += m_position[midV];
m_map.decCurrentLevel() ;
//TODO Replace do--while with a Traversor2 on Boundary
// unsigned int count = 0;
// Traversor2EF<typename PFP::MAP> travEF(m_map, db);
// for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
// {
// m_map.incCurrentLevel() ; // m_map.incCurrentLevel() ;
// Dart midV = m_map.phi1(m_map.phi1(dit)); // Dart midV = m_map.phi1(m_map.phi1(db));
// fe += m_position[midV];
// midV = m_map.phi_1(m_map.phi2(db));
// fe += m_position[midV]; // fe += m_position[midV];
// m_map.decCurrentLevel() ; // m_map.decCurrentLevel() ;
// ++count;
// }
fe /= 2; //TODO Replace do--while with a Traversor2 on Boundary
unsigned int count = 0;
ClosedMap::Traversor2EF<typename PFP::MAP> travEF(m_map, db);
for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
{
m_map.incCurrentLevel() ;
Dart midV = m_map.phi1(m_map.phi1(dit));
fe += m_position[midV];
m_map.decCurrentLevel() ;
++count;
}
fe /= count;
fe *= 2 * m_a; fe *= 2 * m_a;
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
...@@ -570,26 +566,26 @@ public: ...@@ -570,26 +566,26 @@ public:
Dart db = m_map.findBoundaryFaceOfEdge(d); Dart db = m_map.findBoundaryFaceOfEdge(d);
typename PFP::VEC3 fe(0.0); typename PFP::VEC3 fe(0.0);
m_map.incCurrentLevel() ;
Dart midV = m_map.phi1(m_map.phi1(db));
fe += m_position[midV];
midV = m_map.phi_1(m_map.phi2(db));
fe += m_position[midV];
m_map.decCurrentLevel() ;
//TODO Replace do--while with a Traversor2 on Boundary
// unsigned int count = 0;
// Traversor2EF<typename PFP::MAP> travEF(m_map, db);
// for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
// {
// m_map.incCurrentLevel() ; // m_map.incCurrentLevel() ;
// Dart midV = m_map.phi1(m_map.phi1(dit)); // Dart midV = m_map.phi1(m_map.phi1(db));
// fe += m_position[midV];
// midV = m_map.phi_1(m_map.phi2(db));
// fe += m_position[midV]; // fe += m_position[midV];
// m_map.decCurrentLevel() ; // m_map.decCurrentLevel() ;
// ++count;
// }
fe /= 2; //TODO Replace do--while with a Traversor2 on Boundary
unsigned int count = 0;
ClosedMap::Traversor2EF<typename PFP::MAP> travEF(m_map, db);
for(Dart dit = travEF.begin() ; dit != travEF.end() ; dit = travEF.next())
{
m_map.incCurrentLevel() ;
Dart midV = m_map.phi1(m_map.phi1(dit));
fe += m_position[midV];
m_map.decCurrentLevel() ;
++count;
}
fe /= count;
fe *= 2 * m_a; fe *= 2 * m_a;
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
...@@ -646,27 +642,8 @@ public: ...@@ -646,27 +642,8 @@ public:
typename PFP::VEC3 ev(0.0); typename PFP::VEC3 ev(0.0);
typename PFP::VEC3 fv(0.0); typename PFP::VEC3 fv(0.0);
std::cout << "db = " << db << std::endl; // Dart dit = db;
// do
Dart dit = db;
do
{
std::cout << "dit = " << dit << std::endl;
m_map.incCurrentLevel() ;
Dart midEdgeV = m_map.phi1(dit);
ev += m_position[midEdgeV];
fv += m_position[m_map.phi1(midEdgeV)];
m_map.decCurrentLevel() ;
++count;
dit = m_map.phi2(m_map.phi_1(dit));
}while(dit != db);
// Traversor2VF<typename PFP::MAP> travVF(m_map,db);
// for(Dart dit = travVF.begin(); dit != travVF.end() ; dit = travVF.next())
// { // {
// std::cout << "dit = " << dit << std::endl; // std::cout << "dit = " << dit << std::endl;
// m_map.incCurrentLevel() ; // m_map.incCurrentLevel() ;
...@@ -677,9 +654,24 @@ public: ...@@ -677,9 +654,24 @@ public:
//