From 2826898171bc9af4623aa9e2d019bf3692c62a96 Mon Sep 17 00:00:00 2001 From: Pierre Kraemer Date: Tue, 24 May 2011 16:56:06 +0200 Subject: [PATCH] suite no lazy --- include/Algo/Modelisation/polyhedron.h | 2 +- include/Algo/Modelisation/polyhedron.hpp | 19 ++++---- include/Algo/MovingObjects/particle_cell_2D.h | 2 +- .../Algo/MovingObjects/particle_cell_2D.hpp | 2 +- include/Algo/Render/GL1/topo_render.hpp | 2 +- include/Topology/generic/cellmarker.h | 1 + include/Topology/generic/embeddedMap2.h | 5 +++ include/Topology/generic/embeddedMap2.hpp | 43 ++++++++++++++----- src/Topology/map/map1.cpp | 2 +- 9 files changed, 53 insertions(+), 25 deletions(-) diff --git a/include/Algo/Modelisation/polyhedron.h b/include/Algo/Modelisation/polyhedron.h index 37c2924c..3e50d95f 100644 --- a/include/Algo/Modelisation/polyhedron.h +++ b/include/Algo/Modelisation/polyhedron.h @@ -206,7 +206,7 @@ public: * @param y nb of quads in y * @return the dart */ - Dart grid_topo(int x, int y); + Dart grid_topo(unsigned int x, unsigned int y); /** * Create a subdivided (surface) cylinder diff --git a/include/Algo/Modelisation/polyhedron.hpp b/include/Algo/Modelisation/polyhedron.hpp index d428a89a..32c200e8 100644 --- a/include/Algo/Modelisation/polyhedron.hpp +++ b/include/Algo/Modelisation/polyhedron.hpp @@ -202,7 +202,7 @@ Dart Polyhedron::createOrientedPolyhedron(typename PFP::MAP& the_map, int n } template -Dart Polyhedron::grid_topo(int x, int y) +Dart Polyhedron::grid_topo(unsigned int x, unsigned int y) { if (m_kind != NONE) return m_dart; @@ -216,29 +216,30 @@ Dart Polyhedron::grid_topo(int x, int y) m_tableVertDarts.reserve(nb); // creation of quads and storing vertices - for (int i=0;i0) // sew with preceeding row + if (i > 0) // sew with preceeding row { int pos = i*(x+1)+j; Dart d = m_tableVertDarts[pos]; @@ -246,7 +247,7 @@ Dart Polyhedron::grid_topo(int x, int y) e = m_map.phi1(m_map.phi1(e)); m_map.sewFaces(d,e); } - if (j>0) // sew with preceeding column + if (j > 0) // sew with preceeding column { int pos = i*(x+1)+j; Dart d = m_tableVertDarts[pos]; diff --git a/include/Algo/MovingObjects/particle_cell_2D.h b/include/Algo/MovingObjects/particle_cell_2D.h index 22845476..79999f47 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.h +++ b/include/Algo/MovingObjects/particle_cell_2D.h @@ -49,7 +49,7 @@ public : {} ParticleCell2D(Map& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) : - ParticleBase(pos), m(map), m_positions(tabPos), d(belonging_cell), lastCrossed(belonging_cell), state(2), crossCell(NO_CROSS) + ParticleBase(pos), m(map), m_positions(tabPos), d(belonging_cell), lastCrossed(belonging_cell), state(FACE_ORBIT), crossCell(NO_CROSS) {} Dart getCell() { return d; } diff --git a/include/Algo/MovingObjects/particle_cell_2D.hpp b/include/Algo/MovingObjects/particle_cell_2D.hpp index 85c1402b..62c6b0b2 100644 --- a/include/Algo/MovingObjects/particle_cell_2D.hpp +++ b/include/Algo/MovingObjects/particle_cell_2D.hpp @@ -1,4 +1,4 @@ -// #define DEBUG +//#define DEBUG template void ParticleCell2D::display() diff --git a/include/Algo/Render/GL1/topo_render.hpp b/include/Algo/Render/GL1/topo_render.hpp index 53a17a3f..dcdce4df 100644 --- a/include/Algo/Render/GL1/topo_render.hpp +++ b/include/Algo/Render/GL1/topo_render.hpp @@ -168,7 +168,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi AutoAttributeHandler vert(the_map, DART_ORBIT); glLineWidth(2.0f); - glColor3f(0.0f,0.0f,0.0f); + glColor3f(0.9f,0.9f,0.9f); glBegin(GL_LINES); DartMarker mf(the_map); diff --git a/include/Topology/generic/cellmarker.h b/include/Topology/generic/cellmarker.h index fa023a2b..10b685df 100644 --- a/include/Topology/generic/cellmarker.h +++ b/include/Topology/generic/cellmarker.h @@ -32,6 +32,7 @@ #define VERTEX_CELL VERTEX_ORBIT #define EDGE_CELL EDGE_ORBIT +#define ORIENTED_FACE_CELL ORIENTED_FACE_ORBIT #define FACE_CELL FACE_ORBIT #define VOLUME_CELL VOLUME_ORBIT #define DART_CELL DART_ORBIT // ?? diff --git a/include/Topology/generic/embeddedMap2.h b/include/Topology/generic/embeddedMap2.h index 0682d418..5b4c7f8c 100644 --- a/include/Topology/generic/embeddedMap2.h +++ b/include/Topology/generic/embeddedMap2.h @@ -113,6 +113,11 @@ public: */ virtual bool mergeVolumes(Dart d, Dart e) ; + /** + * No attribute is attached to the new face + */ + virtual unsigned int closeHole(Dart d); + virtual bool check() ; } ; diff --git a/include/Topology/generic/embeddedMap2.hpp b/include/Topology/generic/embeddedMap2.hpp index 6d3b267b..73c06a8f 100644 --- a/include/Topology/generic/embeddedMap2.hpp +++ b/include/Topology/generic/embeddedMap2.hpp @@ -168,13 +168,13 @@ bool EmbeddedMap2::flipEdge(Dart d) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) { - MAP2::setDartEmbedding(VERTEX_ORBIT, d, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(e))) ; - MAP2::setDartEmbedding(VERTEX_ORBIT, e, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(d))) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, d, MAP2::phi1(e)) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, e, MAP2::phi1(d)) ; } if (MAP2::isOrbitEmbedded(FACE_ORBIT)) { - MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi_1(d), MAP2::getEmbedding(FACE_ORBIT, d)) ; - MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi_1(e), MAP2::getEmbedding(FACE_ORBIT, e)) ; + MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi_1(d), d) ; + MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi_1(e), e) ; } return true ; } @@ -190,13 +190,13 @@ bool EmbeddedMap2::flipBackEdge(Dart d) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) { - MAP2::setDartEmbedding(VERTEX_ORBIT, d, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(e))) ; - MAP2::setDartEmbedding(VERTEX_ORBIT, e, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(d))) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, d, MAP2::phi1(e)) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, e, MAP2::phi1(d)) ; } if (MAP2::isOrbitEmbedded(FACE_ORBIT)) { - MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi1(d), MAP2::getEmbedding(FACE_ORBIT, d)) ; - MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi1(e), MAP2::getEmbedding(FACE_ORBIT, e)) ; + MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi1(d), d) ; + MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi1(e), e) ; } return true ; } @@ -281,7 +281,7 @@ bool EmbeddedMap2::collapseDegeneratedFace(Dart d) { if (MAP2::isOrbitEmbedded(EDGE_ORBIT)) { - MAP2::setDartEmbedding(EDGE_ORBIT, MAP2::phi2(e), MAP2::getEmbedding(EDGE_ORBIT, e)) ; + MAP2::copyDartEmbedding(EDGE_ORBIT, MAP2::phi2(e), e) ; } return true ; } @@ -295,8 +295,8 @@ void EmbeddedMap2::splitFace(Dart d, Dart e) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) { - MAP2::setDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(e), MAP2::getEmbedding(VERTEX_ORBIT, d)) ; - MAP2::setDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(d), MAP2::getEmbedding(VERTEX_ORBIT, e)) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(e), d) ; + MAP2::copyDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(d), e) ; } if (MAP2::isOrbitEmbedded(FACE_ORBIT)) { @@ -364,6 +364,27 @@ bool EmbeddedMap2::mergeVolumes(Dart d, Dart e) return false ; } +template +unsigned int EmbeddedMap2::closeHole(Dart d) +{ + unsigned int nbE = MAP2::closeHole(d) ; + Dart dd = MAP2::phi2(d) ; + Dart f = dd ; + do + { + if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) + { + MAP2::copyDartEmbedding(VERTEX_ORBIT, f, MAP2::alpha1(f)) ; + } + if (MAP2::isOrbitEmbedded(EDGE_ORBIT)) + { + MAP2::copyDartEmbedding(EDGE_ORBIT, f, MAP2::phi2(f)) ; + } + f = MAP2::phi1(f) ; + } while(dd != f) ; + return nbE ; +} + template bool EmbeddedMap2::check() { diff --git a/src/Topology/map/map1.cpp b/src/Topology/map/map1.cpp index 87d879e7..49b74cdd 100644 --- a/src/Topology/map/map1.cpp +++ b/src/Topology/map/map1.cpp @@ -35,7 +35,7 @@ Dart Map1::newOrientedFace(unsigned nbEdges) { assert(nbEdges > 0 || !"Cannot create a face with no edge") ; Dart d = newDart() ; // Create the first edge - for (unsigned i=1 ; i