Commit 28268981 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

suite no lazy

parent 0003689c
...@@ -206,7 +206,7 @@ public: ...@@ -206,7 +206,7 @@ public:
* @param y nb of quads in y * @param y nb of quads in y
* @return the dart * @return the dart
*/ */
Dart grid_topo(int x, int y); Dart grid_topo(unsigned int x, unsigned int y);
/** /**
* Create a subdivided (surface) cylinder * Create a subdivided (surface) cylinder
......
...@@ -202,7 +202,7 @@ Dart Polyhedron<PFP>::createOrientedPolyhedron(typename PFP::MAP& the_map, int n ...@@ -202,7 +202,7 @@ Dart Polyhedron<PFP>::createOrientedPolyhedron(typename PFP::MAP& the_map, int n
} }
template <typename PFP> template <typename PFP>
Dart Polyhedron<PFP>::grid_topo(int x, int y) Dart Polyhedron<PFP>::grid_topo(unsigned int x, unsigned int y)
{ {
if (m_kind != NONE) return m_dart; if (m_kind != NONE) return m_dart;
...@@ -216,29 +216,30 @@ Dart Polyhedron<PFP>::grid_topo(int x, int y) ...@@ -216,29 +216,30 @@ Dart Polyhedron<PFP>::grid_topo(int x, int y)
m_tableVertDarts.reserve(nb); m_tableVertDarts.reserve(nb);
// creation of quads and storing vertices // creation of quads and storing vertices
for (int i=0;i<y;++i) for (unsigned int i = 0; i < y; ++i)
{ {
for (int j=1;j<=x;++j) for (unsigned int j = 1; j <= x; ++j)
{ {
Dart d = m_map.newFace(4); Dart d = m_map.newFace(4);
m_tableVertDarts.push_back(d); m_tableVertDarts.push_back(d);
if (j==x) if (j == x)
m_tableVertDarts.push_back(m_map.phi1(d)); m_tableVertDarts.push_back(m_map.phi1(d));
} }
} }
// store last row of vertices // store last row of vertices
for (int i=0;i<x;++i) for (unsigned int i = 0; i < x; ++i)
{ {
m_tableVertDarts.push_back( m_map.phi_1(m_tableVertDarts[(y-1)*(x+1) + i]) ); m_tableVertDarts.push_back( m_map.phi_1(m_tableVertDarts[(y-1)*(x+1) + i]) );
} }
m_tableVertDarts.push_back( m_map.phi1(m_tableVertDarts[(y-1)*(x+1) +x]) ); m_tableVertDarts.push_back( m_map.phi1(m_tableVertDarts[(y-1)*(x+1) +x]) );
//sewing the quads //sewing the quads
for (int i=0;i<y;++i) for (unsigned int i = 0; i < y; ++i)
{ {
for (int j=0;j<x;++j) for (unsigned int j = 0; j < x; ++j)
{ {
if (i>0) // sew with preceeding row if (i > 0) // sew with preceeding row
{ {
int pos = i*(x+1)+j; int pos = i*(x+1)+j;
Dart d = m_tableVertDarts[pos]; Dart d = m_tableVertDarts[pos];
...@@ -246,7 +247,7 @@ Dart Polyhedron<PFP>::grid_topo(int x, int y) ...@@ -246,7 +247,7 @@ Dart Polyhedron<PFP>::grid_topo(int x, int y)
e = m_map.phi1(m_map.phi1(e)); e = m_map.phi1(m_map.phi1(e));
m_map.sewFaces(d,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; int pos = i*(x+1)+j;
Dart d = m_tableVertDarts[pos]; Dart d = m_tableVertDarts[pos];
......
...@@ -49,7 +49,7 @@ public : ...@@ -49,7 +49,7 @@ public :
{} {}
ParticleCell2D(Map& map, Dart belonging_cell, VEC3 pos, const TAB_POS& tabPos) : 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; } Dart getCell() { return d; }
......
// #define DEBUG //#define DEBUG
template <typename PFP> template <typename PFP>
void ParticleCell2D<PFP>::display() void ParticleCell2D<PFP>::display()
......
...@@ -168,7 +168,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi ...@@ -168,7 +168,7 @@ void renderTopoMD2(typename PFP::MAP& the_map, const typename PFP::TVEC3& positi
AutoAttributeHandler<Geom::Vec3f> vert(the_map, DART_ORBIT); AutoAttributeHandler<Geom::Vec3f> vert(the_map, DART_ORBIT);
glLineWidth(2.0f); glLineWidth(2.0f);
glColor3f(0.0f,0.0f,0.0f); glColor3f(0.9f,0.9f,0.9f);
glBegin(GL_LINES); glBegin(GL_LINES);
DartMarker mf(the_map); DartMarker mf(the_map);
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define VERTEX_CELL VERTEX_ORBIT #define VERTEX_CELL VERTEX_ORBIT
#define EDGE_CELL EDGE_ORBIT #define EDGE_CELL EDGE_ORBIT
#define ORIENTED_FACE_CELL ORIENTED_FACE_ORBIT
#define FACE_CELL FACE_ORBIT #define FACE_CELL FACE_ORBIT
#define VOLUME_CELL VOLUME_ORBIT #define VOLUME_CELL VOLUME_ORBIT
#define DART_CELL DART_ORBIT // ?? #define DART_CELL DART_ORBIT // ??
......
...@@ -113,6 +113,11 @@ public: ...@@ -113,6 +113,11 @@ public:
*/ */
virtual bool mergeVolumes(Dart d, Dart e) ; virtual bool mergeVolumes(Dart d, Dart e) ;
/**
* No attribute is attached to the new face
*/
virtual unsigned int closeHole(Dart d);
virtual bool check() ; virtual bool check() ;
} ; } ;
......
...@@ -168,13 +168,13 @@ bool EmbeddedMap2<MAP2>::flipEdge(Dart d) ...@@ -168,13 +168,13 @@ bool EmbeddedMap2<MAP2>::flipEdge(Dart d)
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{ {
MAP2::setDartEmbedding(VERTEX_ORBIT, d, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(e))) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, d, MAP2::phi1(e)) ;
MAP2::setDartEmbedding(VERTEX_ORBIT, e, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(d))) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, e, MAP2::phi1(d)) ;
} }
if (MAP2::isOrbitEmbedded(FACE_ORBIT)) if (MAP2::isOrbitEmbedded(FACE_ORBIT))
{ {
MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi_1(d), MAP2::getEmbedding(FACE_ORBIT, d)) ; MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi_1(d), d) ;
MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi_1(e), MAP2::getEmbedding(FACE_ORBIT, e)) ; MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi_1(e), e) ;
} }
return true ; return true ;
} }
...@@ -190,13 +190,13 @@ bool EmbeddedMap2<MAP2>::flipBackEdge(Dart d) ...@@ -190,13 +190,13 @@ bool EmbeddedMap2<MAP2>::flipBackEdge(Dart d)
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{ {
MAP2::setDartEmbedding(VERTEX_ORBIT, d, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(e))) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, d, MAP2::phi1(e)) ;
MAP2::setDartEmbedding(VERTEX_ORBIT, e, MAP2::getEmbedding(VERTEX_ORBIT, MAP2::phi1(d))) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, e, MAP2::phi1(d)) ;
} }
if (MAP2::isOrbitEmbedded(FACE_ORBIT)) if (MAP2::isOrbitEmbedded(FACE_ORBIT))
{ {
MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi1(d), MAP2::getEmbedding(FACE_ORBIT, d)) ; MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi1(d), d) ;
MAP2::setDartEmbedding(FACE_ORBIT, MAP2::phi1(e), MAP2::getEmbedding(FACE_ORBIT, e)) ; MAP2::copyDartEmbedding(FACE_ORBIT, MAP2::phi1(e), e) ;
} }
return true ; return true ;
} }
...@@ -281,7 +281,7 @@ bool EmbeddedMap2<MAP2>::collapseDegeneratedFace(Dart d) ...@@ -281,7 +281,7 @@ bool EmbeddedMap2<MAP2>::collapseDegeneratedFace(Dart d)
{ {
if (MAP2::isOrbitEmbedded(EDGE_ORBIT)) 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 ; return true ;
} }
...@@ -295,8 +295,8 @@ void EmbeddedMap2<MAP2>::splitFace(Dart d, Dart e) ...@@ -295,8 +295,8 @@ void EmbeddedMap2<MAP2>::splitFace(Dart d, Dart e)
if (MAP2::isOrbitEmbedded(VERTEX_ORBIT)) if (MAP2::isOrbitEmbedded(VERTEX_ORBIT))
{ {
MAP2::setDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(e), MAP2::getEmbedding(VERTEX_ORBIT, d)) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(e), d) ;
MAP2::setDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(d), MAP2::getEmbedding(VERTEX_ORBIT, e)) ; MAP2::copyDartEmbedding(VERTEX_ORBIT, MAP2::phi_1(d), e) ;
} }
if (MAP2::isOrbitEmbedded(FACE_ORBIT)) if (MAP2::isOrbitEmbedded(FACE_ORBIT))
{ {
...@@ -364,6 +364,27 @@ bool EmbeddedMap2<MAP2>::mergeVolumes(Dart d, Dart e) ...@@ -364,6 +364,27 @@ bool EmbeddedMap2<MAP2>::mergeVolumes(Dart d, Dart e)
return false ; return false ;
} }
template <typename MAP2>
unsigned int EmbeddedMap2<MAP2>::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 <typename MAP2> template <typename MAP2>
bool EmbeddedMap2<MAP2>::check() bool EmbeddedMap2<MAP2>::check()
{ {
......
...@@ -35,7 +35,7 @@ Dart Map1::newOrientedFace(unsigned nbEdges) ...@@ -35,7 +35,7 @@ Dart Map1::newOrientedFace(unsigned nbEdges)
{ {
assert(nbEdges > 0 || !"Cannot create a face with no edge") ; assert(nbEdges > 0 || !"Cannot create a face with no edge") ;
Dart d = newDart() ; // Create the first edge Dart d = newDart() ; // Create the first edge
for (unsigned i=1 ; i<nbEdges ; ++i) for (unsigned int i = 1 ; i < nbEdges ; ++i)
Map1::cutEdge(d) ; // Subdivide nbEdges-1 times this edge Map1::cutEdge(d) ; // Subdivide nbEdges-1 times this edge
return d ; return 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