diff --git a/Apps/Examples/viewer.cpp b/Apps/Examples/viewer.cpp index 227f84b80172d4d7dbeee5ea0c884d58531aa3b3..5ed05f2d01fda603fbccbee03eca22ce269ed216 100644 --- a/Apps/Examples/viewer.cpp +++ b/Apps/Examples/viewer.cpp @@ -31,6 +31,7 @@ Viewer::Viewer() : m_drawFaces(true), m_drawNormals(false), m_drawTopo(false), + m_drawBoundaryTopo(true), m_render(NULL), m_phongShader(NULL), m_flatShader(NULL), @@ -231,7 +232,7 @@ void Viewer::importMesh(std::string& filename) m_render->initPrimitives(myMap, Algo::Render::GL2::LINES) ; m_render->initPrimitives(myMap, Algo::Render::GL2::TRIANGLES) ; - m_topoRender->updateData(myMap, position, 0.85f, 0.85f) ; + m_topoRender->updateData(myMap, position, 0.85f, 0.85f, m_drawBoundaryTopo) ; bb = Algo::Geometry::computeBoundingBox(myMap, position) ; normalBaseSize = bb.diagSize() / 100.0f ; diff --git a/Apps/Examples/viewer.h b/Apps/Examples/viewer.h index f1e88e8cda88b97ddd7099e10c094251a322b608..0b8138989a06ba4ffb91e97ea8283f9850d3e7e7 100644 --- a/Apps/Examples/viewer.h +++ b/Apps/Examples/viewer.h @@ -96,6 +96,7 @@ public: bool m_drawFaces ; bool m_drawNormals ; bool m_drawTopo ; + bool m_drawBoundaryTopo; VertexAttribute position ; VertexAttribute normal ; diff --git a/Apps/Tuto/tuto_oper2.cpp b/Apps/Tuto/tuto_oper2.cpp index f6aa8fab9e75e44d1f7f656d9ad7ab4c8fe56b0a..f63660947296bcb886a3dc17a66953bfd25f15f9 100644 --- a/Apps/Tuto/tuto_oper2.cpp +++ b/Apps/Tuto/tuto_oper2.cpp @@ -357,8 +357,10 @@ void MyQT::cb_Open() void MyQT::cb_Save() { - std::string filename = selectFileSave("Export SVG file ",".","(*.off)"); - Algo::Surface::Export::exportOFF(myMap,position,filename.c_str()); + std::string filename = selectFileSave("Export Map file ",".","(*.map)"); + //Algo::Surface::Export::exportOFF(myMap,position,filename.c_str()); + if(!myMap.saveMapBin(filename)) + std::cout << "could not save file : " << filename << std::endl; } void MyQT::importMesh(std::string& filename) diff --git a/Apps/Tuto/tuto_oper3.cpp b/Apps/Tuto/tuto_oper3.cpp index af43ad884f1789435ce3024c5a619b3bd353dea8..4ca86d4701dab239b43ddd70f4b1362b9fca77a2 100644 --- a/Apps/Tuto/tuto_oper3.cpp +++ b/Apps/Tuto/tuto_oper3.cpp @@ -259,9 +259,20 @@ void MyQT::createMap(int n) position = myMap.getAttribute("position"); if (!position.isValid()) position = myMap.addAttribute("position"); - Algo::Volume::Modelisation::Primitive3D prim(myMap, position); - prim.hexaGrid_topo(n,n,n); - prim.embedHexaGrid(1.0f,1.0f,1.0f); +// Algo::Volume::Modelisation::Primitive3D prim(myMap, position); +// prim.hexaGrid_topo(n,n,n); +// prim.embedHexaGrid(1.0f,1.0f,1.0f); + +// Algo::Surface::Modelisation::Polyhedron poly(myMap, position); +// poly.cylinder_topo(6,1,true,true); +// poly.embedCylinder(6.0,6.0,5.0); +// myMap.closeMap(); + + Dart d = Algo::Surface::Modelisation::embedPrism(myMap, position, 5, true,6.0,6.0,5.0); + Dart d2 = Algo::Surface::Modelisation::embedPyramid(myMap, position, 4, true,6.0,5.0); + + myMap.sewVolumes(myMap.phi2(d),d2); + position[myMap.phi_1(myMap.phi2(d2))] += VEC3(9.0,-5.0,-2.5); myMap.check(); @@ -565,8 +576,8 @@ void MyQT::cb_keyPress(int keycode) updateGL(); break; case 'W': - m_ex1 = 0.9f; - m_ex2 = 0.9f; + m_ex1 = 0.95f; + m_ex2 = 0.95f; m_render_topo->updateData(myMap, position, m_ex1,m_ex2,m_ex3/*, nb*/); updateGL(); break; diff --git a/SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h b/SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h index 2f6292cd02cc21d8dd9b992641b4a6dc696984bb..4071fe56aeb8ea5a46724257330d31f411556a3b 100644 --- a/SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h +++ b/SCHNApps/Plugins/renderTopoSurface/include/renderTopoSurface.h @@ -64,7 +64,7 @@ public: virtual void keyPress(View* view, QKeyEvent* event) {} virtual void keyRelease(View* view, QKeyEvent* event) {} - virtual void mousePress(View* view, QMouseEvent* 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) {} @@ -100,6 +100,9 @@ public slots: void attributeModified(unsigned int orbit, QString nameAttr); void connectivityModified(); + +signals: + void dartSelected(Dart d); }; } // namespace SCHNApps diff --git a/SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp b/SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp index 238a2d3e6e2bbe56e28bf9702d009c404708c0d9..90e0c910bc4c243c3948e77f0c00070069327768 100644 --- a/SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp +++ b/SCHNApps/Plugins/renderTopoSurface/src/renderTopoSurface.cpp @@ -86,6 +86,22 @@ void RenderTopoSurfacePlugin::redraw(View* view) } } +void RenderTopoSurfacePlugin::mousePress(View* view, QMouseEvent* event) +{ +// if (Shift()) +// { +// ParameterSet* params = h_viewParams[view]; + +// m_renderTopo->updateData(myMap, position, m_coeff_topo_explod[0], m_coeff_topo_explod[1], m_coeff_topo_explod[2], *m_selNoBoundary) ; + +// Dart d = m_renderTopo->picking(myMap, x, y, *m_selNoBoundary); +// if (d != Dart::nil()) +// { +// emit(dartSelected(d); +// } +// } +} + void RenderTopoSurfacePlugin::viewLinked(View* view, Plugin* plugin) { if(plugin == this) diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm.h b/include/Algo/ImplicitHierarchicalMesh/ihm.h index 067d383f1ac94383fc1485fb8230dcdf9ec2c4ec..9fd92a6d8e810f984a0167057ef3a0e9fa25541f 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm.h +++ b/include/Algo/ImplicitHierarchicalMesh/ihm.h @@ -60,7 +60,21 @@ public: static const unsigned int DIMENSION = 2 ; - void init() ; + //! + /*! + * + */ + void update_topo_shortcuts(); + + + void initImplicitProperties() ; + + /** + * clear the map + * @param remove attrib remove attribute (not only clear the content) + */ + void clear(bool removeAttrib); + /*************************************************** * ATTRIBUTES MANAGEMENT * diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm.hpp b/include/Algo/ImplicitHierarchicalMesh/ihm.hpp index 29dc8111a26725f9ed3f77636d04be5e1c1df413..695fea83182948b866dd8eb1f593a3a5160ab3a2 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/ihm.hpp @@ -66,6 +66,17 @@ AttributeHandler_IHM ImplicitHierarchicalMap::getAttribute(const std:: return AttributeHandler_IHM(this, h.getDataVector()) ; } +inline void ImplicitHierarchicalMap::update_topo_shortcuts() +{ + Map2::update_topo_shortcuts(); + m_dartLevel = Map2::getAttribute("dartLevel") ; + m_edgeId = Map2::getAttribute("edgeId") ; + + //AttributeContainer& cont = m_attribs[DART] ; + //m_nextLevelCell = cont.getDataVector(cont.getAttributeIndex("nextLevelCell")) ; +} + + /*************************************************** * MAP TRAVERSAL * ***************************************************/ diff --git a/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp b/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp index 1bfaa6a3bffb6240d30bdc339da9bfe3129b7064..91f864e91a41156c2383460db5e9fc5cbec105db 100644 --- a/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp +++ b/include/Algo/ImplicitHierarchicalMesh/ihm3.hpp @@ -80,7 +80,7 @@ inline void ImplicitHierarchicalMap3::update_topo_shortcuts() /*************************************************** - * MAP TRAVERSAL * + * MAP TRAVERSAL * ***************************************************/ inline Dart ImplicitHierarchicalMap3::newDart() diff --git a/include/Algo/Modelisation/polyhedron.h b/include/Algo/Modelisation/polyhedron.h index 15e3d62dc809fb82c9c0295bff549dd87f6bf7fb..70b835f561e79e4786dfe316e6ac5db6103d5499 100644 --- a/include/Algo/Modelisation/polyhedron.h +++ b/include/Algo/Modelisation/polyhedron.h @@ -137,7 +137,12 @@ template bool isPrism(typename PFP::MAP& map, Dart d, unsigned int thread = 0); +template +Dart embedPrism(typename PFP::MAP& map, VertexAttribute& position, unsigned int n, bool withBoundary, float bottom_radius, float top_radius, float height); + +template +Dart embedPyramid(typename PFP::MAP& map, VertexAttribute& position, unsigned int n, bool withBoundary, float radius, float height); diff --git a/include/Algo/Modelisation/polyhedron.hpp b/include/Algo/Modelisation/polyhedron.hpp index 2151048bde33fa9bac4b1344bb2ad548df9fe91e..a64e4130e7d61e55c17b424b992825c47368feda 100644 --- a/include/Algo/Modelisation/polyhedron.hpp +++ b/include/Algo/Modelisation/polyhedron.hpp @@ -234,7 +234,135 @@ Dart createOctahedron(typename PFP::MAP& map, bool withBoundary) return createDiamond(map,4, withBoundary); } +template +Dart embedPrism(typename PFP::MAP& map, VertexAttribute& position, unsigned int n, bool withBoundary, float bottom_radius, float top_radius, float height) +{ + typedef typename PFP::VEC3 VEC3 ; + + unsigned int m_nz = 1; + + Dart dres = Dart::nil(); + unsigned int nb = n*2; + std::vector m_tableVertDarts; + m_tableVertDarts.reserve(nb); + + // creation of quads around circunference and storing vertices + for (unsigned int i = 0; i < n; ++i) + { + Dart d = map.newFace(4, false); + m_tableVertDarts.push_back(d); + } + + // storing a dart from the vertex pointed by phi1(phi1(d)) + for (unsigned int i = 0; i < n; ++i) + { + //m_tableVertDarts.push_back(map.phi1(map.phi1(m_tableVertDarts[i]))); + m_tableVertDarts.push_back(map.phi_1(m_tableVertDarts[i])); + } + + // sewing the quads + for (unsigned int i = 0; i < n-1; ++i) + { + Dart d = m_tableVertDarts[i]; + d = map.phi_1(d); + Dart e = m_tableVertDarts[i+1]; + e = map.phi1(e); + map.sewFaces(d, e, false); + } + //sewing the last with the first + map.sewFaces(map.phi1(m_tableVertDarts[0]), map.phi_1(m_tableVertDarts[n-1]), false); + + //sewing the top & bottom faces + Dart top = map.newFace(n, false); + Dart bottom = map.newFace(n, false); + dres = top; + for(unsigned int i = 0; i < n ; ++i) + { + map.sewFaces(m_tableVertDarts[i], top, false); + map.sewFaces(map.phi_1(m_tableVertDarts[n+i]), bottom, false); + top = map.phi1(top); + bottom = map.phi_1(bottom); + } + + if(map.dimension() == 3 && withBoundary) + map.closeMap(); + + float alpha = float(2.0*M_PI/n); + float dz = height/float(m_nz); + + for(unsigned int i = 0; i <= m_nz; ++i) + { + float a = float(i)/float(m_nz); + float radius = a*top_radius + (1.0f-a)*bottom_radius; + for(unsigned int j = 0; j < n; ++j) + { + float x = radius*cos(alpha*float(j)); + float y = radius*sin(alpha*float(j)); + position[ m_tableVertDarts[i*n+j] ] = VEC3(x, y, -height/2 + dz*float(i)); + } + } + + return dres; +} +template +Dart embedPyramid(typename PFP::MAP& map, VertexAttribute& position, unsigned int n, bool withBoundary, float radius, float height) +{ + typedef typename PFP::VEC3 VEC3 ; + + Dart dres = Dart::nil(); + std::vector m_tableVertDarts; + m_tableVertDarts.reserve(n); + + // creation of triangles around circunference and storing vertices + for (unsigned int i = 0; i < n; ++i) + { + Dart d = map.newFace(3, false); + m_tableVertDarts.push_back(d); + } + + // sewing the triangles + for (unsigned int i = 0; i < n-1; ++i) + { + Dart d = m_tableVertDarts[i]; + d = map.phi_1(d); + Dart e = m_tableVertDarts[i+1]; + e = map.phi1(e); + map.sewFaces(d, e, false); + } + //sewing the last with the first + map.sewFaces(map.phi1(m_tableVertDarts[0]), map.phi_1(m_tableVertDarts[n-1]), false); + + //sewing the bottom face + Dart base = map.newFace(n, false); + dres = base; + for(unsigned int i = 0; i < n ; ++i) + { + map.sewFaces(m_tableVertDarts[i], base, false); + base = map.phi1(base); + } + + if(map.dimension() == 3 && withBoundary) + map.closeMap(); + + float alpha = float(2.0*M_PI/n); + + for(unsigned int j = 0; j < n; ++j) + { + float rad = radius; + float h = -height/2; + float x = rad*cos(alpha*float(j)); + float y = rad*sin(alpha*float(j)); + + position[ m_tableVertDarts[j] ] = VEC3(x, y, h); + } + + // top always closed in cone + position[ map.phi_1(m_tableVertDarts[0]) ] = VEC3(0.0f, 0.0f, height/2 ); + + //return a dart from the base + return dres; +} diff --git a/include/Algo/Multiresolution/Map3MR/Filters/lerp.h b/include/Algo/Multiresolution/Map3MR/Filters/lerp.h index 4e93703200db035baf256f72854694f1bd8f2661..275fc8f30be364653af8be816b2bada19f17a8e1 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/lerp.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/lerp.h @@ -103,12 +103,7 @@ public: m_map.incCurrentLevel() ; Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); - if(m_position[midV] != typename PFP::VEC3(0.0f,0.0f,0.0f)) - { - std::cout << "position[midV] = " << m_position[midV] << std::endl; - } - else - m_position[midV] += vc + ec + fc; + m_position[midV] += vc + ec + fc; m_map.decCurrentLevel() ; } @@ -135,13 +130,7 @@ public: m_map.incCurrentLevel() ; Dart midF = m_map.phi1(m_map.phi1(d)); - if(m_position[midF] != typename PFP::VEC3(0.0f,0.0f,0.0f)) - { - std::cout << "position[midF] = " << m_position[midF] << std::endl; - //m_position[midF] = vf + ef ; - } - else - m_position[midF] += vf + ef ; + m_position[midF] += vf + ef ; m_map.decCurrentLevel() ; } @@ -152,13 +141,7 @@ public: m_map.incCurrentLevel() ; Dart midE = m_map.phi1(d) ; - if(m_position[midE] != typename PFP::VEC3(0.0f,0.0f,0.0f)) - { - std::cout << "position[midE] = " << m_position[midE] << std::endl; - //m_position[midE] = ve; - } - else - m_position[midE] += ve; + m_position[midE] += ve; m_map.decCurrentLevel() ; } } diff --git a/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h b/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h index f818f9531285dad2b9d2dc64a0f7c2ef5ea173a1..0e9720b65af269d2d6480d676e18f2c447fcfc26 100644 --- a/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h +++ b/include/Algo/Multiresolution/Map3MR/Filters/schaefer.h @@ -430,6 +430,196 @@ public: } } ; + + + + + + + + + + + + +//template +//class SHW04OddSynthesisFilter : public Algo::MR::Filter +//{ +//protected: +// typename PFP::MAP& m_map; +// VertexAttribute& m_position; +// +//public: +// SHW04OddSynthesisFilter(typename PFP::MAP& m, VertexAttribute& p) : m_map(m), m_position(p) +// {} +// +// void operator() () +// { +// TraversorW travW(m_map) ; +// for (Dart d = travW.begin(); d != travW.end(); d = travW.next()) +// { +// if(!Algo::Volume::Modelisation::Tetrahedralization::isTetrahedron(m_map,d)) +// { +// typename PFP::VEC3 vc = Algo::Surface::Geometry::volumeCentroid(m_map, d, m_position); +// +// unsigned int count = 0; +// typename PFP::VEC3 ec(0.0); +// Traversor3WE travWE(m_map, d); +// for (Dart dit = travWE.begin(); dit != travWE.end(); dit = travWE.next()) +// { +// m_map.incCurrentLevel(); +// ec += m_position[m_map.phi1(dit)]; +// m_map.decCurrentLevel(); +// ++count; +// } +// ec /= count; +// ec *= 3; +// +// count = 0; +// typename PFP::VEC3 fc(0.0); +// Traversor3WF travWF(m_map, d); +// for (Dart dit = travWF.begin(); dit != travWF.end(); dit = travWF.next()) +// { +// m_map.incCurrentLevel(); +// fc += m_position[m_map.phi1(m_map.phi1(dit))]; +// m_map.decCurrentLevel(); +// ++count; +// } +// fc /= count; +// fc *= 3; +// +// m_map.incCurrentLevel() ; +// Dart midV = m_map.phi_1(m_map.phi2(m_map.phi1(d))); +// m_position[midV] += vc + ec + fc; +// m_map.decCurrentLevel() ; +// } +// } +// +// TraversorE trav(m_map) ; +// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) +// { +// if(m_map.isBoundaryEdge(d)) +// { +// Dart db = m_map.findBoundaryFaceOfEdge(d); +// typename PFP::VEC3 p = loopOddVertex(m_map, m_position, db) ; +// +// m_map.incCurrentLevel() ; +// +// Dart oddV = m_map.phi2(db) ; +// m_position[oddV] += p ; +// +// m_map.decCurrentLevel() ; +// } +// else +// { +// typename PFP::VEC3 ve = (m_position[d] + m_position[m_map.phi1(d)]) * typename PFP::REAL(0.5); +// +// m_map.incCurrentLevel() ; +// Dart midV = m_map.phi1(d) ; +// m_position[midV] += ve; +// m_map.decCurrentLevel() ; +// } +// } +// } +//}; +// +//template +//class LoopNormalisationSynthesisFilter : public Algo::MR::Filter +//{ +//protected: +// typename PFP::MAP& m_map ; +// VertexAttribute& m_position ; +// +//public: +// LoopNormalisationSynthesisFilter(typename PFP::MAP& m, VertexAttribute& p) : m_map(m), m_position(p) +// {} +// +// void operator() () +// { +// TraversorV trav(m_map) ; +// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) +// { +// if(m_map.isBoundaryVertex(d)) +// { +// Dart db = m_map.findBoundaryFaceOfVertex(d); +// +// unsigned int degree = m_map.vertexDegreeOnBoundary(db) ; +// float n = 3.0/8.0 + 1.0/4.0 * cos(2.0 * M_PI / degree) ; +// n = 8.0/5.0 * (n * n) ; +// +// m_position[db] *= n ; +// } +// } +// } +//} ; +// +//template +//class LoopEvenSynthesisFilter : public Algo::MR::Filter +//{ +//protected: +// typename PFP::MAP& m_map ; +// VertexAttribute& m_position ; +// +//public: +// LoopEvenSynthesisFilter(typename PFP::MAP& m, VertexAttribute& p) : m_map(m), m_position(p) +// {} +// +// void operator() () +// { +// TraversorV trav(m_map) ; +// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) +// { +// if(m_map.isBoundaryVertex(d)) +// { +// Dart db = m_map.findBoundaryFaceOfVertex(d); +// typename PFP::VEC3 p = loopEvenVertex(m_map, m_position, db) ; +// m_position[db] += p ; +// } +// } +// } +//} ; +// +// +//template +//class SHW04NormalisationSynthesisFilter : public Algo::MR::Filter +//{ +//protected: +// typename PFP::MAP& m_map ; +// VertexAttribute& m_position ; +// +//public: +// SHW04NormalisationSynthesisFilter(typename PFP::MAP& m, VertexAttribute& p) : m_map(m), m_position(p) +// {} +// +// void operator() () +// { +// m_map.incCurrentLevel() ; +// TraversorV trav(m_map) ; +// for (Dart d = trav.begin(); d != trav.end(); d = trav.next()) +// { +// if(!m_map.isBoundaryVertex(d)) +// { +// typename PFP::VEC3 p = typename PFP::VEC3(0); +// unsigned int degree = 0; +// +// Traversor3VW travVW(m_map, d); +// for(Dart dit = travVW.begin() ; dit != travVW.end() ; dit = travVW.next()) +// { +// p += SHW04Vertex(m_map, m_position, dit); +// ++degree; +// } +// +// p /= degree; +// +// m_position[d] = p ; +// } +// } +// m_map.decCurrentLevel() ; +// } +//} ; + + + } // namespace Filters } // namespace Primal diff --git a/include/Algo/Render/GL2/topoRender.hpp b/include/Algo/Render/GL2/topoRender.hpp index beafb9164dba26642fc7a8115493d733bc50072b..c125fe9ceef2f25cd5673990812cad30eb3887d0 100644 --- a/include/Algo/Render/GL2/topoRender.hpp +++ b/include/Algo/Render/GL2/topoRender.hpp @@ -86,33 +86,33 @@ void TopoRender::updateData(typename PFP::MAP& map, const VertexAttribute void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute& positions, float ke, float kf, bool withBoundary) { - Map2& map = reinterpret_cast(mapx); + //Map2& map = reinterpret_cast(mapx); typedef typename PFP::VEC3 VEC3; typedef typename PFP::REAL REAL; std::vector vecDarts; - vecDarts.reserve(map.getNbDarts()); // no problem dart is int: no problem of memory + vecDarts.reserve(mapx.getNbDarts()); // no problem dart is int: no problem of memory - m_attIndex = map.template getAttribute("dart_index"); + m_attIndex = mapx.template getAttribute("dart_index"); if (!m_attIndex.isValid()) - m_attIndex = map.template addAttribute("dart_index"); + m_attIndex = mapx.template addAttribute("dart_index"); - for(Dart d = map.begin(); d!= map.end(); map.next(d)) + for(Dart d = mapx.begin(); d!= mapx.end(); mapx.next(d)) { - if (withBoundary || !map.isBoundaryMarked2(d)) + if (withBoundary || !mapx.isBoundaryMarked2(d)) vecDarts.push_back(d); } m_nbDarts = vecDarts.size(); // debut phi1 - DartAutoAttribute fv1(map); + DartAutoAttribute fv1(mapx); // fin phi1 - DartAutoAttribute fv11(map); + DartAutoAttribute fv11(mapx); // phi2 - DartAutoAttribute fv2(map); + DartAutoAttribute fv2(mapx); m_vbo3->bind(); glBufferData(GL_ARRAY_BUFFER, 2*m_nbDarts*sizeof(VEC3), 0, GL_STREAM_DRAW); @@ -134,22 +134,23 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute::iterator id = vecDarts.begin(); id!= vecDarts.end(); id++) { Dart d = *id; if (!mf.isMarked(d)) { vecPos.clear(); - if (!map.isBoundaryMarked2(d)) + if (!mapx.isBoundaryMarked2(d)) { - VEC3 center = Algo::Surface::Geometry::faceCentroidELW(mapx,d,positions); + //VEC3 center = Algo::Surface::Geometry::faceCentroidELW(mapx,d,positions); + VEC3 center = Algo::Surface::Geometry::faceCentroid(mapx,d,positions); float k = 1.0f - kf; Dart dd = d; do { vecPos.push_back(center*k + positions[dd]*kf); - dd = map.phi1(dd); + dd = mapx.phi1(dd); } while (dd != d); @@ -184,7 +185,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute(d); } @@ -199,11 +200,11 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute(mapx,ee,positions); VEC3 v = vd ^ normal; v.normalize(); - VEC3 P = positions[map.phi1(ee)] + v* m_boundShift; + VEC3 P = positions[mapx.phi1(ee)] + v* m_boundShift; vecPos.push_back(P); - dd = map.phi1(dd); + dd = mapx.phi1(dd); ee = mapx.phi2(dd); - P = positions[map.phi1(ee)] + v* m_boundShift; + P = positions[mapx.phi1(ee)] + v* m_boundShift; vecPos.push_back(P); } while (dd != d); @@ -227,7 +228,7 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute(d); } @@ -257,17 +258,17 @@ void TopoRender::updateDataMap(typename PFP::MAP& mapx, const VertexAttribute d.index)) - if ( (withBoundary || !map.isBoundaryMarked2(e)) && (e.index > d.index)) + if ( (withBoundary || !mapx.isBoundaryMarked2(e)) && (e.index > d.index)) { *positionF2++ = fv2[d]; *positionF2++ = fv2[e]; m_nbRel2++; } - e = map.phi1(d); + e = mapx.phi1(d); *positionF1++ = fv1[d]; *positionF1++ = fv11[e]; } diff --git a/src/Algo/ImplicitHierarchicalMesh/ihm.cpp b/src/Algo/ImplicitHierarchicalMesh/ihm.cpp index 649fe108f6dc442b80f62e456eb48ee54ad529ff..e757d9f714e08377f597f73517d33c242084d54b 100644 --- a/src/Algo/ImplicitHierarchicalMesh/ihm.cpp +++ b/src/Algo/ImplicitHierarchicalMesh/ihm.cpp @@ -39,8 +39,8 @@ namespace IHM ImplicitHierarchicalMap::ImplicitHierarchicalMap() : m_curLevel(0), m_maxLevel(0), m_idCount(0) { - m_dartLevel = addAttribute("dartLevel") ; - m_edgeId = addAttribute("edgeId") ; + m_dartLevel = Map2::addAttribute("dartLevel") ; + m_edgeId = Map2::addAttribute("edgeId") ; for(unsigned int i = 0; i < NB_ORBITS; ++i) m_nextLevelCell[i] = NULL ; } @@ -51,7 +51,20 @@ ImplicitHierarchicalMap::~ImplicitHierarchicalMap() removeAttribute(m_dartLevel) ; } -void ImplicitHierarchicalMap::init() +void ImplicitHierarchicalMap::clear(bool removeAttrib) +{ + Map2::clear(removeAttrib) ; + if (removeAttrib) + { + m_dartLevel = Map2::addAttribute("dartLevel") ; + m_edgeId = Map2::addAttribute("edgeId") ; + + for(unsigned int i = 0; i < NB_ORBITS; ++i) + m_nextLevelCell[i] = NULL ; + } +} + +void ImplicitHierarchicalMap::initImplicitProperties() { initEdgeId() ; diff --git a/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp b/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp index 70fd8584258c4ba73432564c30c0be7b7d4f4fba..906cfe276f0a5012961613e7042101a14f990b75 100644 --- a/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp +++ b/src/Algo/ImplicitHierarchicalMesh/ihm3.cpp @@ -42,8 +42,8 @@ namespace IHM ImplicitHierarchicalMap3::ImplicitHierarchicalMap3() : m_curLevel(0), m_maxLevel(0), m_edgeIdCount(0), m_faceIdCount(0) { m_dartLevel = Map3::addAttribute("dartLevel") ; - m_faceId = Map3::addAttribute("faceId") ; m_edgeId = Map3::addAttribute("edgeId") ; + m_faceId = Map3::addAttribute("faceId") ; for(unsigned int i = 0; i < NB_ORBITS; ++i) m_nextLevelCell[i] = NULL ;