diff --git a/Apps/Examples/viewer.cpp b/Apps/Examples/viewer.cpp index 2d8cd2188fe97788e20a35440857b2f3648c7a1c..f1efb9c1bfc69d2ed02124cc8ad66ecf76a151d6 100644 --- a/Apps/Examples/viewer.cpp +++ b/Apps/Examples/viewer.cpp @@ -309,6 +309,21 @@ void Viewer::slot_normalsSize(int i) updateGL() ; } +void Viewer::cb_keyPress(int keycode) +{ + switch(keycode) + { + case 'c' : + myMap.check(); + break; + default: + break; + } + + updateGLMatrices() ; + updateGL(); +} + /********************************************************************************************** * MAIN FUNCTION * **********************************************************************************************/ diff --git a/Apps/Examples/viewer.h b/Apps/Examples/viewer.h index acf39dc619813171150158c591a929967b75d0bb..a9b477f3ce85db8c7effe408b074743cbd2618cf 100644 --- a/Apps/Examples/viewer.h +++ b/Apps/Examples/viewer.h @@ -117,6 +117,8 @@ public: void cb_Open() ; void cb_Save() ; + void cb_keyPress(int keycode); + void importMesh(std::string& filename) ; void exportMesh(std::string& filename, bool askExportMode = true); diff --git a/Apps/Examples/volumeExplorer.cpp b/Apps/Examples/volumeExplorer.cpp index 5e9a5951d273a3ec66de6ad32db98646bdc606d5..d63502658e0f90beb8afc7eb52da3c37d4ae3bef 100644 --- a/Apps/Examples/volumeExplorer.cpp +++ b/Apps/Examples/volumeExplorer.cpp @@ -319,6 +319,18 @@ int main(int argc, char **argv) position = myMap.getAttribute(VERTEX , attrNames[0]) ; } + if(extension == std::string(".node")) + { + if(!Algo::Import::importMeshV(myMap, argv[1], attrNames, Algo::Import::ImportVolumique::NODE)) + { + std::cerr << "could not import " << argv[1] << std::endl ; + return 1; + } + else + position = myMap.getAttribute(VERTEX , attrNames[0]) ; + } + + if(extension == std::string(".off")) { if(!Algo::Import::importMeshToExtrude(myMap, argv[1], attrNames)) diff --git a/Apps/Tuto/tuto_oper2.cpp b/Apps/Tuto/tuto_oper2.cpp index 10be95efceff872d232c617b0f5f7943e503f7d3..df155006fd89e9e7495a0c3982c0856539eedbc2 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_selected2] * 0.7f + c2*0.3f; + position[m_selected2] = position[m_sel ected2] * 0.7f + c2*0.3f; updateMap(); } break; diff --git a/Apps/Tuto/tuto_oper3.cpp b/Apps/Tuto/tuto_oper3.cpp index 1fae0e5fa176c1953221b6f2796e44dc6484a5a8..22921b85d77c4498eeaf878e6bcc9a0e1a413d4a 100644 --- a/Apps/Tuto/tuto_oper3.cpp +++ b/Apps/Tuto/tuto_oper3.cpp @@ -27,6 +27,7 @@ #include "Algo/Modelisation/polyhedron.h" #include "Algo/Modelisation/primitives3d.h" #include "Algo/Geometry/centroid.h" +#include "Algo/Geometry/normal.h" #include "Algo/Import/import.h" #include "Algo/Export/export.h" @@ -177,6 +178,18 @@ void MyQT::operation(int x) updateMap(); } 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; + updateMap(); + } + break; default: break; } diff --git a/Apps/Tuto/tuto_oper3.ui b/Apps/Tuto/tuto_oper3.ui index 769ec884f7a2b7d50e0531fa388e26c51ddb4bc1..67ff27fff4689833b26b150f63ec823bef663056 100644 --- a/Apps/Tuto/tuto_oper3.ui +++ b/Apps/Tuto/tuto_oper3.ui @@ -99,6 +99,11 @@ collapseVolume + + + splitVertex + + diff --git a/include/Topology/map/embeddedMap3.h b/include/Topology/map/embeddedMap3.h index e1d816b3fb31fc655bb5262b4eecb4bc6ad95c25..bac9463e34e5fcc23ab141828b23e3f88b275e50 100644 --- a/include/Topology/map/embeddedMap3.h +++ b/include/Topology/map/embeddedMap3.h @@ -37,6 +37,12 @@ class EmbeddedMap3 : public Map3 public: typedef Map3 TOPO_MAP; + //! + /*! + * + */ + virtual void splitVertex(Dart d, Dart e); + //! /*! */ diff --git a/include/Topology/map/map2MR/filters_Primal.h b/include/Topology/map/map2MR/filters_Primal.h index 306a83c26eb8038182e9cafb57bafce6c503597a..b59e2ec9db935322a8dc6371a92fa03c8e456ef2 100644 --- a/include/Topology/map/map2MR/filters_Primal.h +++ b/include/Topology/map/map2MR/filters_Primal.h @@ -546,6 +546,31 @@ public: } } ; +/********************************************************************************* + * PROGRESSIVE MESHES FUNCTORS + *********************************************************************************/ +template +class pipoPMAnalysisFilter +{ +protected: + typename PFP::MAP& m_map; + typename PFP::TVEC3& m_position; + //Algo::PMesh::ProgressiveMesh *m_pmesh; + +public: + pipoPMAnalysisFilter(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) + {} + + bool operator() () + { + for(Dart dit = m_map.begin() ; dit != m_map.end() ; dit = m_map.next()) + { + return false; + } + } +}; + + } // namespace Multiresolution } // namespace CGoGN diff --git a/include/Topology/map/map2MR/map2MR_PM.h b/include/Topology/map/map2MR/map2MR_PM.h index 7bf470c2302da4b85d0e5bd2b4f36fdf43f5dd16..da37650c45f8da1cccd1ae43a1ff22ee6ff2f78d 100644 --- a/include/Topology/map/map2MR/map2MR_PM.h +++ b/include/Topology/map/map2MR/map2MR_PM.h @@ -60,6 +60,8 @@ public: Map2MR_PM() ; virtual std::string mapTypeName() const { return "Map2MR_PM" ; } + + //add a coarse level void addNewLevel(bool embedNewVertices = true) ; void addSynthesisFilter(Multiresolution::MRFilter* f) { synthesisFilters.push_back(f) ; } diff --git a/include/Topology/map/map3.h b/include/Topology/map/map3.h index bc6375c52663af274721dadb58409b04948e86f6..138302538e1b8507e89689113dc4b6c9df7ef555 100644 --- a/include/Topology/map/map3.h +++ b/include/Topology/map/map3.h @@ -137,6 +137,15 @@ public: *************************************************************************/ //@{ + //! Split the vertex + /*! \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 + */ + virtual void splitVertex(Dart d, Dart e); + //! Delete the vertex of d /*! All the volumes around the vertex are merged into one volume * @param d a dart of the vertex to delete diff --git a/src/Topology/map/embeddedMap3.cpp b/src/Topology/map/embeddedMap3.cpp index e87a738559725d0d4926b22c0761972d1ff473c6..775b70dc613575f44a26fab0e081a207d5e49dab 100644 --- a/src/Topology/map/embeddedMap3.cpp +++ b/src/Topology/map/embeddedMap3.cpp @@ -27,6 +27,30 @@ namespace CGoGN { +void EmbeddedMap3::splitVertex(Dart d, Dart e) +{ + + Map3::splitVertex(d, e); + + if(isOrbitEmbedded(VERTEX)) + { + embedOrbit(VERTEX, d, getEmbedding(VERTEX, d)); + embedNewCell(VERTEX, phi2(phi1(phi2(d)))); + copyCell(VERTEX, phi2(phi1(phi2(d))), d); + } + + if(isOrbitEmbedded(EDGE)) + { + + } + + if(isOrbitEmbedded(VOLUME)) + { + embedOrbit(VOLUME, d, getEmbedding(VOLUME, d)) ; + embedOrbit(VOLUME, e, getEmbedding(VOLUME, e)) ; + } +} + Dart EmbeddedMap3::deleteVertex(Dart d) { Dart v = Map3::deleteVertex(d) ; diff --git a/src/Topology/map/map2.cpp b/src/Topology/map/map2.cpp index 11131528c4e67ea6036ca23cf3e97ef310356d43..70d93791a2b84775b7ccf8c45b980495ed74526b 100644 --- a/src/Topology/map/map2.cpp +++ b/src/Topology/map/map2.cpp @@ -196,7 +196,7 @@ void Map2::fillHole(Dart d) void Map2::splitVertex(Dart d, Dart e) { - assert(sameOrientedVertex(d, e)) ; + assert(sameVertex(d, e)) ; Dart d2 = phi2(d) ; assert(d != d2) ; Dart e2 = phi2(e) ; assert(e != e2) ; Dart nd = Map1::cutEdge(d2) ; // Cut the edge of dd (make a new half edge) diff --git a/src/Topology/map/map3.cpp b/src/Topology/map/map3.cpp index c1b8c36ca5d46fbeb9963d5c9c40c6b31f6399ed..6f789361ca797adb84069c5a948039860498f4bb 100644 --- a/src/Topology/map/map3.cpp +++ b/src/Topology/map/map3.cpp @@ -129,6 +129,30 @@ void Map3::fillHole(Dart d) * Topological operations on 3-maps *************************************************************************/ +void Map3::splitVertex(Dart d, Dart e) +{ + assert(sameVertex(d,e)); + assert(!sameVolume(d,e)); + + if(isBoundaryVertex(d)) + { + unsewVolumes(d); + unsewVolumes(e); + + Dart dc = phi1(phi2(d)); + + //unsewVolumes(phi2(dc)); + Map2::splitVertex(d, phi1(phi2(dc))); + + +// Map2::splitFace(d, phi2(dc)); + +// Dart ec = phi_1(phi2(e)); +// Map2::splitVertex(e, ec); +// //Map2::splitFace(e, phi2(ec)); + } +} + Dart Map3::deleteVertex(Dart d) { if(isBoundaryVertex(d))