Commit aa1b60e5 authored by Lionel Untereiner's avatar Lionel Untereiner

ihm are working without one level of difference

parent f00adb26
......@@ -170,7 +170,7 @@ public:
void swapEdges(Dart d, Dart e);
void splitVolume(std::vector<Dart>& vd);
// void addSynthesisFilter(Algo::MR::Filter* f) { synthesisFilters.push_back(f) ; }
......@@ -261,6 +261,10 @@ public:
*/
unsigned int getNewEdgeId() ;
unsigned int getMaxFaceId() {
return m_faceIdCount;
}
//! Return the id of the edge of d
/*!
*/
......
......@@ -86,6 +86,8 @@ inline Dart ImplicitHierarchicalMap3::newDart()
{
Dart d = Map3::newDart() ;
m_dartLevel[d] = m_curLevel ;
// m_edgeId[d] = EMBNULL;
// m_faceId[d] = EMBNULL;
if(m_curLevel > m_maxLevel) // update max level
m_maxLevel = m_curLevel ; // if needed
return d ;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -442,7 +442,7 @@ void CatmullClarkInterpolSubdivision(typename PFP::MAP& map, EMBV& attributs)
typedef typename PFP::MAP MAP;
typedef typename EMBV::DATA_TYPE EMB;
VertexAutoAttribute<EMB, PFP::MAP> facesAverage(map);
VertexAutoAttribute<EMB, typename PFP::MAP> facesAverage(map);
std::vector<Dart> l_vertices;
std::vector<Dart> l_edges;
......
......@@ -56,11 +56,8 @@ public:
bool operator() (Dart d)
{
std::cout << "dartIndex(d) = " << m_map.dartIndex(d) << std::endl;
m_map.decCurrentLevel() ;
std::cout << "dartIndex(d) = " << m_map.dartIndex(d) << std::endl;
typename PFP::VEC3 p = m_position[d] ;
std::cout << "p = " << p << std::endl;
m_map.incCurrentLevel() ;
m_position[d] = p ;
......
......@@ -62,10 +62,10 @@ class LerpQuadOddSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpQuadOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpQuadOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -156,10 +156,10 @@ class LerpQuadOddAnalysisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpQuadOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpQuadOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -251,10 +251,10 @@ class LerpTriOddSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpTriOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpTriOddSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -321,10 +321,10 @@ class LerpTriOddAnalysisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpTriOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpTriOddAnalysisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -408,10 +408,10 @@ class LerpEdgeSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpEdgeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpEdgeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -436,10 +436,10 @@ class LerpFaceSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -465,10 +465,10 @@ class LerpTriQuadFaceSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpTriQuadFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpTriQuadFaceSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -496,10 +496,10 @@ class LerpVolumeSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -527,10 +527,10 @@ class LerpTriQuadVolumeSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpTriQuadVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpTriQuadVolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
void operator() ()
......@@ -590,10 +590,10 @@ class LerpSqrt3VolumeSynthesisFilter : public Algo::MR::Filter
{
protected:
typename PFP::MAP& m_map ;
VertexAttribute<typename PFP::VEC3>& m_position ;
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& m_position ;
public:
LerpSqrt3VolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3>& p) : m_map(m), m_position(p)
LerpSqrt3VolumeSynthesisFilter(typename PFP::MAP& m, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
Dart findDartOfCentralVertex(Dart d)
......
......@@ -109,6 +109,7 @@ public:
}
else
{
std::cout << "not boundary" << std::endl;
m_map.decCurrentLevel() ;
EMB P = m_attribut[d];
......@@ -209,6 +210,8 @@ public:
}
else
{
std::cout << "not boundary" << std::endl;
Dart d2 = m_map.phi2(d);
m_map.decCurrentLevel() ;
......@@ -289,6 +292,8 @@ public:
}
else
{
std::cout << "not boundary" << std::endl;
Dart df = m_map.phi1(m_map.phi1(d)) ;
m_map.decCurrentLevel() ;
......
......@@ -27,6 +27,9 @@
#include <cmath>
#include "Algo/Geometry/centroid.h"
#include "Algo/Modelisation/tetrahedralization.h"
#include "Topology/generic/traversor/traversor2_closed.h"
namespace CGoGN
{
......@@ -51,7 +54,7 @@ namespace Masks
* LOOP BASIC FUNCTIONS
*********************************************************************************/
template <typename PFP>
typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d1)
typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& position, Dart d1)
{
Dart d2 = map.phi2(d1) ;
Dart d3 = map.phi_1(d1) ;
......@@ -71,7 +74,7 @@ typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const AttributeHandler<
}
template <typename PFP>
typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d)
typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& position, Dart d)
{
map.incCurrentLevel() ;
......@@ -97,11 +100,11 @@ typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const AttributeHandler
* SHW04 BASIC FUNCTIONS : tetrahedral/octahedral meshes
*********************************************************************************/
template <typename PFP>
typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d)
typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& position, Dart d)
{
typename PFP::VEC3 res(0);
if(map.isTetrahedron(d))
if(Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron<PFP>(map, Vol(d)))
{
Dart d1 = map.phi1(d) ;
Dart d2 = map.phi_1(d);
......@@ -157,10 +160,10 @@ class SHW04VertexVertexFunctor : public FunctorType
{
protected:
typename PFP::MAP& m_map ;
AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& m_position ;
public:
SHW04VertexVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
SHW04VertexVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
bool operator() (Dart d)
......@@ -174,7 +177,7 @@ public:
typename PFP::VEC3 np(0) ;
unsigned int degree = 0 ;
Traversor2VVaE<typename PFP::MAP> trav(m_map, db) ;
ClosedMap::Traversor2VVaE<typename PFP::MAP> trav(m_map, db) ;
for(Dart it = trav.begin(); it != trav.end(); it = trav.next())
{
++degree ;
......@@ -220,10 +223,10 @@ class SHW04EdgeVertexFunctor : public FunctorType
{
protected:
typename PFP::MAP& m_map ;
AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& m_position ;
public:
SHW04EdgeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
SHW04EdgeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
bool operator() (Dart d)
......@@ -235,6 +238,12 @@ public:
Dart d1 = m_map.findBoundaryFaceOfEdge(dd);
// Dart db = m_map.findBoundaryFaceOfEdge(d);
// Dart d1 = m_map.phi2(db) ;
// m_map.decCurrentLevel() ;
Dart d2 = m_map.phi2(d1) ;
Dart d3 = m_map.phi_1(d1) ;
Dart d4 = m_map.phi_1(d2) ;
......@@ -288,10 +297,10 @@ class SHW04VolumeVertexFunctor : public FunctorType
{
protected:
typename PFP::MAP& m_map ;
AttributeHandler<typename PFP::VEC3, VERTEX>& m_position;
AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& m_position;
public:
SHW04VolumeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
SHW04VolumeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX, typename PFP::MAP>& p) : m_map(m), m_position(p)
{}
bool operator() (Dart d)
......@@ -299,7 +308,7 @@ public:
Dart df = m_map.phi_1(m_map.phi2(m_map.phi1(d))) ;
m_map.decCurrentLevel() ;
typename PFP::VEC3 p = Algo::Geometry::volumeCentroid<PFP>(m_map, df, m_position);
typename PFP::VEC3 p = Algo::Surface::Geometry::volumeCentroid<PFP>(m_map, df, m_position);
m_map.incCurrentLevel() ;
m_position[d] = p ;
......
......@@ -166,6 +166,9 @@ public:
* MAP MANIPULATION *
***************************************************/
unsigned int faceDegree(Dart d);
unsigned int vertexDegree2(Dart d);
/***************************************************
* LEVELS MANAGEMENT *
......
......@@ -451,6 +451,18 @@ inline void ImplicitHierarchicalMap3::foreach_dart_of_cc(Dart d, FUNC& f) const
}
inline unsigned int ImplicitHierarchicalMap3::faceDegree(Dart d)
{
unsigned int count = 0 ;
Dart it = d ;
do
{
++count ;
it = phi1(it) ;
} while (it != d) ;
return count ;
}
/***************************************************
* LEVELS MANAGEMENT *
***************************************************/
......
......@@ -1012,7 +1012,7 @@ Dart Map3<MAP_IMPL>::findBoundaryFaceOfVertex(Dart d) const
for(unsigned int i = 0; i < darts.size(); ++i)
{
if(this->isBoundaryMarked<3>(darts[i]))
if(this->template isBoundaryMarked<3>(darts[i]))
return darts[i];
//add phi21 and phi23 successor if they are not marked yet
......
......@@ -140,6 +140,25 @@ void ImplicitHierarchicalMap3::swapEdges(Dart d, Dart e)
}
}
void ImplicitHierarchicalMap3::splitVolume(std::vector<Dart> &vd)
{
EmbeddedMap3::splitVolume(vd);
for(unsigned int i = 0 ; i < vd.size() ; i++)
{
Dart d = vd[i];
Dart d2 = phi2(d);
Dart d23 = phi3(d2);
Dart d232 = phi2(d23);
m_dartLevel[d2] = m_dartLevel[d232];
m_dartLevel[d23] = m_dartLevel[d];
m_edgeId[d2] = m_edgeId[d];
m_edgeId[d23] = m_edgeId[d];
}
}
void ImplicitHierarchicalMap3::saveRelationsAroundVertex(Dart d, std::vector<std::pair<Dart, Dart> >& vd)
{
assert(m_dartLevel[d] <= m_curLevel || !"Access to a dart introduced after current level") ;
......@@ -358,7 +377,7 @@ unsigned int ImplicitHierarchicalMap3::faceLevel(Dart d)
{ // but not the face itself
++nbSubd ; // is treated here
it = phi1(it) ;
} while(m_edgeId[it] == eId) ;
} while(m_edgeId[it] == eId && m_dartLevel[it] != l_old) ;
while(nbSubd > 1)
{
......@@ -434,7 +453,7 @@ unsigned int ImplicitHierarchicalMap3::volumeLevel(Dart d)
{ // but not the face itself
++nbSubd ; // is treated here
it = phi1(it) ;
} while(m_edgeId[it] == eId) ;
} while(m_edgeId[it] == eId && m_dartLevel[it] != l_old) ;
while(nbSubd > 1)
{
......@@ -475,17 +494,25 @@ unsigned int ImplicitHierarchicalMap3::volumeLevel(Dart d)
//Second : the case of all faces regularly subdivided but not the volume itself
unsigned int cur = m_curLevel ;
m_curLevel = vLevel ;
unsigned int nbSubd = 0 ;
Dart it = oldest ;
unsigned int fId = m_faceId[oldest] ;
unsigned int eId = m_edgeId[oldest] ;
unsigned int l_oldest = m_dartLevel[oldest];
do
{
++nbSubd ;
// it = phi1(phi2(phi1(it))) ;
it = phi1(it) ;
} while(m_edgeId[it] == eId) ;
while(m_edgeId[it]!=eId && m_faceId[it] == fId && m_dartLevel[it] != l_oldest)
{
it=phi1(phi2(it));
}
} while(m_faceId[it] == fId && m_dartLevel[it] != l_oldest) ;
while(nbSubd > 1)
......@@ -496,6 +523,7 @@ unsigned int ImplicitHierarchicalMap3::volumeLevel(Dart d)
m_curLevel = cur ;
return vLevel;
}
......
......@@ -64,14 +64,14 @@ void ImplicitHierarchicalMap3::clear(bool removeAttrib)
void ImplicitHierarchicalMap3::initImplicitProperties()
{
//initEdgeId() ;
//initFaceId();
initEdgeId() ;
initFaceId();
for(Dart d = Map3::begin(); d != Map3::end(); Map3::next(d))
{
m_edgeId[d] = 0;
m_faceId[d] = 0;
}
// for(Dart d = Map3::begin(); d != Map3::end(); Map3::next(d))
// {
// m_edgeId[d] = 0;
// m_faceId[d] = 0;
// }
for(unsigned int orbit = 0; orbit < NB_ORBITS; ++orbit)
{
......@@ -133,4 +133,16 @@ void ImplicitHierarchicalMap3::initFaceId()
}
}
unsigned int ImplicitHierarchicalMap3::vertexDegree2(Dart d)
{
unsigned int count = 0 ;
Dart it = d ;
do
{
++count ;
it = phi2(phi_1(it)) ;
} while (it != d) ;
return count ;
}
} //namespace CGoGN
#ifndef _VOLUME_RENDER_PLUGIN_H_
#define _VOLUME_RENDER_PLUGIN_H_
#include "plugin_interaction.h"
#include "volume_render_dockTab.h"
#include "Algo/Render/GL2/explodeVolumeRender.h"
namespace CGoGN
{
namespace SCHNApps
{
class MapHandlerGen;
struct MapParameters
{
enum FaceShadingStyle
{
FLAT = 0,
SMOOTH = 1
};
MapParameters():
m_renderExplod(NULL),
facesScaleFactor(1.0f),
volumesScaleFactor(1.0f),
renderEdges(false),
renderFaces(true),
faceStyle(FLAT)
{}
Algo::Render::GL2::ExplodeVolumeRender* m_renderExplod;
// VertexAttribute<PFP3::VEC3> positionAttribute;
// VolumeAttribute<PFP3::VEC3> colorAttribute;
float facesScaleFactor;
float volumesScaleFactor;
bool renderEdges;
bool renderFaces;
FaceShadingStyle faceStyle;
// void updateRender();
};
class Volume_Render_Plugin : public Plugin
{
Q_OBJECT
Q_INTERFACES(CGoGN::SCHNApps::Plugin)
#if CGOGN_QT_DESIRED_VERSION == 5
Q_PLUGIN_METADATA(IID "CGoGN.SCHNapps.Plugin")
#endif
friend class Volume_Render_DockTab;
public:
Volume_Render_Plugin()
{}
~Volume_Render_Plugin()
{}
private:
virtual bool enable();
virtual void disable();
virtual void redraw(View *view);
virtual void drawMap(View* view, MapHandlerGen* map);
virtual void keyPress(View* view, QKeyEvent* event) {}
virtual void keyRelease(View* view, QKeyEvent* event) {}
virtual void mousePress(View* view, QMouseEvent* event) {}
virtual void mouseRelease(View* view, QMouseEvent* event) {}
virtual void mouseMove(View* view, QMouseEvent* event) {}
virtual void wheelEvent(View* view, QWheelEvent* event) {}
virtual void viewLinked(View *view) {}
virtual void viewUnlinked(View *view) {}
private slots:
// slots called from SCHNApps signals
void selectedViewChanged(View* prev, View* cur);
void selectedMapChanged(MapHandlerGen* prev, MapHandlerGen* cur);
void mapAdded(MapHandlerGen* map);
void mapRemoved(MapHandlerGen* map);
public slots:
// slots for Python calls
void changeVerticesScaleFactor(const QString&view, const QString& map, float f);
void changeRenderEdges(const QString& view, const QString& map, bool b);
void changeRenderFaces(const QString& view, const QString& map, bool b);
void changeFacesStyle(const QString& view, const QString& map, MapParameters::FaceShadingStyle style);
protected:
Volume_Render_DockTab* m_dockTab;
QHash<View*, QHash<MapHandlerGen*, MapParameters> > h_viewParameterSet;
};
} // namespace SCHNApps
} // namespace CGoGN
#endif
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