Commit 6126aa17 authored by untereiner's avatar untereiner

vertexSplit next

parent 0b827205
...@@ -150,6 +150,7 @@ void MyQT::operation(int x) ...@@ -150,6 +150,7 @@ void MyQT::operation(int x)
if (!m_selecteds.empty()) if (!m_selecteds.empty())
{ {
myMap.splitVolume(m_selecteds); myMap.splitVolume(m_selecteds);
m_selecteds.clear();
dm.markAll(); dm.markAll();
updateMap(); updateMap();
} }
...@@ -182,11 +183,15 @@ void MyQT::operation(int x) ...@@ -182,11 +183,15 @@ void MyQT::operation(int x)
CGoGNout <<"split vertex"<<CGoGNendl; CGoGNout <<"split vertex"<<CGoGNendl;
if (!m_selecteds.empty()) if (!m_selecteds.empty())
{ {
std::cout << "nb darts before = " << myMap.getNbDarts() << std::endl;
Dart dit = m_selecteds.front(); Dart dit = m_selecteds.front();
PFP::VEC3 c1 = Algo::Geometry::faceCentroid<PFP>(myMap, dit, position); PFP::VEC3 c1 = Algo::Geometry::volumeCentroid<PFP>(myMap, dit, position);
myMap.splitVertex(m_selecteds); Dart dres = myMap.splitVertex(m_selecteds);
position[dit] = position[dit] * 0.7f + c1*0.3f; position[dres] = position[dit]*0.5f - c1*0.5f;
m_selecteds.clear();
dm.markAll();
updateMap(); updateMap();
std::cout << "nb darts after = " << myMap.getNbDarts() << std::endl;
} }
break; break;
default: default:
......
...@@ -41,7 +41,7 @@ public: ...@@ -41,7 +41,7 @@ public:
/*! /*!
* *
*/ */
virtual void splitVertex(std::vector<Dart>& vd); virtual Dart splitVertex(std::vector<Dart>& vd);
//! //!
/*! /*!
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#define __MR_FILTERS_PRIMAL__ #define __MR_FILTERS_PRIMAL__
#include <cmath> #include <cmath>
//#include "Algo/Decimation/decimation.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -547,28 +548,43 @@ public: ...@@ -547,28 +548,43 @@ public:
} ; } ;
/********************************************************************************* /*********************************************************************************
* PROGRESSIVE MESHES FUNCTORS * MR PROGRESSIVE MESHES FUNCTOR
*********************************************************************************/ *********************************************************************************/
template <typename PFP>
class pipoPMAnalysisFilter
{
protected:
typename PFP::MAP& m_map;
typename PFP::TVEC3& m_position;
//Algo::PMesh::ProgressiveMesh<PFP> *m_pmesh;
public: //template <typename PFP>
pipoPMAnalysisFilter(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) //class DecimateFilter
{} //{
//protected:
// typename PFP::MAP& m_map;
// typename PFP::TVEC3& m_position;
// //Algo::Decimation::SelectorType m_s;
// //Algo::Decimation::ApproximatorType m_a;
// unsigned int m_nbWantedVertices;
// FunctorSelect& m_selected;
//
//
//public:
// DecimateFilter(typename PFP::MAP& m, typename PFP::TVEC3& p,
// //Algo::Decimation::SelectorType s, Algo::Decimation::ApproximatorType a,
// unsigned int nbWantedVertices, const FunctorSelect& selected) :
// m_map(m), m_position(p), m_s(s), m_a(a), m_nbWantedVertices(nbWantedVertices), m_selected(selected) {}
//
// void decimate ()
// {
// // Algo::Decimation::decimate<PFP>(m_map, m_s, m_a, m_position, m_nbWantedVertices, m_selected);
// }
//
// void coarsen()
// {
//
// }
//
// void refine()
// {
//
// }
//} ;
bool operator() ()
{
for(Dart dit = m_map.begin() ; dit != m_map.end() ; dit = m_map.next())
{
return false;
}
}
};
} // namespace Multiresolution } // namespace Multiresolution
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
#include "Topology/map/map2MR/filters_Primal.h" #include "Topology/map/map2MR/filters_Primal.h"
#include "Algo/Modelisation/subdivision.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -51,8 +50,7 @@ class Map2MR_PM : public EmbeddedMap2 ...@@ -51,8 +50,7 @@ class Map2MR_PM : public EmbeddedMap2
protected: protected:
bool shareVertexEmbeddings ; bool shareVertexEmbeddings ;
std::vector<Multiresolution::MRFilter*> synthesisFilters ; //Multiresolution::DecimateFilter* filter ;
std::vector<Multiresolution::MRFilter*> analysisFilters ;
DartMarkerStore* selectedEdges; DartMarkerStore* selectedEdges;
...@@ -64,11 +62,7 @@ public: ...@@ -64,11 +62,7 @@ public:
//add a coarse level //add a coarse level
void addNewLevel(bool embedNewVertices = true) ; void addNewLevel(bool embedNewVertices = true) ;
void addSynthesisFilter(Multiresolution::MRFilter* f) { synthesisFilters.push_back(f) ; } //void addDecimationFilter(Multiresolution::DecimateFilter *f) { filter = f; }
void addAnalysisFilter(Multiresolution::MRFilter* f) { analysisFilters.push_back(f) ; }
void clearSynthesisFilters() { synthesisFilters.clear() ; }
void clearAnalysisFilters() { analysisFilters.clear() ; }
void analysis() ; void analysis() ;
void synthesis() ; void synthesis() ;
......
...@@ -143,7 +143,7 @@ public: ...@@ -143,7 +143,7 @@ public:
* \per Works only on the boundary * \per Works only on the boundary
* @param vd a vector of darts * @param vd a vector of darts
*/ */
virtual void splitVertex(std::vector<Dart>& vd); virtual Dart splitVertex(std::vector<Dart>& vd);
//! Delete the vertex of d //! Delete the vertex of d
/*! All the volumes around the vertex are merged into one volume /*! All the volumes around the vertex are merged into one volume
......
...@@ -27,18 +27,18 @@ ...@@ -27,18 +27,18 @@
namespace CGoGN namespace CGoGN
{ {
void EmbeddedMap3::splitVertex(std::vector<Dart>& vd) Dart EmbeddedMap3::splitVertex(std::vector<Dart>& vd)
{ {
Dart d = vd.front(); Dart d = vd.front();
Dart d3 = phi2(phi3(d)); Dart d2 = phi1(phi2(d));
Map3::splitVertex(vd); Dart dres = Map3::splitVertex(vd);
if(isOrbitEmbedded(VERTEX)) if(isOrbitEmbedded(VERTEX))
{ {
embedNewCell(VERTEX, d2);
copyCell(VERTEX, d2, d);
embedOrbit(VERTEX, d, getEmbedding(VERTEX, d)); embedOrbit(VERTEX, d, getEmbedding(VERTEX, d));
embedNewCell(VERTEX, d3);
copyCell(VERTEX, d3, d);
} }
if(isOrbitEmbedded(EDGE)) if(isOrbitEmbedded(EDGE))
...@@ -53,6 +53,8 @@ void EmbeddedMap3::splitVertex(std::vector<Dart>& vd) ...@@ -53,6 +53,8 @@ void EmbeddedMap3::splitVertex(std::vector<Dart>& vd)
embedOrbit(VOLUME, *it, getEmbedding(VOLUME, *it)) ; embedOrbit(VOLUME, *it, getEmbedding(VOLUME, *it)) ;
} }
} }
return dres;
} }
Dart EmbeddedMap3::deleteVertex(Dart d) Dart EmbeddedMap3::deleteVertex(Dart d)
......
...@@ -60,7 +60,6 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices) ...@@ -60,7 +60,6 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices)
setCurrentLevel(0); setCurrentLevel(0);
//DartMarker me(*this);
selectedEdges = new DartMarkerStore(*this); selectedEdges = new DartMarkerStore(*this);
TraversorE<Map2MR_PM> travE(*this); TraversorE<Map2MR_PM> travE(*this);
...@@ -103,6 +102,8 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices) ...@@ -103,6 +102,8 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices)
} }
} }
} }
//(*filter).decimate() ;
} }
void Map2MR_PM::analysis() void Map2MR_PM::analysis()
...@@ -111,16 +112,14 @@ void Map2MR_PM::analysis() ...@@ -111,16 +112,14 @@ void Map2MR_PM::analysis()
decCurrentLevel() ; decCurrentLevel() ;
for(unsigned int i = 0; i < analysisFilters.size(); ++i) //(*filter).coarsen() ;
(*analysisFilters[i])() ;
} }
void Map2MR_PM::synthesis() void Map2MR_PM::synthesis()
{ {
assert(getCurrentLevel() < getMaxLevel() || !"synthesis : called on max level") ; assert(getCurrentLevel() < getMaxLevel() || !"synthesis : called on max level") ;
for(unsigned int i = 0; i < synthesisFilters.size(); ++i) //(*filter).refine() ;
(*synthesisFilters[i])() ;
incCurrentLevel() ; incCurrentLevel() ;
} }
......
...@@ -129,17 +129,80 @@ void Map3::fillHole(Dart d) ...@@ -129,17 +129,80 @@ void Map3::fillHole(Dart d)
* Topological operations on 3-maps * Topological operations on 3-maps
*************************************************************************/ *************************************************************************/
void Map3::splitVertex(std::vector<Dart>& vd) Dart Map3::splitVertex(std::vector<Dart>& vd)
{ {
//assert(checkPathAroundVertex(vd)) ; assert(sameVertex(d,e)); //assert(checkPathAroundVertex(vd)) ; assert(sameVertex(d,e));
//unsew the face path //case BoundaryVertex ??
for(std::vector<Dart>::iterator it = vd.begin() ; it != vd.end() ; ++it)
Dart prev = vd.front(); //elt 0
Dart fs = phi_1(phi2(phi_1(prev))); //first side
Dart ss = phi2(prev); //second side
Map2::splitVertex(prev, phi2(fs));
// Map1::cutEdge(fs); //comme un vertexSplit
// Map1::cutEdge(ss);
// phi2sew(phi1(ss), phi1(fs));
for(unsigned int i = 1; i < vd.size(); ++i)
{
Dart d3 = phi1(ss);
prev = vd[i];
Dart fs = phi_1(phi2(phi_1(prev))); //first side
Dart ss = phi2(prev); //second side
Map2::splitVertex(prev, phi2(fs));
// Map1::cutEdge(fs); //comme un vertexSplit
// Map1::cutEdge(ss);
// phi2sew(phi1(ss), phi1(fs));
}
for(unsigned int i = 0 ; i < vd.size() ; ++i)
{ {
unsewVolumes(*it); Dart d1 = phi_1(phi2(phi_1(vd[i])));
Dart d2 = phi1(phi3(phi2(phi_1(vd[i]))));
phi3sew(d1, d2);
} }
return phi_1(phi2(phi_1(prev)));
}
// //unsew the face path
// for(std::vector<Dart>::iterator it = vd.begin() ; it != vd.end() ; ++it)
// {
// Dart dit = *it;
//
// Map1::cutEdge(phi_1(phi2(phi_1(dit)))); //comme un vertexSplit
// Map1::cutEdge(phi2(phi1(phi2(dit))));
// Map2::sewFaces(phi1(phi2(phi1(phi2(dit)))), phi_1(phi2(phi_1(dit))), false);
//
//
//
// Dart dit3 = phi3(dit);
// unsewVolumes(dit);
// Dart f1 = newFace(3,false);
// Dart f2 = newFace(3,false);
// Dart f3 = newFace(3,false);
// Dart f4 = newFace(3,false);
//
// sewFaces(f1,f2,false);
// sewFaces(phi_1(f1), f3, false);
// sewFaces(phi1(f1), f4, false);
// sewFaces(phi_1(f2), phi1(f4), false);
// sewFaces(phi_1(f3), phi1(f2), false);
// sewFaces(phi1(f3), phi_1(f4), false);
//
// sewVolumes(dit,f3);
// sewVolumes(dit3,f4);
// }
/* /*
if(isBoundaryVertex(d)) if(isBoundaryVertex(d))
{ {
...@@ -159,7 +222,7 @@ void Map3::splitVertex(std::vector<Dart>& vd) ...@@ -159,7 +222,7 @@ void Map3::splitVertex(std::vector<Dart>& vd)
// //Map2::splitFace(e, phi2(ec)); // //Map2::splitFace(e, phi2(ec));
} }
*/ */
}
Dart Map3::deleteVertex(Dart d) Dart Map3::deleteVertex(Dart d)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment