Commit c8942970 authored by untereiner's avatar untereiner

begin vertexSplit and PM multires

parent 2e2ac038
......@@ -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 *
**********************************************************************************************/
......
......@@ -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);
......
......@@ -319,6 +319,18 @@ int main(int argc, char **argv)
position = myMap.getAttribute<PFP::VEC3>(VERTEX , attrNames[0]) ;
}
if(extension == std::string(".node"))
{
if(!Algo::Import::importMeshV<PFP>(myMap, argv[1], attrNames, Algo::Import::ImportVolumique::NODE))
{
std::cerr << "could not import " << argv[1] << std::endl ;
return 1;
}
else
position = myMap.getAttribute<PFP::VEC3>(VERTEX , attrNames[0]) ;
}
if(extension == std::string(".off"))
{
if(!Algo::Import::importMeshToExtrude<PFP>(myMap, argv[1], attrNames))
......
......@@ -74,7 +74,7 @@ void MyQT::operation(int x)
PFP::VEC3 c1 = Algo::Geometry::faceCentroid<PFP>(myMap, m_selected, position);
PFP::VEC3 c2 = Algo::Geometry::faceCentroid<PFP>(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;
......
......@@ -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"<<CGoGNendl;
if(m_selected != NIL && m_selected2 != NIL)
{
PFP::VEC3 c1 = Algo::Geometry::faceCentroid<PFP>(myMap, myMap.findBoundaryFaceOfEdge(m_selected), position);
PFP::VEC3 c2 = Algo::Geometry::faceCentroid<PFP>(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;
}
......
......@@ -99,6 +99,11 @@
<string>collapseVolume</string>
</property>
</item>
<item>
<property name="text">
<string>splitVertex</string>
</property>
</item>
</widget>
</item>
<item>
......
......@@ -37,6 +37,12 @@ class EmbeddedMap3 : public Map3
public:
typedef Map3 TOPO_MAP;
//!
/*!
*
*/
virtual void splitVertex(Dart d, Dart e);
//!
/*!
*/
......
......@@ -546,6 +546,31 @@ public:
}
} ;
/*********************************************************************************
* PROGRESSIVE MESHES FUNCTORS
*********************************************************************************/
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)
{}
bool operator() ()
{
for(Dart dit = m_map.begin() ; dit != m_map.end() ; dit = m_map.next())
{
return false;
}
}
};
} // namespace Multiresolution
} // namespace CGoGN
......
......@@ -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) ; }
......
......@@ -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
......
......@@ -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) ;
......
......@@ -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)
......
......@@ -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))
......
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