Commit edfc3ed4 authored by Thomas's avatar Thomas

qq modif dans boundingBox et dans les embedddedgmap3

parent 61611d16
...@@ -77,6 +77,9 @@ class BoundingBox ...@@ -77,6 +77,9 @@ class BoundingBox
/* FUNCTIONS */ /* FUNCTIONS */
/**********************************************/ /**********************************************/
// reinitialize the bounding box
void reset() ;
// add a point to the bounding box // add a point to the bounding box
void addPoint(const VEC& p) ; void addPoint(const VEC& p) ;
......
...@@ -45,37 +45,43 @@ BoundingBox<VEC>::BoundingBox(const VEC& p) : ...@@ -45,37 +45,43 @@ BoundingBox<VEC>::BoundingBox(const VEC& p) :
template <typename VEC> template <typename VEC>
VEC& BoundingBox<VEC>::min() VEC& BoundingBox<VEC>::min()
{ {
assert(m_initialized || !"Bounding box not initialized");
return m_pMin ; return m_pMin ;
} }
template <typename VEC> template <typename VEC>
const VEC& BoundingBox<VEC>::min() const const VEC& BoundingBox<VEC>::min() const
{ {
assert(m_initialized || !"Bounding box not initialized");
return m_pMin ; return m_pMin ;
} }
template <typename VEC> template <typename VEC>
VEC& BoundingBox<VEC>::max() VEC& BoundingBox<VEC>::max()
{ {
assert(m_initialized || !"Bounding box not initialized");
return m_pMax ; return m_pMax ;
} }
template <typename VEC> template <typename VEC>
const VEC& BoundingBox<VEC>::max() const const VEC& BoundingBox<VEC>::max() const
{ {
assert(m_initialized);
return m_pMax ; return m_pMax ;
} }
template <typename VEC> template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::size(unsigned int coord) const typename VEC::DATA_TYPE BoundingBox<VEC>::size(unsigned int coord) const
{ {
assert(coord < m_pMax.dimension()) ; assert(m_initialized && coord < m_pMax.dimension()) ;
return m_pMax[coord] - m_pMin[coord] ; return m_pMax[coord] - m_pMin[coord] ;
} }
template <typename VEC> template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::maxSize() const typename VEC::DATA_TYPE BoundingBox<VEC>::maxSize() const
{ {
assert(m_initialized || !"Bounding box not initialized");
typename VEC::DATA_TYPE max = m_pMax[0] - m_pMin[0] ; typename VEC::DATA_TYPE max = m_pMax[0] - m_pMin[0] ;
for(unsigned int i = 1; i < m_pMax.dimension(); ++i) for(unsigned int i = 1; i < m_pMax.dimension(); ++i)
{ {
...@@ -89,6 +95,8 @@ typename VEC::DATA_TYPE BoundingBox<VEC>::maxSize() const ...@@ -89,6 +95,8 @@ typename VEC::DATA_TYPE BoundingBox<VEC>::maxSize() const
template <typename VEC> template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::minSize() const typename VEC::DATA_TYPE BoundingBox<VEC>::minSize() const
{ {
assert(m_initialized || !"Bounding box not initialized");
typename VEC::DATA_TYPE min = m_pMax[0] - m_pMin[0] ; typename VEC::DATA_TYPE min = m_pMax[0] - m_pMin[0] ;
for(unsigned int i = 1; i < m_pMax.dimension(); ++i) for(unsigned int i = 1; i < m_pMax.dimension(); ++i)
{ {
...@@ -102,18 +110,21 @@ typename VEC::DATA_TYPE BoundingBox<VEC>::minSize() const ...@@ -102,18 +110,21 @@ typename VEC::DATA_TYPE BoundingBox<VEC>::minSize() const
template <typename VEC> template <typename VEC>
VEC BoundingBox<VEC>::diag() const VEC BoundingBox<VEC>::diag() const
{ {
assert(m_initialized || !"Bounding box not initialized");
return m_pMax - m_pMin ; return m_pMax - m_pMin ;
} }
template <typename VEC> template <typename VEC>
typename VEC::DATA_TYPE BoundingBox<VEC>::diagSize() const typename VEC::DATA_TYPE BoundingBox<VEC>::diagSize() const
{ {
assert(m_initialized || !"Bounding box not initialized");
return (m_pMax - m_pMin).norm() ; return (m_pMax - m_pMin).norm() ;
} }
template <typename VEC> template <typename VEC>
VEC BoundingBox<VEC>::center() const VEC BoundingBox<VEC>::center() const
{ {
assert(m_initialized || !"Bounding box not initialized");
VEC center = (m_pMax + m_pMin) / typename VEC::DATA_TYPE(2) ; VEC center = (m_pMax + m_pMin) / typename VEC::DATA_TYPE(2) ;
return center ; return center ;
} }
...@@ -128,6 +139,12 @@ bool BoundingBox<VEC>::isInitialized() const ...@@ -128,6 +139,12 @@ bool BoundingBox<VEC>::isInitialized() const
/* FUNCTIONS */ /* FUNCTIONS */
/**********************************************/ /**********************************************/
template <typename VEC>
void BoundingBox<VEC>::reset()
{
m_initialized=false;
}
template <typename VEC> template <typename VEC>
void BoundingBox<VEC>::addPoint(const VEC& p) void BoundingBox<VEC>::addPoint(const VEC& p)
{ {
...@@ -152,6 +169,7 @@ void BoundingBox<VEC>::addPoint(const VEC& p) ...@@ -152,6 +169,7 @@ void BoundingBox<VEC>::addPoint(const VEC& p)
template <typename VEC> template <typename VEC>
bool BoundingBox<VEC>::intersects(const BoundingBox<VEC>& bb) bool BoundingBox<VEC>::intersects(const BoundingBox<VEC>& bb)
{ {
assert(m_initialized || !"Bounding box not initialized");
VEC bbmin = bb.min() ; VEC bbmin = bb.min() ;
VEC bbmax = bb.max() ; VEC bbmax = bb.max() ;
for(unsigned int i = 0; i < bbmin.dimension(); ++i) for(unsigned int i = 0; i < bbmin.dimension(); ++i)
...@@ -167,6 +185,7 @@ bool BoundingBox<VEC>::intersects(const BoundingBox<VEC>& bb) ...@@ -167,6 +185,7 @@ bool BoundingBox<VEC>::intersects(const BoundingBox<VEC>& bb)
template <typename VEC> template <typename VEC>
void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb) void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
{ {
assert(m_initialized || !"Bounding box not initialized");
VEC bbmin = bb.min() ; VEC bbmin = bb.min() ;
VEC bbmax = bb.max() ; VEC bbmax = bb.max() ;
for(unsigned int i = 0; i < bbmin.dimension(); ++i) for(unsigned int i = 0; i < bbmin.dimension(); ++i)
...@@ -182,6 +201,7 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb) ...@@ -182,6 +201,7 @@ void BoundingBox<VEC>::fusion(const BoundingBox<VEC>& bb)
template <typename VEC> template <typename VEC>
bool BoundingBox<VEC>::contains(const VEC& p) bool BoundingBox<VEC>::contains(const VEC& p)
{ {
assert(m_initialized || !"Bounding box not initialized");
for(unsigned int i = 0; i < m_pMin.dimension(); ++i) for(unsigned int i = 0; i < m_pMin.dimension(); ++i)
{ {
if(m_pMin[i] > p[i]) if(m_pMin[i] > p[i])
...@@ -196,6 +216,7 @@ bool BoundingBox<VEC>::contains(const VEC& p) ...@@ -196,6 +216,7 @@ bool BoundingBox<VEC>::contains(const VEC& p)
template <typename VEC> template <typename VEC>
bool BoundingBox<VEC>::contains(const BoundingBox<VEC>& bb) bool BoundingBox<VEC>::contains(const BoundingBox<VEC>& bb)
{ {
assert(m_initialized || !"Bounding box not initialized");
return this->contains(bb.min()) && this->contains(bb.max()); return this->contains(bb.min()) && this->contains(bb.max());
} }
......
...@@ -53,7 +53,7 @@ void EmbeddedGMap3::sewFaces(Dart d, Dart e) ...@@ -53,7 +53,7 @@ void EmbeddedGMap3::sewFaces(Dart d, Dart e)
if (isOrbitEmbedded(VOLUME)) if (isOrbitEmbedded(VOLUME))
{ {
vEmb = getEmbedding(VOLUME, d); vEmb = getEmbedding(VOLUME, d);
embedOrbit(VOLUME, e, vEmb) ; embedOrbit(VOLUME, d, vEmb) ;
} }
} }
...@@ -101,16 +101,17 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e) ...@@ -101,16 +101,17 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
//topological sewing //topological sewing
GMap3::sewVolumes(d,e); GMap3::sewVolumes(d,e);
unsigned int vEmb = EMBNULL ;
//embed the vertex orbits from the oriented face with dart e //embed the vertex orbits from the oriented face with dart e
//with vertex orbits value from oriented face with dart d //with vertex orbits value from oriented face with dart d
if (isOrbitEmbedded(VERTEX)) if (isOrbitEmbedded(VERTEX))
{ {
unsigned int vEmb1 = EMBNULL ;
Dart dd = d ; Dart dd = d ;
do do
{ {
vEmb1 = getEmbedding(VERTEX, dd); vEmb = getEmbedding(VERTEX, dd);
embedOrbit(VERTEX, dd, vEmb1) ; embedOrbit(VERTEX, dd, vEmb) ;
dd = phi1(dd) ; dd = phi1(dd) ;
} while(dd != d) ; } while(dd != d) ;
} }
...@@ -119,12 +120,11 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e) ...@@ -119,12 +120,11 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
//for all the face //for all the face
if (isOrbitEmbedded(EDGE)) if (isOrbitEmbedded(EDGE))
{ {
unsigned int vEmb1 = EMBNULL ;
Dart dd = d ; Dart dd = d ;
do do
{ {
vEmb1 = getEmbedding(EDGE, dd); vEmb = getEmbedding(EDGE, dd);
embedOrbit(EDGE, dd, vEmb1) ; embedOrbit(EDGE, dd, vEmb) ;
dd = phi1(dd) ; dd = phi1(dd) ;
} while(dd != d) ; } while(dd != d) ;
} }
...@@ -132,7 +132,7 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e) ...@@ -132,7 +132,7 @@ void EmbeddedGMap3::sewVolumes(Dart d, Dart e)
//embed the face orbit from the volume sewn //embed the face orbit from the volume sewn
if (isOrbitEmbedded(FACE)) if (isOrbitEmbedded(FACE))
{ {
unsigned int vEmb = getEmbedding(FACE, d); vEmb = getEmbedding(FACE, d);
embedOrbit(FACE, e, vEmb) ; embedOrbit(FACE, e, vEmb) ;
} }
} }
...@@ -385,8 +385,8 @@ bool EmbeddedGMap3::check() ...@@ -385,8 +385,8 @@ bool EmbeddedGMap3::check()
CGoGNout << "Check: embedding begin" << CGoGNendl ; CGoGNout << "Check: embedding begin" << CGoGNendl ;
DartMarker * dvMark, * deMark, * dfMark, * dvolMark; DartMarker * dvMark=NULL, * deMark=NULL, * dfMark=NULL, * dvolMark=NULL;
CellMarker * vMark, * eMark, * fMark, * volMark; CellMarker * vMark=NULL, * eMark=NULL, * fMark=NULL, * volMark=NULL;
if (isOrbitEmbedded(VERTEX)) if (isOrbitEmbedded(VERTEX))
{ {
...@@ -423,19 +423,19 @@ bool EmbeddedGMap3::check() ...@@ -423,19 +423,19 @@ bool EmbeddedGMap3::check()
if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta1(d))) if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta1(d)))
{ {
CGoGNout << "Check: different embeddings on vertex (1)" << CGoGNendl ; CGoGNout << "Check: different embeddings on vertex (beta1)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta2(d))) if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta2(d)))
{ {
CGoGNout << "Check: different embeddings on vertex (2)" << CGoGNendl ; CGoGNout << "Check: different embeddings on vertex (beta2)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta3(d))) if (getEmbedding(VERTEX, d) != getEmbedding(VERTEX, beta3(d)))
{ {
CGoGNout << "Check: different embeddings on vertex (3)" << CGoGNendl ; CGoGNout << "Check: different embeddings on vertex (beta3)" << CGoGNendl ;
return false ; return false ;
} }
} }
...@@ -449,20 +449,20 @@ bool EmbeddedGMap3::check() ...@@ -449,20 +449,20 @@ bool EmbeddedGMap3::check()
if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta0(d))) if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta0(d)))
{ {
CGoGNout << "Check: different embeddings on edge (0)" << CGoGNendl ; CGoGNout << "Check: different embeddings on edge (beta0)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta2(d))) if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta2(d)))
{ {
CGoGNout << "Check: different embeddings on edge (1)" << CGoGNendl ; CGoGNout << "Check: different embeddings on edge (beta2)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta3(d))) if (getEmbedding(EDGE, d) != getEmbedding(EDGE, beta3(d)))
{ {
CGoGNout << "Check: different embeddings on edge (2)" << CGoGNendl ; CGoGNout << "Check: different embeddings on edge (beta3)" << CGoGNendl ;
return false ; // return false ;
} }
} }
...@@ -475,13 +475,13 @@ bool EmbeddedGMap3::check() ...@@ -475,13 +475,13 @@ bool EmbeddedGMap3::check()
if (getEmbedding(FACE, d) != getEmbedding(FACE, beta0(d))) if (getEmbedding(FACE, d) != getEmbedding(FACE, beta0(d)))
{ {
CGoGNout << "Check: different embeddings on face (0)" << CGoGNendl ; CGoGNout << "Check: different embeddings on face (beta0)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(FACE, d) != getEmbedding(FACE, beta1(d))) if (getEmbedding(FACE, d) != getEmbedding(FACE, beta1(d)))
{ {
CGoGNout << "Check: different embeddings on face (1)" << CGoGNendl ; CGoGNout << "Check: different embeddings on face (beta1)" << CGoGNendl ;
return false ; return false ;
} }
} }
...@@ -495,19 +495,19 @@ bool EmbeddedGMap3::check() ...@@ -495,19 +495,19 @@ bool EmbeddedGMap3::check()
if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta0(d))) if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta0(d)))
{ {
CGoGNout << "Check: different embeddings in volume (0)" << CGoGNendl ; CGoGNout << "Check: different embeddings in volume (beta0)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta1(d))) if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta1(d)))
{ {
CGoGNout << "Check: different embeddings in volume (1)" << CGoGNendl ; CGoGNout << "Check: different embeddings in volume (beta1)" << CGoGNendl ;
return false ; return false ;
} }
if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta2(d))) if (getEmbedding(VOLUME, d) != getEmbedding(VOLUME, beta2(d)))
{ {
CGoGNout << "Check: different embeddings in volume (2)" << CGoGNendl ; CGoGNout << "Check: different embeddings in volume (beta2)" << CGoGNendl ;
return false ; return false ;
} }
} }
......
...@@ -669,56 +669,15 @@ bool GMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread) ...@@ -669,56 +669,15 @@ bool GMap3::foreach_dart_of_vertex(Dart d, FunctorType& f, unsigned int thread)
return found; return found;
} }
// TODO:optimize traversal of edges ?
bool GMap3::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread) bool GMap3::foreach_dart_of_edge(Dart d, FunctorType& f, unsigned int thread)
{ {
Dart dNext = d; Dart dNext = d;
do do {
{
if (GMap2::foreach_dart_of_edge(dNext,f,thread)) if (GMap2::foreach_dart_of_edge(dNext,f,thread))
return true; return true;
dNext = alpha2(dNext); dNext = alpha2(dNext);
} while (dNext != d); } while (dNext != d);
return false; return false;
// DartMarkerStore mv(*this,thread); // Lock a marker
// bool found = false; // Last functor return value
// std::list<Dart> darts_list; //Darts that are traversed
// darts_list.push_back(d); //Start with the dart d
// std::list<Dart>::iterator darts;
//
// mv.mark(d);
//
// for(darts = darts_list.begin(); !found && darts != darts_list.end() ; ++darts)
// {
// Dart dc = *darts;
//
// Dart dx = beta0(dc);
// if (!mv.isMarked(dx))
// {
// mv.mark(dx);
// darts_list.push_back(dx);
// }
//
// dx = beta2(dc);
// if (!mv.isMarked(dx))
// {
// mv.mark(dx);
// darts_list.push_back(dx);
// }
//
// dx = beta3(dc);
// if (!mv.isMarked(dx))
// {
// mv.mark(dx);
// darts_list.push_back(dx);
// }
//
// found = f(dc);
// }
//
// return found;
} }
bool GMap3::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread) bool GMap3::foreach_dart_of_face(Dart d, FunctorType& f, unsigned int thread)
......
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