Commit 9a81ec0f authored by untereiner's avatar untereiner
Browse files

IHM3 modifications

parent 2fd71161
...@@ -36,6 +36,7 @@ namespace Algo ...@@ -36,6 +36,7 @@ namespace Algo
namespace IHM namespace IHM
{ {
template<typename T, unsigned int ORBIT> class AttributeHandler_IHM ; template<typename T, unsigned int ORBIT> class AttributeHandler_IHM ;
class ImplicitHierarchicalMap3 : public EmbeddedMap3 class ImplicitHierarchicalMap3 : public EmbeddedMap3
...@@ -160,6 +161,11 @@ public: ...@@ -160,6 +161,11 @@ public:
* Operations to manage the levels of an Implicit Hierarchical 3-map * Operations to manage the levels of an Implicit Hierarchical 3-map
*************************************************************************/ *************************************************************************/
void incCurrentLevel();
void decCurrentLevel();
//@{ //@{
//! //!
/*! /*!
...@@ -397,6 +403,15 @@ public: ...@@ -397,6 +403,15 @@ public:
} }
} ; } ;
template <typename T>
class VertexAttribute_IHM : public Algo::IHM::AttributeHandler_IHM<T, VERTEX>
{
public:
VertexAttribute_IHM() : Algo::IHM::AttributeHandler_IHM<T, VERTEX>() {}
VertexAttribute_IHM(const Algo::IHM::AttributeHandler_IHM<T, VERTEX>& ah) : Algo::IHM::AttributeHandler_IHM<T, VERTEX>(ah) {}
VertexAttribute_IHM<T>& operator=(const Algo::IHM::AttributeHandler_IHM<T, VERTEX>& ah) { this->Algo::IHM::AttributeHandler_IHM<T, VERTEX>::operator=(ah); return *this; }
};
} //namespace IHM } //namespace IHM
} //namespace Algo } //namespace Algo
......
...@@ -425,6 +425,24 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_face2(Dart d, FunctorType& ...@@ -425,6 +425,24 @@ inline bool ImplicitHierarchicalMap3::foreach_dart_of_face2(Dart d, FunctorType&
* LEVELS MANAGEMENT * * LEVELS MANAGEMENT *
***************************************************/ ***************************************************/
inline void ImplicitHierarchicalMap3::incCurrentLevel()
{
if(m_curLevel < m_maxLevel)
++m_curLevel ;
else
CGoGNout << "incCurrentLevel : already at maximum resolution level" << CGoGNendl ;
}
inline void ImplicitHierarchicalMap3::decCurrentLevel()
{
if(m_curLevel > 0)
--m_curLevel ;
else
CGoGNout << "decCurrentLevel : already at minimum resolution level" << CGoGNendl ;
}
inline unsigned int ImplicitHierarchicalMap3::getCurrentLevel() inline unsigned int ImplicitHierarchicalMap3::getCurrentLevel()
{ {
return m_curLevel ; return m_curLevel ;
......
...@@ -368,6 +368,8 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, AttributeHandler<typ ...@@ -368,6 +368,8 @@ Dart subdivideVolumeClassic(typename PFP::MAP& map, Dart d, AttributeHandler<typ
map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front())))); map.deleteVolume(map.phi3(map.phi2(map.phi1(oldEdges.front()))));
//map.computerVolumeVertexFunctor(oldEdges.front());
//Third step : 3-sew internal faces //Third step : 3-sew internal faces
for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it) for (std::vector<std::pair<Dart,Dart> >::iterator it = subdividedfaces.begin(); it != subdividedfaces.end(); ++it)
{ {
......
...@@ -62,7 +62,7 @@ protected: ...@@ -62,7 +62,7 @@ protected:
*/ */
MAP& m_map; MAP& m_map;
VertexAttribute<VEC3>& m_positions; AttributeHandler<typename PFP::VEC3, VERTEX>& m_positions;
/** /**
* Reference dart of primitive * Reference dart of primitive
...@@ -108,7 +108,7 @@ public: ...@@ -108,7 +108,7 @@ public:
* Constructor * Constructor
* @param map the map in which we want to work * @param map the map in which we want to work
*/ */
Primitive3D(MAP& map, VertexAttribute<VEC3>& position): Primitive3D(MAP& map, AttributeHandler<typename PFP::VEC3, VERTEX>& position) :
m_map(map), m_map(map),
m_positions(position), m_positions(position),
m_kind(NONE), m_kind(NONE),
......
...@@ -38,7 +38,7 @@ namespace Multiresolution ...@@ -38,7 +38,7 @@ namespace Multiresolution
* LOOP BASIC FUNCTIONS * LOOP BASIC FUNCTIONS
*********************************************************************************/ *********************************************************************************/
template <typename PFP> template <typename PFP>
typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart d1) typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d1)
{ {
Dart d2 = map.phi2(d1) ; Dart d2 = map.phi2(d1) ;
Dart d3 = map.phi_1(d1) ; Dart d3 = map.phi_1(d1) ;
...@@ -58,7 +58,7 @@ typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const typename PFP::TVE ...@@ -58,7 +58,7 @@ typename PFP::VEC3 loopOddVertex(typename PFP::MAP& map, const typename PFP::TVE
} }
template <typename PFP> template <typename PFP>
typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart d) typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d)
{ {
map.incCurrentLevel() ; map.incCurrentLevel() ;
...@@ -84,7 +84,7 @@ typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const typename PFP::TV ...@@ -84,7 +84,7 @@ typename PFP::VEC3 loopEvenVertex(typename PFP::MAP& map, const typename PFP::TV
* SHW04 BASIC FUNCTIONS : tetrahedral/octahedral meshes * SHW04 BASIC FUNCTIONS : tetrahedral/octahedral meshes
*********************************************************************************/ *********************************************************************************/
template <typename PFP> template <typename PFP>
typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart d) typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const AttributeHandler<typename PFP::VEC3, VERTEX>& position, Dart d)
{ {
typename PFP::VEC3 res(0); typename PFP::VEC3 res(0);
...@@ -143,7 +143,7 @@ typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const typename PFP::TVEC3 ...@@ -143,7 +143,7 @@ typename PFP::VEC3 SHW04Vertex(typename PFP::MAP& map, const typename PFP::TVEC3
/********************************************************************************* /*******************************MJ96EdgeVertexFunctor**************************************************
* FUNCTORS * FUNCTORS
*********************************************************************************/ *********************************************************************************/
...@@ -154,10 +154,10 @@ class LerpVertexVertexFunctor : public FunctorType ...@@ -154,10 +154,10 @@ class LerpVertexVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
LerpVertexVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) LerpVertexVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -177,10 +177,10 @@ class LerpEdgeVertexFunctor : public FunctorType ...@@ -177,10 +177,10 @@ class LerpEdgeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
LerpEdgeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) LerpEdgeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -203,10 +203,10 @@ class LerpFaceVertexFunctor : public FunctorType ...@@ -203,10 +203,10 @@ class LerpFaceVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
LerpFaceVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) LerpFaceVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -228,10 +228,10 @@ class LerpVolumeVertexFunctor : public FunctorType ...@@ -228,10 +228,10 @@ class LerpVolumeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
LerpVolumeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) LerpVolumeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -256,10 +256,10 @@ class SHW04VertexVertexFunctor : public FunctorType ...@@ -256,10 +256,10 @@ class SHW04VertexVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
SHW04VertexVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) SHW04VertexVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -319,10 +319,10 @@ class SHW04EdgeVertexFunctor : public FunctorType ...@@ -319,10 +319,10 @@ class SHW04EdgeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
SHW04EdgeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) SHW04EdgeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -387,10 +387,10 @@ class SHW04VolumeVertexFunctor : public FunctorType ...@@ -387,10 +387,10 @@ class SHW04VolumeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position;
public: public:
SHW04VolumeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) SHW04VolumeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -415,10 +415,10 @@ class MJ96VertexVertexFunctor : public FunctorType ...@@ -415,10 +415,10 @@ class MJ96VertexVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
MJ96VertexVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) MJ96VertexVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -517,10 +517,10 @@ class MJ96EdgeVertexFunctor : public FunctorType ...@@ -517,10 +517,10 @@ class MJ96EdgeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
MJ96EdgeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) MJ96EdgeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -531,7 +531,7 @@ public: ...@@ -531,7 +531,7 @@ public:
Dart d1 = m_map.phi2(db) ; Dart d1 = m_map.phi2(db) ;
m_map.decCurrentLevel() ; //m_map.decCurrentLevel() ;
Dart d2 = m_map.phi2(d1) ; Dart d2 = m_map.phi2(d1) ;
Dart d3 = m_map.phi_1(d1) ; Dart d3 = m_map.phi_1(d1) ;
...@@ -553,7 +553,7 @@ public: ...@@ -553,7 +553,7 @@ public:
p5 *= 1.0 / 16.0 ; p5 *= 1.0 / 16.0 ;
p6 *= 1.0 / 16.0 ; p6 *= 1.0 / 16.0 ;
m_map.incCurrentLevel() ; //m_map.incCurrentLevel() ;
m_position[d] = p1 + p2 + p3 + p4 + p5 + p6 ; m_position[d] = p1 + p2 + p3 + p4 + p5 + p6 ;
} }
...@@ -561,7 +561,7 @@ public: ...@@ -561,7 +561,7 @@ public:
{ {
Dart d2 = m_map.phi2(d); Dart d2 = m_map.phi2(d);
m_map.decCurrentLevel() ; //m_map.decCurrentLevel() ;
//edge points //edge points
typename PFP::VEC3 Cavg = typename PFP::VEC3(0); typename PFP::VEC3 Cavg = typename PFP::VEC3(0);
unsigned int degree = 0; unsigned int degree = 0;
...@@ -589,7 +589,7 @@ public: ...@@ -589,7 +589,7 @@ public:
typename PFP::VEC3 ep = Cavg + Aavg * 2 + M * (degree - 3); typename PFP::VEC3 ep = Cavg + Aavg * 2 + M * (degree - 3);
ep /= degree; ep /= degree;
m_map.incCurrentLevel() ; //m_map.incCurrentLevel() ;
m_position[d] = ep; m_position[d] = ep;
} }
...@@ -603,10 +603,10 @@ class MJ96FaceVertexFunctor : public FunctorType ...@@ -603,10 +603,10 @@ class MJ96FaceVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
MJ96FaceVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) MJ96FaceVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (Dart d)
...@@ -617,7 +617,7 @@ public: ...@@ -617,7 +617,7 @@ public:
Dart df = m_map.phi1(m_map.phi1(db)) ; Dart df = m_map.phi1(m_map.phi1(db)) ;
m_map.decCurrentLevel() ; //m_map.decCurrentLevel() ;
typename PFP::VEC3 p(0) ; typename PFP::VEC3 p(0) ;
unsigned int degree = 0 ; unsigned int degree = 0 ;
...@@ -629,14 +629,14 @@ public: ...@@ -629,14 +629,14 @@ public:
} }
p /= degree ; p /= degree ;
m_map.incCurrentLevel() ; //m_map.incCurrentLevel() ;
m_position[d] = p ; m_position[d] = p ;
} }
else else
{ {
Dart df = m_map.phi1(m_map.phi1(d)) ; Dart df = m_map.phi1(m_map.phi1(d)) ;
m_map.decCurrentLevel() ; //m_map.decCurrentLevel() ;
//face points //face points
typename PFP::VEC3 C0 = Algo::Geometry::volumeCentroid<PFP>(m_map, df, m_position); typename PFP::VEC3 C0 = Algo::Geometry::volumeCentroid<PFP>(m_map, df, m_position);
typename PFP::VEC3 C1 = Algo::Geometry::volumeCentroid<PFP>(m_map, m_map.phi3(df), m_position); typename PFP::VEC3 C1 = Algo::Geometry::volumeCentroid<PFP>(m_map, m_map.phi3(df), m_position);
...@@ -646,7 +646,7 @@ public: ...@@ -646,7 +646,7 @@ public:
typename PFP::VEC3 fp = C0 + A * 2 + C1; typename PFP::VEC3 fp = C0 + A * 2 + C1;
fp /= 4; fp /= 4;
m_map.incCurrentLevel() ; //m_map.incCurrentLevel() ;
m_position[d] = fp; m_position[d] = fp;
} }
...@@ -661,10 +661,10 @@ class MJ96VolumeVertexFunctor : public FunctorType ...@@ -661,10 +661,10 @@ class MJ96VolumeVertexFunctor : public FunctorType
{ {
protected: protected:
typename PFP::MAP& m_map ; typename PFP::MAP& m_map ;
typename PFP::TVEC3& m_position ; AttributeHandler<typename PFP::VEC3, VERTEX>& m_position ;
public: public:
MJ96VolumeVertexFunctor(typename PFP::MAP& m, typename PFP::TVEC3& p) : m_map(m), m_position(p) MJ96VolumeVertexFunctor(typename PFP::MAP& m, AttributeHandler<typename PFP::VEC3, VERTEX>& p) : m_map(m), m_position(p)
{} {}
bool operator() (Dart d) bool operator() (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