From 0b8272051861e81f39024fb74fe50709942e5293 Mon Sep 17 00:00:00 2001 From: Lionel Untereiner Date: Wed, 16 May 2012 08:55:10 +0200 Subject: [PATCH] vertex split suite --- Apps/Tuto/tuto_oper2.cpp | 2 +- Apps/Tuto/tuto_oper3.cpp | 11 +++++------ include/Topology/map/embeddedMap3.h | 2 +- include/Topology/map/map3.h | 7 +++---- src/Topology/map/embeddedMap3.cpp | 16 ++++++++++------ src/Topology/map/map3.cpp | 14 +++++++++++--- 6 files changed, 31 insertions(+), 21 deletions(-) diff --git a/Apps/Tuto/tuto_oper2.cpp b/Apps/Tuto/tuto_oper2.cpp index df155006..10be95ef 100644 --- a/Apps/Tuto/tuto_oper2.cpp +++ b/Apps/Tuto/tuto_oper2.cpp @@ -74,7 +74,7 @@ void MyQT::operation(int x) PFP::VEC3 c1 = Algo::Geometry::faceCentroid(myMap, m_selected, position); PFP::VEC3 c2 = Algo::Geometry::faceCentroid(myMap, m_selected2, position); position[m_selected] = position[m_selected] * 0.7f + c1*0.3f; - position[m_selected2] = position[m_sel ected2] * 0.7f + c2*0.3f; + position[m_selected2] = position[m_selected2] * 0.7f + c2*0.3f; updateMap(); } break; diff --git a/Apps/Tuto/tuto_oper3.cpp b/Apps/Tuto/tuto_oper3.cpp index 22921b85..6723d5cf 100644 --- a/Apps/Tuto/tuto_oper3.cpp +++ b/Apps/Tuto/tuto_oper3.cpp @@ -180,13 +180,12 @@ void MyQT::operation(int x) break; case 10: CGoGNout <<"split vertex"<(myMap, myMap.findBoundaryFaceOfEdge(m_selected), position); - PFP::VEC3 c2 = Algo::Geometry::faceCentroid(myMap, myMap.findBoundaryFaceOfEdge(m_selected2), position); - myMap.splitVertex(m_selected, m_selected2); - position[m_selected] = position[m_selected] * 0.7f + c1*0.3f; - position[m_selected2] = position[m_selected2] * 0.7f + c2*0.3f; + Dart dit = m_selecteds.front(); + PFP::VEC3 c1 = Algo::Geometry::faceCentroid(myMap, dit, position); + myMap.splitVertex(m_selecteds); + position[dit] = position[dit] * 0.7f + c1*0.3f; updateMap(); } break; diff --git a/include/Topology/map/embeddedMap3.h b/include/Topology/map/embeddedMap3.h index bac9463e..b7956dcf 100644 --- a/include/Topology/map/embeddedMap3.h +++ b/include/Topology/map/embeddedMap3.h @@ -41,7 +41,7 @@ public: /*! * */ - virtual void splitVertex(Dart d, Dart e); + virtual void splitVertex(std::vector& vd); //! /*! diff --git a/include/Topology/map/map3.h b/include/Topology/map/map3.h index 13830253..ab789170 100644 --- a/include/Topology/map/map3.h +++ b/include/Topology/map/map3.h @@ -137,14 +137,13 @@ public: *************************************************************************/ //@{ - //! Split the vertex + //! Split the vertex along a permutation of faces /*! \per Darts d & e MUST belong to the same vertex * \per Darts d & e MUST belong to different volumes * \per Works only on the boundary - * @param d first dart in vertex v - * @param e second dart in vertex v + * @param vd a vector of darts */ - virtual void splitVertex(Dart d, Dart e); + virtual void splitVertex(std::vector& vd); //! Delete the vertex of d /*! All the volumes around the vertex are merged into one volume diff --git a/src/Topology/map/embeddedMap3.cpp b/src/Topology/map/embeddedMap3.cpp index 775b70dc..7446e73f 100644 --- a/src/Topology/map/embeddedMap3.cpp +++ b/src/Topology/map/embeddedMap3.cpp @@ -27,16 +27,18 @@ namespace CGoGN { -void EmbeddedMap3::splitVertex(Dart d, Dart e) +void EmbeddedMap3::splitVertex(std::vector& vd) { + Dart d = vd.front(); + Dart d3 = phi2(phi3(d)); - Map3::splitVertex(d, e); + Map3::splitVertex(vd); if(isOrbitEmbedded(VERTEX)) { embedOrbit(VERTEX, d, getEmbedding(VERTEX, d)); - embedNewCell(VERTEX, phi2(phi1(phi2(d)))); - copyCell(VERTEX, phi2(phi1(phi2(d))), d); + embedNewCell(VERTEX, d3); + copyCell(VERTEX, d3, d); } if(isOrbitEmbedded(EDGE)) @@ -46,8 +48,10 @@ void EmbeddedMap3::splitVertex(Dart d, Dart e) if(isOrbitEmbedded(VOLUME)) { - embedOrbit(VOLUME, d, getEmbedding(VOLUME, d)) ; - embedOrbit(VOLUME, e, getEmbedding(VOLUME, e)) ; + for(std::vector::iterator it = vd.begin() ; it != vd.end() ; ++it) + { + embedOrbit(VOLUME, *it, getEmbedding(VOLUME, *it)) ; + } } } diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index 6f789361..48b14f99 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -129,11 +129,18 @@ void Map3::fillHole(Dart d) * Topological operations on 3-maps *************************************************************************/ -void Map3::splitVertex(Dart d, Dart e) +void Map3::splitVertex(std::vector& vd) { - assert(sameVertex(d,e)); - assert(!sameVolume(d,e)); + //assert(checkPathAroundVertex(vd)) ; assert(sameVertex(d,e)); + //unsew the face path + for(std::vector::iterator it = vd.begin() ; it != vd.end() ; ++it) + { + unsewVolumes(*it); + } + + +/* if(isBoundaryVertex(d)) { unsewVolumes(d); @@ -151,6 +158,7 @@ void Map3::splitVertex(Dart d, Dart e) // Map2::splitVertex(e, ec); // //Map2::splitFace(e, phi2(ec)); } +*/ } Dart Map3::deleteVertex(Dart d) -- GitLab