Commit 6126aa17 authored by untereiner's avatar untereiner

vertexSplit next

parent 0b827205
......@@ -150,6 +150,7 @@ void MyQT::operation(int x)
if (!m_selecteds.empty())
{
myMap.splitVolume(m_selecteds);
m_selecteds.clear();
dm.markAll();
updateMap();
}
......@@ -182,11 +183,15 @@ void MyQT::operation(int x)
CGoGNout <<"split vertex"<<CGoGNendl;
if (!m_selecteds.empty())
{
std::cout << "nb darts before = " << myMap.getNbDarts() << std::endl;
Dart dit = m_selecteds.front();
PFP::VEC3 c1 = Algo::Geometry::faceCentroid<PFP>(myMap, dit, position);
myMap.splitVertex(m_selecteds);
position[dit] = position[dit] * 0.7f + c1*0.3f;
PFP::VEC3 c1 = Algo::Geometry::volumeCentroid<PFP>(myMap, dit, position);
Dart dres = myMap.splitVertex(m_selecteds);
position[dres] = position[dit]*0.5f - c1*0.5f;
m_selecteds.clear();
dm.markAll();
updateMap();
std::cout << "nb darts after = " << myMap.getNbDarts() << std::endl;
}
break;
default:
......
......@@ -41,7 +41,7 @@ public:
/*!
*
*/
virtual void splitVertex(std::vector<Dart>& vd);
virtual Dart splitVertex(std::vector<Dart>& vd);
//!
/*!
......
......@@ -26,6 +26,7 @@
#define __MR_FILTERS_PRIMAL__
#include <cmath>
//#include "Algo/Decimation/decimation.h"
namespace CGoGN
{
......@@ -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:
pipoPMAnalysisFilter(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p)
{}
//template <typename PFP>
//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
......
......@@ -31,7 +31,6 @@
#include "Topology/map/map2MR/filters_Primal.h"
#include "Algo/Modelisation/subdivision.h"
namespace CGoGN
{
......@@ -51,8 +50,7 @@ class Map2MR_PM : public EmbeddedMap2
protected:
bool shareVertexEmbeddings ;
std::vector<Multiresolution::MRFilter*> synthesisFilters ;
std::vector<Multiresolution::MRFilter*> analysisFilters ;
//Multiresolution::DecimateFilter* filter ;
DartMarkerStore* selectedEdges;
......@@ -64,11 +62,7 @@ public:
//add a coarse level
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 addDecimationFilter(Multiresolution::DecimateFilter *f) { filter = f; }
void analysis() ;
void synthesis() ;
......
......@@ -143,7 +143,7 @@ public:
* \per Works only on the boundary
* @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
/*! All the volumes around the vertex are merged into one volume
......
......@@ -27,18 +27,18 @@
namespace CGoGN
{
void EmbeddedMap3::splitVertex(std::vector<Dart>& vd)
Dart EmbeddedMap3::splitVertex(std::vector<Dart>& vd)
{
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))
{
embedNewCell(VERTEX, d2);
copyCell(VERTEX, d2, d);
embedOrbit(VERTEX, d, getEmbedding(VERTEX, d));
embedNewCell(VERTEX, d3);
copyCell(VERTEX, d3, d);
}
if(isOrbitEmbedded(EDGE))
......@@ -53,6 +53,8 @@ void EmbeddedMap3::splitVertex(std::vector<Dart>& vd)
embedOrbit(VOLUME, *it, getEmbedding(VOLUME, *it)) ;
}
}
return dres;
}
Dart EmbeddedMap3::deleteVertex(Dart d)
......
......@@ -60,7 +60,6 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices)
setCurrentLevel(0);
//DartMarker me(*this);
selectedEdges = new DartMarkerStore(*this);
TraversorE<Map2MR_PM> travE(*this);
......@@ -103,6 +102,8 @@ void Map2MR_PM::addNewLevel(bool embedNewVertices)
}
}
}
//(*filter).decimate() ;
}
void Map2MR_PM::analysis()
......@@ -111,16 +112,14 @@ void Map2MR_PM::analysis()
decCurrentLevel() ;
for(unsigned int i = 0; i < analysisFilters.size(); ++i)
(*analysisFilters[i])() ;
//(*filter).coarsen() ;
}
void Map2MR_PM::synthesis()
{
assert(getCurrentLevel() < getMaxLevel() || !"synthesis : called on max level") ;
for(unsigned int i = 0; i < synthesisFilters.size(); ++i)
(*synthesisFilters[i])() ;
//(*filter).refine() ;
incCurrentLevel() ;
}
......
......@@ -129,17 +129,80 @@ void Map3::fillHole(Dart d)
* 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));
//unsew the face path
for(std::vector<Dart>::iterator it = vd.begin() ; it != vd.end() ; ++it)
//case BoundaryVertex ??
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))
{
......@@ -159,7 +222,7 @@ void Map3::splitVertex(std::vector<Dart>& vd)
// //Map2::splitFace(e, phi2(ec));
}
*/
}
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