From 424ba2db699a4e04b43d29649092d5392bd24f67 Mon Sep 17 00:00:00 2001 From: untereiner Date: Tue, 15 Jan 2013 17:15:21 +0100 Subject: [PATCH] correction namespace Map3MR + adding functions in map2/map3 --- Apps/Tuto/tuto_dual2.cpp | 92 +--------- .../Multiresolution/Map3MR/Filters/bertram.h | 12 +- .../Multiresolution/Map3MR/Filters/lerp.h | 26 +-- .../Map3MR/Filters/mcCrackenJoy.h | 8 +- .../Multiresolution/Map3MR/Filters/schaefer.h | 16 +- .../Map3MR/map3MR_PrimalRegular.hpp | 162 +++++++++--------- include/Topology/generic/attributeHandler.h | 1 - include/Topology/map/map2.h | 17 +- include/Topology/map/map3.h | 8 +- src/Topology/map/map2.cpp | 80 +-------- src/Topology/map/map3.cpp | 86 +++++++--- 11 files changed, 203 insertions(+), 305 deletions(-) diff --git a/Apps/Tuto/tuto_dual2.cpp b/Apps/Tuto/tuto_dual2.cpp index 6238a4bb..1ded7488 100644 --- a/Apps/Tuto/tuto_dual2.cpp +++ b/Apps/Tuto/tuto_dual2.cpp @@ -67,89 +67,15 @@ int main(int argc, char **argv) VertexAttribute position = myMap.getAttribute(attrNames[0]); - // - // Dual - // - // FaceAttribute positionF = myMap.getAttribute("position") ; - // if(!positionF.isValid()) - // positionF = myMap.addAttribute("position") ; - // - // Algo::Surface::Geometry::computeCentroidFaces(myMap, position, positionF) ; - // myMap.computeDual(); - // position = positionF ; - - -// AttributeHandler positionE = myMap.getAttribute("position") ; -// if(!positionE.isValid()) -// positionE = myMap.addAttribute("position") ; -// -// SelectorDartBoundary sdb(myMap); -// TraversorE 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 oldb; -// -// std::cout << "nb darts : " << myMap.getNbDarts() << std::endl; -// -// CellMarker 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::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 positionF; -// positionF = positionE; -// -// Algo::Surface::Geometry::computeCentroidFaces(myMap, position, positionF) ; -// -// for(std::vector::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(); + FaceAttribute positionF = myMap.getAttribute("position") ; + if(!positionF.isValid()) + positionF = myMap.addAttribute("position") ; + + Algo::Surface::Geometry::computeCentroidFaces(myMap, position, positionF) ; + + myMap.computeDual(); + position = positionF ; + Algo::Surface::Export::exportOFF(myMap, position, "result.off"); std::cout << "Exported" << std::endl; diff --git a/include/Algo/Multiresolution/Map3MR/Filters/bertram.h b/include/Algo/Multiresolution/Map3MR/Filters/bertram.h index d0dc69b3..23d2d0d1 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/bertram.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/bertram.h @@ -59,7 +59,7 @@ namespace Filters //w-lift(a) template -class Ber02OddSynthesisFilter : public Filter +class Ber02OddSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -154,7 +154,7 @@ public: // s-lift(a) template -class Ber02EvenSynthesisFilter : public Filter +class Ber02EvenSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -371,7 +371,7 @@ public: // s-scale(a) template -class Ber02ScaleSynthesisFilter : public Filter +class Ber02ScaleSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -426,7 +426,7 @@ public: //w-lift(a) template -class Ber02OddAnalysisFilter : public Filter +class Ber02OddAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -521,7 +521,7 @@ public: // s-lift(a) template -class Ber02EvenAnalysisFilter : public Filter +class Ber02EvenAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -738,7 +738,7 @@ public: // s-scale(a) template -class Ber02ScaleAnalysisFilter : public Filter +class Ber02ScaleAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; diff --git a/include/Algo/Multiresolution/Map3MR/Filters/lerp.h b/include/Algo/Multiresolution/Map3MR/Filters/lerp.h index 0a95cf67..ef914bfe 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/lerp.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/lerp.h @@ -58,7 +58,7 @@ namespace Filters template -class LerpQuadOddSynthesisFilter : public Filter +class LerpQuadOddSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -73,7 +73,7 @@ public: TraversorW travW(m_map) ; for (Dart d = travW.begin(); d != travW.end(); d = travW.next()) { - typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid(m_map, d, m_position); + typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid(m_map, d, m_position); unsigned int count = 0; typename PFP::VEC3 ec(0.0); @@ -169,7 +169,7 @@ public: template -class LerpQuadOddAnalysisFilter : public Filter +class LerpQuadOddAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -222,7 +222,7 @@ public: TraversorW travW(m_map) ; for (Dart d = travW.begin(); d != travW.end(); d = travW.next()) { - typename PFP::VEC3 vc = Algo::Geometry::volumeCentroid(m_map, d, m_position); + typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid(m_map, d, m_position); unsigned int count = 0; typename PFP::VEC3 ec(0.0); @@ -275,7 +275,7 @@ public: template -class LerpEdgeSynthesisFilter : public Filter +class LerpEdgeSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -303,7 +303,7 @@ public: } ; template -class LerpFaceSynthesisFilter : public Filter +class LerpFaceSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -332,7 +332,7 @@ public: } ; template -class LerpTriQuadFaceSynthesisFilter : public Filter +class LerpTriQuadFaceSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -349,7 +349,7 @@ public: { if(m_map.faceDegree(d) > 3) { - typename PFP::VEC3 p = Algo::Geometry::faceCentroid(m_map, d, m_position); + typename PFP::VEC3 p = Algo::Surface::Geometry::faceCentroid(m_map, d, m_position); m_map.incCurrentLevel() ; @@ -364,7 +364,7 @@ public: template -class LerpVolumeSynthesisFilter : public Filter +class LerpVolumeSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -379,9 +379,11 @@ public: TraversorW trav(m_map) ; for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) { - if(!Algo::Modelisation::Tetrahedralization::isTetrahedron(m_map,d) && !Algo::Modelisation::isPrism(m_map,d) && !Algo::Modelisation::isPyra(m_map,d)) + if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron(m_map,d) + && !Algo::Surface::Modelisation::isPrism(m_map,d) + && !Algo::Surface::Modelisation::isPyra(m_map,d)) { - typename PFP::VEC3 p = Algo::Geometry::volumeCentroid(m_map, d, m_position); + typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid(m_map, d, m_position); m_map.incCurrentLevel() ; @@ -395,7 +397,7 @@ public: } ; template -class LerpSqrt3VolumeSynthesisFilter : public Filter +class LerpSqrt3VolumeSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; diff --git a/include/Algo/Multiresolution/Map3MR/Filters/mcCrackenJoy.h b/include/Algo/Multiresolution/Map3MR/Filters/mcCrackenJoy.h index 85710596..fb88f03d 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/mcCrackenJoy.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/mcCrackenJoy.h @@ -50,7 +50,7 @@ namespace Filters /* Catmull-clark on Boundary Vertices and MJ96 on Insides Vertices *********************************************************************************/ template -class MJ96VertexSubdivision : public Filter +class MJ96VertexSubdivision : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -155,7 +155,7 @@ public: }; template -class MJ96EdgeSubdivision : public Filter +class MJ96EdgeSubdivision : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -245,7 +245,7 @@ public: }; template -class MJ96FaceSubdivision : public Filter +class MJ96FaceSubdivision : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -305,7 +305,7 @@ public: }; template -class MJ96VolumeSubdivision : public Filter +class MJ96VolumeSubdivision : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; diff --git a/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h b/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h index 5aac0bac..f818f953 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h @@ -156,7 +156,7 @@ typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const VertexAttribute -class LoopEvenAnalysisFilter : public Filter +class LoopEvenAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -182,7 +182,7 @@ public: } ; template -class LoopNormalisationAnalysisFilter : public Filter +class LoopNormalisationAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -212,7 +212,7 @@ public: } ; template -class LoopOddAnalysisFilter : public Filter +class LoopOddAnalysisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -263,7 +263,7 @@ public: /* Loop on Boundary Vertices and SHW04 on Insides Vertices *********************************************************************************/ template -class LoopOddSynthesisFilter : public Filter +class LoopOddSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -306,7 +306,7 @@ public: } ; template -class LoopNormalisationSynthesisFilter : public Filter +class LoopNormalisationSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -336,7 +336,7 @@ public: } ; template -class LoopEvenSynthesisFilter : public Filter +class LoopEvenSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -362,7 +362,7 @@ public: } ; template -class LoopVolumeSynthesisFilter : public Filter +class LoopVolumeSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; @@ -393,7 +393,7 @@ public: } ; template -class SHW04VolumeNormalisationSynthesisFilter : public Filter +class SHW04VolumeNormalisationSynthesisFilter : public Algo::MR::Filter { protected: typename PFP::MAP& m_map ; diff --git a/include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp b/include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp index 437a23c7..93186325 100644 --- a/include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp +++ b/include/Algo/Multiresolution/Map3MR/map3MR_PrimalRegular.hpp @@ -133,88 +133,88 @@ void Map3MR::splitSurfaceInVolume(std::vector& vd, bool firstSideClos /************************************************************************ * Level creation * ************************************************************************/ -template -void Map3MR::addNewLevelSqrt3(bool embedNewVertices) -{ - m_map.pushLevel(); - - m_map.addLevelBack(); - m_map.duplicateDarts(m_map.getMaxLevel()); - m_map.setCurrentLevel(m_map.getMaxLevel()); - - DartMarkerStore m(m_map); - - // - // 1-4 flip of all tetrahedra - // - TraversorW tW(m_map); - for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next()) - { - Traversor3WF tWF(m_map, dit); - for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next()) - { - if(!m_map.isBoundaryFace(ditWF)) - m.markOrbit(ditWF); - } - - Algo::Volume::Modelisation::Tetrahedralization::flip1To4(m_map, dit); - } - -/* - // - // 2-3 swap of all old interior faces - // - TraversorF tF(m_map); - for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next()) - { - if(m.isMarked(dit)) - { - m.unmarkOrbit(dit); - Algo::Volume::Modelisation::Tetrahedralization::swap2To3(m_map, dit); - } - } - - // - // 1-3 flip of all boundary tetrahedra - // - TraversorW tWb(m_map); - for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next()) - { - if(m_map.isBoundaryVolume(dit)) - { - Traversor3WE tWE(m_map, dit); - for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next()) - { - if(m_map.isBoundaryEdge(ditWE)) - m.markOrbit(ditWE); - } - - Algo::Volume::Modelisation::Tetrahedralization::flip1To3(m_map, dit); - } - } - - // - // edge-removal on all old boundary edges - // - TraversorE tE(m_map); - for(Dart dit = tE.begin() ; dit != tE.end() ; dit = tE.next()) - { - if(m.isMarked(dit)) - { - m.unmarkOrbit(dit); - Dart d = m_map.phi2(m_map.phi3(m_map.findBoundaryFaceOfEdge(dit))); - Algo::Volume::Modelisation::Tetrahedralization::swapGen3To2(m_map, d); - - } - } -*/ - - m_map.setCurrentLevel(m_map.getMaxLevel()); - m_map.popLevel() ; -} +//template +//void Map3MR::addNewLevelSqrt3(bool embedNewVertices) +//{ +// m_map.pushLevel(); +// +// m_map.addLevelBack(); +// m_map.duplicateDarts(m_map.getMaxLevel()); +// m_map.setCurrentLevel(m_map.getMaxLevel()); +// +// DartMarkerStore m(m_map); +// +// // +// // 1-4 flip of all tetrahedra +// // +// TraversorW tW(m_map); +// for(Dart dit = tW.begin() ; dit != tW.end() ; dit = tW.next()) +// { +// Traversor3WF tWF(m_map, dit); +// for(Dart ditWF = tWF.begin() ; ditWF != tWF.end() ; ditWF = tWF.next()) +// { +// if(!m_map.isBoundaryFace(ditWF)) +// m.markOrbit(ditWF); +// } +// +// Algo::Volume::Modelisation::Tetrahedralization::flip1To4(m_map, dit); +// } +// +///* +// // +// // 2-3 swap of all old interior faces +// // +// TraversorF tF(m_map); +// for(Dart dit = tF.begin() ; dit != tF.end() ; dit = tF.next()) +// { +// if(m.isMarked(dit)) +// { +// m.unmarkOrbit(dit); +// Algo::Volume::Modelisation::Tetrahedralization::swap2To3(m_map, dit); +// } +// } +// +// // +// // 1-3 flip of all boundary tetrahedra +// // +// TraversorW tWb(m_map); +// for(Dart dit = tWb.begin() ; dit != tWb.end() ; dit = tWb.next()) +// { +// if(m_map.isBoundaryVolume(dit)) +// { +// Traversor3WE tWE(m_map, dit); +// for(Dart ditWE = tWE.begin() ; ditWE != tWE.end() ; ditWE = tWE.next()) +// { +// if(m_map.isBoundaryEdge(ditWE)) +// m.markOrbit(ditWE); +// } +// +// Algo::Volume::Modelisation::Tetrahedralization::flip1To3(m_map, dit); +// } +// } +// +// // +// // edge-removal on all old boundary edges +// // +// TraversorE tE(m_map); +// for(Dart dit = tE.begin() ; dit != tE.end() ; dit = tE.next()) +// { +// if(m.isMarked(dit)) +// { +// m.unmarkOrbit(dit); +// Dart d = m_map.phi2(m_map.phi3(m_map.findBoundaryFaceOfEdge(dit))); +// Algo::Volume::Modelisation::Tetrahedralization::swapGen3To2(m_map, d); +// +// } +// } +//*/ +// +// m_map.setCurrentLevel(m_map.getMaxLevel()); +// m_map.popLevel() ; +//} template -void Map3MR::addNewLevelTetraOcta(bool embedNewVertices) +void Map3MR::addNewLevelTetraOcta() { m_map.pushLevel(); @@ -778,7 +778,7 @@ void Map3MR::addNewLevel() m_map.incCurrentLevel(); Dart x = m_map.phi_1(m_map.phi2(m_map.phi1(ditWV))); - if(!Algo::Modelisation::Tetrahedralization::isTetrahedron(m_map,x)) + if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron(m_map,x)) { DartMarkerStore me(m_map); diff --git a/include/Topology/generic/attributeHandler.h b/include/Topology/generic/attributeHandler.h index 25e37e1b..6855b94e 100644 --- a/include/Topology/generic/attributeHandler.h +++ b/include/Topology/generic/attributeHandler.h @@ -265,7 +265,6 @@ public: FaceAttribute(GenericMap* m, AttributeMultiVector* amv) : AttributeHandler(m,amv) {} FaceAttribute& operator=(const AttributeHandler& ah) { this->AttributeHandler::operator=(ah); return *this; } FaceAttribute& operator=(const AttributeHandler& ah) { this->AttributeHandler::operator=(ah); return *this; } - FaceAttribute& operator=(const AttributeHandler& ah) { this->AttributeHandler::operator=(ah); return *this; } //TODO dangerous }; /** diff --git a/include/Topology/map/map2.h b/include/Topology/map/map2.h index aa0b26f5..63b14a49 100644 --- a/include/Topology/map/map2.h +++ b/include/Topology/map/map2.h @@ -149,6 +149,12 @@ public: * @param d a dart of the face to fill */ virtual void fillHole(Dart d) ; + + //! Open the mesh Transforming a face in a hole + /*! \pre Dart d is NOT boundary marked + * @param d a dart of the face filled + */ + virtual void createHole(Dart d) ; //@} /*! @name Topological Operators @@ -487,17 +493,6 @@ public: /*! Crop the infinite faces of open meshes */ void computeDual(); - - //! Dual mesh computation (open mesh) - /*! Fit the infinite faces vertices to the middle of the old boundary edges - */ - void computeDualBorderConstraint(); - - //! Dual mesh computation (open mesh) - /*! Fit the infinite faces vertices to the middle of the old boundary edges AND - * fit the middle of the new boundary edges to the old boundary vertices - */ - //void computeDualBorderConstraintWithOldVertices(); //@} }; diff --git a/include/Topology/map/map3.h b/include/Topology/map/map3.h index 2c90b4de..4349cbe0 100644 --- a/include/Topology/map/map3.h +++ b/include/Topology/map/map3.h @@ -130,13 +130,19 @@ public: /*! The phi3-links around the volume are removed * @param d a dart of the volume */ - virtual void deleteVolume(Dart d); + virtual void deleteVolume(Dart d, bool withBoundary = true); //! Fill a hole with a volume /*! \pre Dart d is boundary marked * @param d a dart of the volume to fill */ virtual void fillHole(Dart d) ; + + //! Open the mesh Transforming a face in a hole + /*! \pre Dart d is NOT boundary marked + * @param d a dart of the face filled + */ + virtual void createHole(Dart d) ; //@} /*! @name Topological Operators diff --git a/src/Topology/map/map2.cpp b/src/Topology/map/map2.cpp index 4fb845ec..81f415a9 100644 --- a/src/Topology/map/map2.cpp +++ b/src/Topology/map/map2.cpp @@ -190,6 +190,12 @@ void Map2::fillHole(Dart d) boundaryUnmarkOrbit(dd) ; } +void Map2::createHole(Dart d) +{ + assert(!isBoundaryEdge(d)) ; + boundaryMarkOrbit(d) ; +} + /*! @name Topological Operators * Topological operations on 2-maps *************************************************************************/ @@ -942,74 +948,6 @@ void Map2::computeDual() reverseOrientation() ; -// //boundary management -// for(Dart d = begin(); d != end(); next(d)) -// { -// if(isBoundaryMarked2(d)) -// { -// boundaryMarkOrbit(deleteVertex(phi2(d))); -// } -// } -} - -//TODO triangulation of the boundary face to compute correctly the dual(dual(T)) of mesh T -void Map2::computeDualBorderConstraint() -{ - std::vector oldb; - for(Dart d = begin(); d != end(); next(d)) - { - if(isBoundaryMarked2(d)) - { - oldb.push_back(d); - fillHole(d); - } - } - - //triangule old boundary faces - for(std::vector::iterator it = oldb.begin() ; it != oldb.end() ; ++it) - { - Dart db = *it; - Dart d1 = phi1(db); - splitFace(db, d1) ; - cutEdge(phi_1(db)) ; - Dart x = phi2(phi_1(db)) ; - Dart dd = phi1(phi1(phi1(x))); - while(dd != x) - { - Dart next = phi1(dd) ; - splitFace(dd, phi1(x)) ; - dd = next ; - } - } - - //after dual computation -> mark the new faces created with oldes vertices as a boundary facesc - - - //compute dual - - DartAttribute old_phi1 = getAttribute("phi1"); - DartAttribute old_phi_1 = getAttribute("phi_1") ; - DartAttribute new_phi1 = addAttribute("new_phi1") ; - DartAttribute new_phi_1 = addAttribute("new_phi_1") ; - - for(Dart d = begin(); d != end(); next(d)) - { - Dart dd = phi1(phi2(d)); - - new_phi1[d] = dd ; - new_phi_1[dd] = d ; - } - - swapAttributes(old_phi1, new_phi1) ; - swapAttributes(old_phi_1, new_phi_1) ; - - removeAttribute(new_phi1) ; - removeAttribute(new_phi_1) ; - - swapEmbeddingContainers(VERTEX, FACE) ; - - reverseOrientation() ; - //boundary management for(Dart d = begin(); d != end(); next(d)) { @@ -1018,12 +956,6 @@ void Map2::computeDualBorderConstraint() boundaryMarkOrbit(deleteVertex(phi2(d))); } } - - - // for(std::vector::iterator it = oldb.begin() ; it != oldb.end() ; ++it) - // { - // boundaryMarkOrbit(*it); - // } } } // namespace CGoGN diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index 2d8c56cf..8adb3e32 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -79,8 +79,45 @@ void Map3::compactTopoRelations(const std::vector& oldnew) * To generate or delete volumes in a 3-map *************************************************************************/ -void Map3::deleteVolume(Dart d) +void Map3::deleteVolume(Dart d, bool withBoundary) { + if(withBoundary) + { + DartMarkerStore mark(*this); // Lock a marker + + std::vector visitedFaces; // Faces that are traversed + visitedFaces.reserve(512); + visitedFaces.push_back(d); // Start with the face of d + + mark.markOrbit(d) ; + + for(unsigned int i = 0; i < visitedFaces.size(); ++i) + { + Dart e = visitedFaces[i] ; + + if(!isBoundaryFace(e)) + unsewVolumes(e) ; + + do // add all face neighbours to the table + { + Dart ee = phi2(e) ; + if(!mark.isMarked(ee)) // not already marked + { + visitedFaces.push_back(ee) ; + mark.markOrbit(ee) ; + } + e = phi1(e) ; + } while(e != visitedFaces[i]) ; + } + + Dart dd = phi3(d) ; + Map2::deleteCC(d) ; //deleting the volume + Map2::deleteCC(dd) ; //deleting its border (created from the unsew operation) + + return; + } + + //else remove the CC and create fixed points DartMarkerStore mark(*this); // Lock a marker std::vector visitedFaces; // Faces that are traversed @@ -89,13 +126,16 @@ void Map3::deleteVolume(Dart d) mark.markOrbit(d) ; - for(unsigned int i = 0; i < visitedFaces.size(); ++i) { Dart e = visitedFaces[i] ; - if(!isBoundaryFace(e)) - unsewVolumes(e) ; + Dart it = e ; + do + { + phi3unsew(it); + it = phi1(it) ; + } while(it != e) ; do // add all face neighbours to the table { @@ -109,16 +149,7 @@ void Map3::deleteVolume(Dart d) } while(e != visitedFaces[i]) ; } -// Traversor3WF tWF(*this,d); -// for(Dart dit = tWF.begin() ; dit != tWF.end() ; dit = tWF.next()) -// { -// if(!isBoundaryFace(dit)) -// unsewVolumes(dit) ; -// } - - Dart dd = phi3(d) ; Map2::deleteCC(d) ; //deleting the volume - Map2::deleteCC(dd) ; //deleting its border (created from the unsew operation) } void Map3::fillHole(Dart d) @@ -130,6 +161,12 @@ void Map3::fillHole(Dart d) boundaryUnmarkOrbit(dd) ; } +void Map3::createHole(Dart d) +{ + assert(!isBoundaryFace(d)) ; + boundaryMarkOrbit(d) ; +} + /*! @name Topological Operators * Topological operations on 3-maps *************************************************************************/ @@ -1202,7 +1239,6 @@ void Map3::reverseOrientation() void Map3::computeDual() { - unsigned int count = 0; CellMarkerNoUnmark cv(*this); std::vector v; @@ -1218,7 +1254,6 @@ void Map3::computeDual() std::cout << "boundary vertices : " << count << std::endl; - DartAttribute old_phi1 = getAttribute("phi1") ; DartAttribute old_phi_1 = getAttribute("phi_1") ; DartAttribute new_phi1 = addAttribute("new_phi1") ; @@ -1248,15 +1283,6 @@ void Map3::computeDual() swapEmbeddingContainers(VERTEX, VOLUME) ; -// //boundary management -// for(Dart d = begin(); d != end(); next(d)) -// { -// if(isBoundaryMarked(d)) -// { -// boundaryMarkOrbit(d) ;//deleteVertex(d)); -// } -// } - for(std::vector::iterator it = v.begin() ; it != v.end() ; ++it) { boundaryUnmarkOrbit(*it); @@ -1268,6 +1294,18 @@ void Map3::computeDual() } closeMap(); + +// //boundary management +// for(Dart d = begin(); d != end(); next(d)) +// { +// if(isBoundaryMarked3(d)) +// { +// //boundaryMarkOrbit(d) ;//deleteVertex(d)); +// boundaryUnmarkOrbit(d); +// deleteVolume(d); +// } +// } +// closeMap(); } } // namespace CGoGN -- GitLab