Commit 424ba2db authored by untereiner's avatar untereiner

correction namespace Map3MR + adding functions in map2/map3

parent e0307c22
...@@ -67,89 +67,15 @@ int main(int argc, char **argv) ...@@ -67,89 +67,15 @@ int main(int argc, char **argv)
VertexAttribute<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]); VertexAttribute<PFP::VEC3> position = myMap.getAttribute<PFP::VEC3, VERTEX>(attrNames[0]);
// FaceAttribute<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3, FACE>("position") ;
// Dual if(!positionF.isValid())
// positionF = myMap.addAttribute<PFP::VEC3, FACE>("position") ;
// FaceAttribute<PFP::VEC3> positionF = myMap.getAttribute<PFP::VEC3, FACE>("position") ;
// if(!positionF.isValid()) Algo::Surface::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
// positionF = myMap.addAttribute<PFP::VEC3, FACE>("position") ;
// myMap.computeDual();
// Algo::Surface::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ; position = positionF ;
// myMap.computeDual();
// position = positionF ;
// AttributeHandler<PFP::VEC3, PFP::MAP::EDGE_OF_PARENT> positionE = myMap.getAttribute<PFP::VEC3, PFP::MAP::EDGE_OF_PARENT>("position") ;
// if(!positionE.isValid())
// positionE = myMap.addAttribute<PFP::VEC3, PFP::MAP::EDGE_OF_PARENT>("position") ;
//
// SelectorDartBoundary<PFP::MAP> sdb(myMap);
// TraversorE<PFP::MAP> te(myMap, sdb);
// for(Dart dit = te.begin() ; dit != te.end() ; dit = te.next())
// {
// positionE[dit] = (position[dit] + position[myMap.phi1(dit)]) * PFP::REAL(0.5);
// }
//
// std::cout << "boundary edges centroids : ok" << std::endl;
//
// //triangule old boundary faces
// std::vector<Dart> oldb;
//
// std::cout << "nb darts : " << myMap.getNbDarts() << std::endl;
//
// CellMarker<FACE> cmf(myMap);
// for(Dart d = myMap.begin(); d != myMap.end(); myMap.next(d))
// {
// if(!cmf.isMarked(d) && myMap.isBoundaryMarked2(d))
// {
// oldb.push_back(d);
// cmf.mark(d);
// std::cout << "d = " << d << std::endl;
// }
// }
//
// for(std::vector<Dart>::iterator it = oldb.begin() ; it != oldb.end() ; ++it)
// {
// Dart db = *it;
// Dart d1 = myMap.phi1(db);
// myMap.splitFace(db, d1) ;
// myMap.cutEdge(myMap.phi_1(db)) ;
// Dart x = myMap.phi2(myMap.phi_1(db)) ;
// Dart dd = myMap.phi1(myMap.phi1(myMap.phi1(x)));
// while(dd != x)
// {
// Dart next = myMap.phi1(dd) ;
// myMap.splitFace(dd, myMap.phi1(x)) ;
// dd = next ;
// }
//
// }
//
// std::cout << "boundary face triangulation : ok" << std::endl;
//
// myMap.swapEmbeddingContainers(FACE, PFP::MAP::EDGE_OF_PARENT) ;
//
// std::cout << "swap containers : ok" << std::endl;
//
// FaceAttribute<PFP::VEC3> positionF;
// positionF = positionE;
//
// Algo::Surface::Geometry::computeCentroidFaces<PFP>(myMap, position, positionF) ;
//
// for(std::vector<Dart>::iterator it = oldb.begin() ; it != oldb.end() ; ++it)
// {
// myMap.fillHole(*it);
// }
//
// std::cout << "fillHole : ok" << std::endl;
//
// myMap.computeDual();
//
// //myMap.closeMap();
//
// position = positionF ;
//
// myMap.check();
Algo::Surface::Export::exportOFF<PFP>(myMap, position, "result.off"); Algo::Surface::Export::exportOFF<PFP>(myMap, position, "result.off");
std::cout << "Exported" << std::endl; std::cout << "Exported" << std::endl;
......
...@@ -59,7 +59,7 @@ namespace Filters ...@@ -59,7 +59,7 @@ namespace Filters
//w-lift(a) //w-lift(a)
template <typename PFP> template <typename PFP>
class Ber02OddSynthesisFilter : public Filter class Ber02OddSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -154,7 +154,7 @@ public: ...@@ -154,7 +154,7 @@ public:
// s-lift(a) // s-lift(a)
template <typename PFP> template <typename PFP>
class Ber02EvenSynthesisFilter : public Filter class Ber02EvenSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -371,7 +371,7 @@ public: ...@@ -371,7 +371,7 @@ public:
// s-scale(a) // s-scale(a)
template <typename PFP> template <typename PFP>
class Ber02ScaleSynthesisFilter : public Filter class Ber02ScaleSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -426,7 +426,7 @@ public: ...@@ -426,7 +426,7 @@ public:
//w-lift(a) //w-lift(a)
template <typename PFP> template <typename PFP>
class Ber02OddAnalysisFilter : public Filter class Ber02OddAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -521,7 +521,7 @@ public: ...@@ -521,7 +521,7 @@ public:
// s-lift(a) // s-lift(a)
template <typename PFP> template <typename PFP>
class Ber02EvenAnalysisFilter : public Filter class Ber02EvenAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -738,7 +738,7 @@ public: ...@@ -738,7 +738,7 @@ public:
// s-scale(a) // s-scale(a)
template <typename PFP> template <typename PFP>
class Ber02ScaleAnalysisFilter : public Filter class Ber02ScaleAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
......
...@@ -58,7 +58,7 @@ namespace Filters ...@@ -58,7 +58,7 @@ namespace Filters
template <typename PFP> template <typename PFP>
class LerpQuadOddSynthesisFilter : public Filter class LerpQuadOddSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
TraversorW<typename PFP::MAP> travW(m_map) ; TraversorW<typename PFP::MAP> travW(m_map) ;
for (Dart d = travW.begin(); d != travW.end(); d = travW.next()) for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
{ {
typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position); typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
unsigned int count = 0; unsigned int count = 0;
typename PFP::VEC3 ec(0.0); typename PFP::VEC3 ec(0.0);
...@@ -169,7 +169,7 @@ public: ...@@ -169,7 +169,7 @@ public:
template <typename PFP> template <typename PFP>
class LerpQuadOddAnalysisFilter : public Filter class LerpQuadOddAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -222,7 +222,7 @@ public: ...@@ -222,7 +222,7 @@ public:
TraversorW<typename PFP::MAP> travW(m_map) ; TraversorW<typename PFP::MAP> travW(m_map) ;
for (Dart d = travW.begin(); d != travW.end(); d = travW.next()) for (Dart d = travW.begin(); d != travW.end(); d = travW.next())
{ {
typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position); typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
unsigned int count = 0; unsigned int count = 0;
typename PFP::VEC3 ec(0.0); typename PFP::VEC3 ec(0.0);
...@@ -275,7 +275,7 @@ public: ...@@ -275,7 +275,7 @@ public:
template <typename PFP> template <typename PFP>
class LerpEdgeSynthesisFilter : public Filter class LerpEdgeSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -303,7 +303,7 @@ public: ...@@ -303,7 +303,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LerpFaceSynthesisFilter : public Filter class LerpFaceSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -332,7 +332,7 @@ public: ...@@ -332,7 +332,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LerpTriQuadFaceSynthesisFilter : public Filter class LerpTriQuadFaceSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -349,7 +349,7 @@ public: ...@@ -349,7 +349,7 @@ public:
{ {
if(m_map.faceDegree(d) > 3) if(m_map.faceDegree(d) > 3)
{ {
typename PFP::VEC3 p = Algo::Geometry::faceCentroid<PFP>(m_map, d, m_position); typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
...@@ -364,7 +364,7 @@ public: ...@@ -364,7 +364,7 @@ public:
template <typename PFP> template <typename PFP>
class LerpVolumeSynthesisFilter : public Filter class LerpVolumeSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -379,9 +379,11 @@ public: ...@@ -379,9 +379,11 @@ public:
TraversorW<typename PFP::MAP> trav(m_map) ; TraversorW<typename PFP::MAP> trav(m_map) ;
for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) for (Dart d = trav.begin(); d != trav.end(); d = trav.next())
{ {
if(!Algo::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d) && !Algo::Modelisation::isPrism<PFP>(m_map,d) && !Algo::Modelisation::isPyra<PFP>(m_map,d)) if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(m_map,d)
&& !Algo::Surface::Modelisation::isPrism<PFP>(m_map,d)
&& !Algo::Surface::Modelisation::isPyra<PFP>(m_map,d))
{ {
typename PFP::VEC3 p = Algo::Geometry::volumeCentroid<PFP>(m_map, d, m_position); typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, d, m_position);
m_map.incCurrentLevel() ; m_map.incCurrentLevel() ;
...@@ -395,7 +397,7 @@ public: ...@@ -395,7 +397,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LerpSqrt3VolumeSynthesisFilter : public Filter class LerpSqrt3VolumeSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
......
...@@ -50,7 +50,7 @@ namespace Filters ...@@ -50,7 +50,7 @@ namespace Filters
/* Catmull-clark on Boundary Vertices and MJ96 on Insides Vertices /* Catmull-clark on Boundary Vertices and MJ96 on Insides Vertices
*********************************************************************************/ *********************************************************************************/
template <typename PFP> template <typename PFP>
class MJ96VertexSubdivision : public Filter class MJ96VertexSubdivision : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -155,7 +155,7 @@ public: ...@@ -155,7 +155,7 @@ public:
}; };
template <typename PFP> template <typename PFP>
class MJ96EdgeSubdivision : public Filter class MJ96EdgeSubdivision : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -245,7 +245,7 @@ public: ...@@ -245,7 +245,7 @@ public:
}; };
template <typename PFP> template <typename PFP>
class MJ96FaceSubdivision : public Filter class MJ96FaceSubdivision : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -305,7 +305,7 @@ public: ...@@ -305,7 +305,7 @@ public:
}; };
template <typename PFP> template <typename PFP>
class MJ96VolumeSubdivision : public Filter class MJ96VolumeSubdivision : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
......
...@@ -156,7 +156,7 @@ typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const VertexAttribute<typ ...@@ -156,7 +156,7 @@ typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const VertexAttribute<typ
*********************************************************************************/ *********************************************************************************/
template <typename PFP> template <typename PFP>
class LoopEvenAnalysisFilter : public Filter class LoopEvenAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -182,7 +182,7 @@ public: ...@@ -182,7 +182,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LoopNormalisationAnalysisFilter : public Filter class LoopNormalisationAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -212,7 +212,7 @@ public: ...@@ -212,7 +212,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LoopOddAnalysisFilter : public Filter class LoopOddAnalysisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -263,7 +263,7 @@ public: ...@@ -263,7 +263,7 @@ public:
/* Loop on Boundary Vertices and SHW04 on Insides Vertices /* Loop on Boundary Vertices and SHW04 on Insides Vertices
*********************************************************************************/ *********************************************************************************/
template <typename PFP> template <typename PFP>
class LoopOddSynthesisFilter : public Filter class LoopOddSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -306,7 +306,7 @@ public: ...@@ -306,7 +306,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LoopNormalisationSynthesisFilter : public Filter class LoopNormalisationSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -336,7 +336,7 @@ public: ...@@ -336,7 +336,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LoopEvenSynthesisFilter : public Filter class LoopEvenSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -362,7 +362,7 @@ public: ...@@ -362,7 +362,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class LoopVolumeSynthesisFilter : public Filter class LoopVolumeSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
...@@ -393,7 +393,7 @@ public: ...@@ -393,7 +393,7 @@ public:
} ; } ;
template <typename PFP> template <typename PFP>
class SHW04VolumeNormalisationSynthesisFilter : public Filter class SHW04VolumeNormalisationSynthesisFilter : public Algo::MR::Filter
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
......
...@@ -133,88 +133,88 @@ void Map3MR<PFP>::splitSurfaceInVolume(std::vector<Dart>& vd, bool firstSideClos ...@@ -133,88 +133,88 @@ void Map3MR<PFP>::splitSurfaceInVolume(std::vector<Dart>& vd, bool firstSideClos
/************************************************************************ /************************************************************************
* Level creation * * Level creation *
************************************************************************/ ************************************************************************/
template <typename PFP> //template <typename PFP>
void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices) //void Map3MR<PFP>::addNewLevelSqrt3(bool embedNewVertices)
{ //{
m_map.pushLevel(); // m_map.pushLevel();
//
m_map.addLevelBack(); // m_map.addLevelBack();
m_map.duplicateDarts(m_map.getMaxLevel()); // m_map.duplicateDarts(m_map.getMaxLevel());
m_map.setCurrentLevel(m_map.getMaxLevel()); // m_map.setCurrentLevel(m_map.getMaxLevel());
//
DartMarkerStore m(m_map); // DartMarkerStore m(m_map);
//
// // //
// 1-4 flip of all tetrahedra // // 1-4 flip of all tetrahedra
// // //
TraversorW<typename PFP::MAP> tW(m_map); // TraversorW<typename PFP::MAP> tW(m_map);
for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next()) // for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next())
{ // {
Traversor3WF<typename PFP::MAP> tWF(m_map, dit); // Traversor3WF<typename PFP::MAP> tWF(m_map, dit);
for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next()) // for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next())
{ // {
if(!m_map.isBoundaryFace(ditWF)) // if(!m_map.isBoundaryFace(ditWF))
m.markOrbit<FACE>(ditWF); // m.markOrbit<FACE>(ditWF);
} // }
//
Algo::Volume::Modelisation::Tetrahedralization::flip1To4<PFP>(m_map, dit); // Algo::Volume::Modelisation::Tetrahedralization::flip1To4<PFP>(m_map, dit);
} // }
//
/* ///*
// // //
// 2-3 swap of all old interior faces // // 2-3 swap of all old interior faces
// // //
TraversorF<typename PFP::MAP> tF(m_map); // TraversorF<typename PFP::MAP> tF(m_map);
for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next()) // for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next())
{ // {
if(m.isMarked(dit)) // if(m.isMarked(dit))
{ // {
m.unmarkOrbit<FACE>(dit); // m.unmarkOrbit<FACE>(dit);
Algo::Volume::Modelisation::Tetrahedralization::swap2To3<PFP>(m_map, dit); // Algo::Volume::Modelisation::Tetrahedralization::swap2To3<PFP>(m_map, dit);
} // }
} // }
//
// // //
// 1-3 flip of all boundary tetrahedra // // 1-3 flip of all boundary tetrahedra
// // //
TraversorW<typename PFP::MAP> tWb(m_map); // TraversorW<typename PFP::MAP> tWb(m_map);
for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next()) // for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next())
{ // {
if(m_map.isBoundaryVolume(dit)) // if(m_map.isBoundaryVolume(dit))
{ // {
Traversor3WE<typename PFP::MAP> tWE(m_map, dit); // Traversor3WE<typename PFP::MAP> tWE(m_map, dit);
for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next()) // for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next())
{ // {
if(m_map.isBoundaryEdge(ditWE)) // if(m_map.isBoundaryEdge(ditWE))
m.markOrbit<EDGE>(ditWE); // m.markOrbit<EDGE>(ditWE);
} // }
//
Algo::Volume::Modelisation::Tetrahedralization::flip1To3<PFP>(m_map, dit); // Algo::Volume::Modelisation::Tetrahedralization::flip1To3<PFP>(m_map, dit);
} // }
} // }
//
// // //
// edge-removal on all old boundary edges // // edge-removal on all old boundary edges
// // //
TraversorE<typename PFP::MAP> tE(m_map); // TraversorE<typename PFP::MAP> tE(m_map);
for(Dart dit = tE.begin() ; dit != tE.end() ; dit = tE.next()) // for(Dart dit = tE.begin() ; dit != tE.end() ; dit = tE.next())
{ // {
if(m.isMarked(dit)) // if(m.isMarked(dit))
{ // {
m.unmarkOrbit<EDGE>(dit); // m.unmarkOrbit<EDGE>(dit);
Dart d = m_map.phi2(m_map.phi3(m_map.findBoundaryFaceOfEdge(dit))); // Dart d = m_map.phi2(m_map.phi3(m_map.findBoundaryFaceOfEdge(dit)));
Algo::Volume::Modelisation::Tetrahedralization::swapGen3To2<PFP>(m_map, d); // Algo::Volume::Modelisation::Tetrahedralization::swapGen3To2<PFP>(m_map, d);