diff --git a/include/Algo/Import/import2tablesSurface.hpp b/include/Algo/Import/import2tablesSurface.hpp index d0ff8c9dde0258956f8bc3e9c25fa7d1689c5c08..1df59974300255a0165e99642d887aab67bc2ee4 100644 --- a/include/Algo/Import/import2tablesSurface.hpp +++ b/include/Algo/Import/import2tablesSurface.hpp @@ -120,7 +120,6 @@ bool MeshTablesSurface::importMesh(const std::string& filename, std::vector CGoGNout << "TYPE: PLYSLFgenericBin" << CGoGNendl; return importPlySLFgenericBin(filename, attrNames); break; - case ImportSurfacique::OBJ: CGoGNout << "TYPE: OBJ" << CGoGNendl; return importObj(filename, attrNames); @@ -591,7 +590,7 @@ bool MeshTablesSurface::importPly(const std::string& filename, std::vector< CGoGNerr << "Unable to open file " << filename << CGoGNendl; return false; } - + AttributeHandler colors = m_map.template getAttribute(VERTEX, "color") ; if (pid.hasColors()) { diff --git a/include/Algo/Import/importMesh.hpp b/include/Algo/Import/importMesh.hpp index b443004532fc9885160ef3f51ae8798d0ac2b54b..8dca5e6a31ef461cff31044f1cc505bc55bb1c59 100644 --- a/include/Algo/Import/importMesh.hpp +++ b/include/Algo/Import/importMesh.hpp @@ -268,8 +268,8 @@ bool importMeshV(typename PFP::MAP& map, const std::string& filename, std::vecto if ((filename.rfind(".tet") != std::string::npos) || (filename.rfind(".TET") != std::string::npos)) kind = ImportVolumique::TET; - if ((filename.rfind(".ele") != std::string::npos) || (filename.rfind(".ELE") != std::string::npos)) - kind = ImportVolumique::ELE; + if ((filename.rfind(".off") != std::string::npos) || (filename.rfind(".OFF") != std::string::npos)) + kind = ImportVolumique::OFF; if ((filename.rfind(".ts") != std::string::npos) || (filename.rfind(".TS") != std::string::npos)) kind = ImportVolumique::TS; diff --git a/include/Topology/generic/traversor3.h b/include/Topology/generic/traversor3.h index a1153adac65254127c07f5a5c748aa91b6b9ad68..938499a1629c2e13ce5f6d32baa08a9b30161ab0 100644 --- a/include/Topology/generic/traversor3.h +++ b/include/Topology/generic/traversor3.h @@ -323,7 +323,7 @@ public: /** - * Traverse volumes adjacent to a volumee by a vertex + * Traverse volumes adjacent to a volume by a vertex */ template class Traversor3WWaV: public Traversor3XXaY @@ -333,7 +333,7 @@ public: }; /** - * Traverse volumes adjacent to a volumee by an edge + * Traverse volumes adjacent to a volume by an edge */ template class Traversor3WWaE: public Traversor3XXaY @@ -343,7 +343,7 @@ public: }; /** - * Traverse volumes adjacent to a volumee by a face + * Traverse volumes adjacent to a volume by a face */ template class Traversor3WWaF: public Traversor3XXaY diff --git a/include/Topology/map/map2MR/map2MR_PM.h b/include/Topology/map/map2MR/map2MR_PM.h new file mode 100644 index 0000000000000000000000000000000000000000..7e70c3baffc08874b70bdc29374ac354cc2ff290 --- /dev/null +++ b/include/Topology/map/map2MR/map2MR_PM.h @@ -0,0 +1,79 @@ +/******************************************************************************* +* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * +* version 0.1 * +* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg * +* * +* This library is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by the * +* Free Software Foundation; either version 2.1 of the License, or (at your * +* option) any later version. * +* * +* This library is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +* Web site: http://cgogn.unistra.fr/ * +* Contact information: cgogn@unistra.fr * +* * +*******************************************************************************/ + +#ifndef __MAP2MR_PM__ +#define __MAP2MR_PM__ + +#include "Topology/map/embeddedMap2.h" +#include "Topology/generic/traversorCell.h" +#include "Topology/generic/traversor2.h" + +#include "Topology/map/map2MR/filters_Primal.h" + +#include "Algo/Modelisation/subdivision.h" + +namespace CGoGN +{ + + +class SelectorCollapsingEdges : public FunctorSelect +{ +protected: + const DartMarker& m_dm; +public: + SelectorCollapsingEdges(const DartMarker& dm): m_dm(dm) {} + bool operator()(Dart d) const { return m_dm.isMarked(d); } + FunctorSelect* copy() const { return new SelectorCollapsingEdges(m_dm);} +}; + +class Map2MR_PM : public EmbeddedMap2 +{ +protected: + bool shareVertexEmbeddings ; + + std::vector synthesisFilters ; + std::vector analysisFilters ; + + DartMarkerStore* selectedEdges; + +public: + Map2MR_PM() ; + + virtual std::string mapTypeName() const { return "Map2MR_PM" ; } + void addNewLevel(bool embedNewVertices = true) ; + + void addSynthesisFilter(Multiresolution::MRFilter* f) { synthesisFilters.push_back(f) ; } + void addAnalysisFilter(Multiresolution::MRFilter* f) { analysisFilters.push_back(f) ; } + + void clearSynthesisFilters() { synthesisFilters.clear() ; } + void clearAnalysisFilters() { analysisFilters.clear() ; } + + void analysis() ; + void synthesis() ; +} ; +} ; + +} // namespace CGoGN + +#endif diff --git a/include/Topology/map/map3MR/schemes_Primal.h b/include/Topology/map/map3MR/schemes_Primal.h index 2d1808c16737c010c5f30784fef5143e1d3de0b2..6ac87bc28f1d783a9812a16e411f9210d5e8211b 100644 --- a/include/Topology/map/map3MR/schemes_Primal.h +++ b/include/Topology/map/map3MR/schemes_Primal.h @@ -609,137 +609,499 @@ public: } }; -/* BSXW02 on Boundary Vertices and on Insides Vertices +/* Lerp on Boundary Vertices and on Insides Vertices and BSXW02 Averaging *********************************************************************************/ template -class BSXW02VertexSubdivision : public MRScheme +class BSXW02AveragingSubdivision : public MRScheme { protected: typename PFP::MAP& m_map ; typename PFP::TVEC3& m_position ; public: - BSXW02VertexSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + BSXW02AveragingSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) {} void operator() () { - TraversorW trav(m_map) ; - for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) + m_map.incCurrentLevel() ; + TraversorV trav(m_map) ; + for (Dart ditE = trav.begin(); ditE != trav.end(); ditE = trav.next()) { - //cell points : these points are the average of the - //vertices of the lattice that bound the cell - typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, d, m_position); + if(m_map.isBoundaryVertex(ditE)) + { + Dart db = m_map.findBoundaryFaceOfVertex(ditE); - m_map.incCurrentLevel() ; + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor2VF travVF(m_map, db); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::faceCentroid(m_map, ditVF, m_position); + ++count; + } - if(!m_map.isTetrahedron(d)) + P /= count; + + m_position[db] = P; + } + else if(m_map.isBoundaryEdge(ditE)) { - Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); - m_position[midV] = p ; + Dart db = m_map.findBoundaryEdgeOfVertex(ditE); + + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor2VF travVF(m_map, db); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::faceCentroid(m_map, ditVF, m_position); + ++count; + } + + P /= count; + + m_position[db] = P; } + else + { + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor3VW travVF(m_map, ditE); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::volumeCentroid(m_map, ditVF, m_position); + ++count; + } - m_map.decCurrentLevel() ; + P /= count; + + m_position[ditE] = P; + } } + m_map.decCurrentLevel() ; } }; template -class BSXW02EdgeSubdivision : public MRScheme +class BSXW02EdgeAveragingSubdivision : public MRScheme { protected: typename PFP::MAP& m_map ; typename PFP::TVEC3& m_position ; public: - BSXW02EdgeSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + BSXW02EdgeAveragingSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) {} void operator() () { - TraversorW trav(m_map) ; - for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) + TraversorE trav(m_map) ; + for (Dart ditE = trav.begin(); ditE != trav.end(); ditE = trav.next()) { - //cell points : these points are the average of the - //vertices of the lattice that bound the cell - typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, d, m_position); + if(m_map.isBoundaryEdge(ditE)) + { + Dart db = m_map.findBoundaryFaceOfEdge(ditE); - m_map.incCurrentLevel() ; + m_map.incCurrentLevel() ; - if(!m_map.isTetrahedron(d)) + db = m_map.phi1(db); + + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor2VF travVF(m_map, db); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::faceCentroid(m_map, ditVF, m_position); + ++count; + } + + P /= count; + + m_position[db] = P; + + m_map.decCurrentLevel() ; + } + } + } +}; + +template +class BSXW02FaceAveragingSubdivision : public MRScheme +{ +protected: + typename PFP::MAP& m_map ; + typename PFP::TVEC3& m_position ; + +public: + BSXW02FaceAveragingSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + {} + + void operator() () + { + TraversorF trav(m_map) ; + for (Dart ditE = trav.begin(); ditE != trav.end(); ditE = trav.next()) + { + if(m_map.isBoundaryFace(ditE)) { - Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); - m_position[midV] = p ; + Dart db = m_map.phi3(ditE); + + m_map.incCurrentLevel() ; + + if(m_map.faceDegree(db) != 3) + { + db = m_map.phi2(m_map.phi1(db)); + + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor2VF travVF(m_map, db); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::faceCentroid(m_map, ditVF, m_position); + ++count; + } + + P /= count; + + m_position[db] = P; + + } + + m_map.decCurrentLevel() ; } + } + } +}; + +template +class BSXW02VolumeAveragingSubdivision : public MRScheme +{ +protected: + typename PFP::MAP& m_map ; + typename PFP::TVEC3& m_position ; + +public: + BSXW02VolumeAveragingSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + {} + + void operator() () + { + TraversorW trav(m_map) ; + for (Dart ditE = trav.begin(); ditE != trav.end(); ditE = trav.next()) + { + m_map.incCurrentLevel() ; + if(!m_map.isTetrahedron(ditE)) + { + Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(ditE))); + + typename PFP::VEC3 P(0); + unsigned int count = 0; + Traversor3VW travVF(m_map, midV); + for (Dart ditVF = travVF.begin(); ditVF != travVF.end(); ditVF = travVF.next()) + { + P += Algo::Geometry::volumeCentroid(m_map, ditVF, m_position); + ++count; + } + + P /= count; + m_position[midV] = P; + } m_map.decCurrentLevel() ; } } }; +/* DHL93 on Boundary Vertices and MCQ04 on Insides Vertices + *********************************************************************************/ template -class BSXW02FaceSubdivision : public MRScheme +class MCQ04VertexSubdivision: public MRScheme { protected: typename PFP::MAP& m_map ; typename PFP::TVEC3& m_position ; public: - BSXW02FaceSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + MCQ04VertexSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) {} void operator() () { - TraversorW trav(m_map) ; + TraversorV trav(m_map) ; for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) { - //cell points : these points are the average of the - //vertices of the lattice that bound the cell - typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, d, m_position); + typename PFP::VEC3 p = m_position[d]; m_map.incCurrentLevel() ; + m_position[d] = p ; + m_map.decCurrentLevel() ; + } + } +} ; - if(!m_map.isTetrahedron(d)) +template +class MCQ04EdgeSubdivision : public MRScheme +{ +protected: + typename PFP::MAP& m_map ; + typename PFP::TVEC3& m_position ; + +public: + MCQ04EdgeSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + {} + + void operator() () + { + typename PFP::REAL omega = 1.0/16.0; + + TraversorE trav(m_map) ; + for (Dart ditE = trav.begin(); ditE != trav.end(); ditE = trav.next()) + { + if(m_map.isBoundaryEdge(ditE)) { - Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); + Dart db = m_map.findBoundaryFaceOfEdge(ditE); + + + typename PFP::VEC3 p = (m_position[db] + m_position[m_map.phi2(db)]) * typename PFP::REAL(0.5); + + m_map.incCurrentLevel() ; + + Dart midV = m_map.phi2(db) ; m_position[midV] = p ; + + m_map.decCurrentLevel() ; + } + else + { + typename PFP::VEC3 P = ( m_position[ditE] + m_position[m_map.phi2(ditE)] ) * typename PFP::REAL(0.5); - m_map.decCurrentLevel() ; + typename PFP::VEC3 Q(0); + typename PFP::VEC3 R(0); + unsigned int count = 0; + Dart dit = ditE; + do + { + Dart d_1 = m_map.phi_1(dit); + Dart d11 = m_map.phi1(m_map.phi1(dit)); + + Q += m_position[d_1]; + Q += m_position[d11]; + ++count; + + Dart dr1 = m_map.phi1(m_map.phi1(m_map.alpha2(d_1))); + R += m_position[dr1]; + + Dart dr2 = m_map.phi1(m_map.phi1(m_map.alpha2(m_map.phi1(dit)))); + R += m_position[dr2]; + + + dit = m_map.alpha2(dit); + }while(dit != ditE); + + Q *= (omega / count); + + R *= (omega / count); + + m_map.incCurrentLevel() ; + + Dart midV = m_map.phi2(ditE); + + m_position[midV] = P + Q - R; + + m_map.decCurrentLevel() ; + + + } } } }; template -class BSXW02VolumeSubdivision : public MRScheme +class MCQ04FaceSubdivision : public MRScheme { protected: typename PFP::MAP& m_map ; typename PFP::TVEC3& m_position ; public: - BSXW02VolumeSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + MCQ04FaceSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) {} void operator() () { - TraversorW trav(m_map) ; - for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) + typename PFP::REAL omega = 1.0/16.0; + + TraversorF trav(m_map) ; + for (Dart ditF = trav.begin(); ditF != trav.end(); ditF = trav.next()) { - //cell points : these points are the average of the - //vertices of the lattice that bound the cell - typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, d, m_position); + if(m_map.isBoundaryFace(ditF)) + { + typename PFP::VEC3 p = Algo::Geometry::faceCentroid(m_map, ditF, m_position); - m_map.incCurrentLevel() ; + m_map.incCurrentLevel() ; + if(m_map.faceDegree(ditF) != 3) + { + Dart midF = m_map.phi2(m_map.phi1(ditF)); + m_position[midF] = p ; + } + m_map.decCurrentLevel() ; - if(!m_map.isTetrahedron(d)) + } + else { - Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); - m_position[midV] = p ; + //Calcul des Pi + typename PFP::VEC3 P(0); + CellMarker mv(m_map, VERTEX); + Traversor3FV travFV(m_map, ditF); + for (Dart ditFV = travFV.begin(); ditFV != travFV.end(); ditFV = travFV.next()) + { + P += m_position[ditFV]; + mv.mark(ditFV); + } + + P *= (2.0 * omega + 1) / 4.0; + + //Calcul des Qi + typename PFP::VEC3 Q(0); + Traversor3FW travFW(m_map, ditF); + for (Dart ditFW = travFW.begin(); ditFW != travFW.end(); ditFW = travFW.next()) + { + Traversor3WV travWV(m_map, ditFW); + for(Dart ditFV = travWV.begin() ; ditFV != travWV.end() ; ditFV = travWV.next()) + { + if(!mv.isMarked(ditFV)) + { + Q += m_position[ditFV]; + mv.mark(ditFV); + } + } + } + + Q *= omega / 4.0; + + //Calcul des Ri + typename PFP::VEC3 R(0); + Traversor3FFaE travFFaE(m_map, ditF); + for (Dart ditFFaE = travFFaE.begin(); ditFFaE != travFFaE.end(); ditFFaE = travFFaE.next()) + { + Traversor3FV travFV(m_map, ditFFaE); + for (Dart ditFV = travFV.begin(); ditFV != travFV.end(); ditFV = travFV.next()) + { + if(!mv.isMarked(ditFV)) + { + R += m_position[ditFV]; + mv.mark(ditFV); + } + } + } + + R *= omega / 4.0; + + //Calcul des Si + typename PFP::VEC3 S(0); + Traversor3FFaV travFFaV(m_map, ditF); + for (Dart ditFFaV = travFFaV.begin(); ditFFaV != travFFaV.end(); ditFFaV = travFFaV.next()) + { + Traversor3FV travFV(m_map, ditFFaV); + for (Dart ditFV = travFV.begin(); ditFV != travFV.end(); ditFV = travFV.next()) + { + if(!mv.isMarked(ditFV)) + { + S += m_position[ditFV]; + mv.mark(ditFV); + } + } + } + + S *= omega / 8.0; + + m_map.incCurrentLevel() ; + if(m_map.faceDegree(ditF) != 3) + { + Dart midF = m_map.phi2(m_map.phi1(ditF)); + m_position[midF] = P + Q - R - S ; + } + m_map.decCurrentLevel() ; } + } + } +}; - m_map.decCurrentLevel() ; +template +class MCQ04VolumeSubdivision : public MRScheme +{ +protected: + typename PFP::MAP& m_map ; + typename PFP::TVEC3& m_position ; + +public: + MCQ04VolumeSubdivision(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + {} + + void operator() () + { + typename PFP::REAL omega = 1.0/16.0; + + TraversorW trav(m_map) ; + for (Dart ditW = trav.begin(); ditW != trav.end(); ditW = trav.next()) + { + + if(m_map.isBoundaryVolume(ditW)) + { + typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, ditW, m_position); + + m_map.incCurrentLevel() ; + + if(!m_map.isTetrahedron(ditW)) + { + Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(ditW))); + m_position[midV] = p ; + } + + m_map.decCurrentLevel() ; + } + else + { + CellMarker mv(m_map, VERTEX); + + typename PFP::VEC3 P(0); + Traversor3WV travWV(m_map, ditW); + for(Dart ditWV = travWV.begin() ; ditWV != travWV.end() ; ditWV = travWV.next()) + { + P += m_position[ditWV]; + mv.mark(ditWV); + } + + P *= ((6.0 * omega + 1.0) / 8.0); + + typename PFP::VEC3 Q(0); + Traversor3WWaF travWWaF(m_map, ditW); + for(Dart ditWWaF = travWV.begin() ; ditWWaF != travWV.end() ; ditWWaF = travWV.next()) + { + Traversor3WV travWV(m_map, ditWWaF); + for(Dart ditWV = travWV.begin() ; ditWV != travWV.end() ; ditWV = travWV.next()) + { + if(!mv.isMarked(ditWV)) + { + Q += m_position[ditWV]; + } + } + } + + Q *= omega / 4.0; + + + m_map.incCurrentLevel() ; + + if(!m_map.isTetrahedron(ditW)) + { + Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(ditW))); + m_position[midV] = P - Q; + } + + m_map.decCurrentLevel() ; + } } } }; diff --git a/src/Topology/map/map2MR/map2MR_PM.cpp b/src/Topology/map/map2MR/map2MR_PM.cpp new file mode 100644 index 0000000000000000000000000000000000000000..5c094e9e632a1429b3bc2ce08b28eca8b1fc44e5 --- /dev/null +++ b/src/Topology/map/map2MR/map2MR_PM.cpp @@ -0,0 +1,128 @@ +/******************************************************************************* +* CGoGN: Combinatorial and Geometric modeling with Generic N-dimensional Maps * +* version 0.1 * +* Copyright (C) 2009-2012, IGG Team, LSIIT, University of Strasbourg * +* * +* This library is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by the * +* Free Software Foundation; either version 2.1 of the License, or (at your * +* option) any later version. * +* * +* This library is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this library; if not, write to the Free Software Foundation, * +* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * +* * +* Web site: http://cgogn.unistra.fr/ * +* Contact information: cgogn@unistra.fr * +* * +*******************************************************************************/ + +#include "Topology/map/map2MR/map2MR_PM.h" + +namespace CGoGN +{ + +Map2MR_PM::Map2MR_PM() : + shareVertexEmbeddings(true) +{ + initMR() ; +} + +void Map2MR_PM::addNewLevel(bool embedNewVertices) +{ + pushLevel() ; + + //Add the current level higher + + unsigned int newLevel = m_mrDarts.size() ; + std::stringstream ss ; + ss << "MRdart_"<< newLevel ; + AttributeMultiVector* newAttrib = m_mrattribs.addAttribute(ss.str()) ; + m_mrDarts.push_back(newAttrib) ; + m_mrNbDarts.push_back(0) ; + + if(m_mrDarts.size() > 1) + { + for(unsigned int i = newLevel; i > 0 ; --i) + { + AttributeMultiVector* currentAttrib = m_mrDarts[i] ; + AttributeMultiVector* prevAttrib = m_mrDarts[i - 1] ; // copy the indices of + m_mrattribs.copyAttribute(currentAttrib->getIndex(), prevAttrib->getIndex()) ; // previous level into new level + } + } + + popLevel() ; + + setCurrentLevel(0); + + //DartMarker me(*this); + selectedEdges = new DartMarkerStore(*this); + + TraversorE travE(*this); + for (Dart d = travE.begin(); d != travE.end(); d = travE.next()) + { + if(!selectedEdges->isMarked(d)) + { + if(edgeCanCollapse(d)) + { + //interdire la contraction d'arete partageant un meme sommet + //interdire la contraction d'arete + //interdire la contraction d'une arete d'une face incidente au sommet de d + //=> mark incident edges of vertices adjacent to the vertex of d through a common face + Traversor2VVaF travVVaF(*this, d); + for (Dart dit = travVVaF.begin(); dit != travVVaF.end(); dit = travVVaF.next()) + { + Dart ditV = dit; + do + { + if(!selectedEdges->isMarked(ditV)) + selectedEdges->markOrbit(EDGE, ditV); + + ditV = phi2(phi_1(ditV)); + } while(ditV != dit); + } + + //=> the same for the vertex phi2(d) + Traversor2VVaF travVVaF2(*this, phi2(d)); + for (Dart dit = travVVaF2.begin(); dit != travVVaF2.end(); dit = travVVaF2.next()) + { + Dart ditV = dit; + do + { + if(!selectedEdges->isMarked(ditV)) + selectedEdges->markOrbit(EDGE, ditV); + + ditV = phi2(phi_1(ditV)); + } while(ditV != dit); + } + } + } + } +} + +void Map2MR_PM::analysis() +{ + assert(getCurrentLevel() > 0 || !"analysis : called on level 0") ; + + decCurrentLevel() ; + + for(unsigned int i = 0; i < analysisFilters.size(); ++i) + (*analysisFilters[i])() ; +} + +void Map2MR_PM::synthesis() +{ + assert(getCurrentLevel() < getMaxLevel() || !"synthesis : called on max level") ; + + for(unsigned int i = 0; i < synthesisFilters.size(); ++i) + (*synthesisFilters[i])() ; + + incCurrentLevel() ; +} + +} // namespace CGoGN